Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Android SDK Audio Streaming


i want to play audio stream with JWPlayerView. so far no problem.
but i want to use it in a background service. so i tried to create to JWPlayerView programmatically within the service but with the context of the service.
the audio is played but if the device is moving the app crash. it throwing that exception ClassCastException

java.lang.ClassCastException: com.application.app.AudioService cannot be cast to android.app.Activity at com.longtailvideo.jwplayer.b.h$1.onOrientationChanged(SourceFile:29)
at android.view.OrientationEventListener$SensorEventListenerImpl.onSensorChanged(OrientationEventListener.java:456)
at android.hardware.SystemSensorManager$SensorEventQueue.dispatchSensorEvent(SystemSensorManager.java:583)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:143)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

it happened because the OrientationEventListener. is there any way to disable it that so the app won't crash?
you can see how this is happend in my example code
https://drive.google.com/file/d/0BzgV0Xnk_yhnUk4wVHNSYlp1bmc/view?usp=drive_web

1 Community Answers

George

JW Player Support Agent  
0 rated :

Hello Michael,

Try this as an alternative:
http://qa.jwplayer.com.s3.amazonaws.com/~george/BackgroundAudio.zip

This question has received the maximum number of answers.