04-24 21:51:06.092: I/global(406): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
04-24 21:51:06.296: D/PlsParser(406): Playlist Url = http:/ / 85 dot 204 dot 233 dot 122/radio-01/stream-high-02/playlist.m3u8?wowzasessionid=1094958256
04-24 21:51:06.296: I/System.out(406): Playlist: Selected url - http:/ / 85 dot 204 dot 233 dot 122/radio-01/stream-high-02/playlist.m3u8?wowzasessionid=1094958256
04-24 21:51:06.616: E/MediaPlayer(406): error (1, -2147483648)
04-24 21:51:06.622: E/MediaPlayer(406): Error (1,-2147483648)
04-24 21:51:06.622: I/System.out(406): RadioService: stop
04-24 21:51:06.632: E/MediaPlayer(406): stop called in state 0
04-24 21:51:06.632: E/MediaPlayer(406): error (-38, 0)
04-24 21:51:06.652: V/ERROR(406): MEDIA ERROR UNKNOWN -2147483648
04-24 21:51:06.672: E/MediaPlayer(406): stop called in state 1
04-24 21:51:06.672: E/MediaPlayer(406): error (-38, 0)
04-24 21:51:06.692: D/PlsParser(406): Setting next stream from playlist: 0
04-24 21:51:06.692: D/PlsParser(406): URL = http:/ / 85 dot 204 dot 233 dot 122/radio-01/stream-high-02/playlist.m3u8?wowzasessionid=1094958256
04-24 21:51:06.822: I/global(406): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
04-24 21:51:07.002: D/PlsParser(406): Playlist Url = http:/ / 85 dot 204 dot 233 dot 122:1935/radio-01/_definst_/stream-high-02/key.m3u8key?wowzasessionid=1094958256"
04-24 21:51:07.002: W/dalvikvm(406): threadid=18: thread exiting with uncaught exception (group=0x4001d800)
04-24 21:51:07.002: E/AndroidRuntime(406): FATAL EXCEPTION: Thread-21
04-24 21:51:07.002: E/AndroidRuntime(406): java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1
04-24 21:51:07.002: E/AndroidRuntime(406): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:257)
04-24 21:51:07.002: E/AndroidRuntime(406): at java.util.ArrayList.get(ArrayList.java:311)
04-24 21:51:07.002: E/AndroidRuntime(406): at com.my.radio.RadioService$3.run(RadioService.java:294)
04-24 21:51:07.002: E/AndroidRuntime(406): at java.lang.Thread.run(Thread.java:1096)
04-24 21:51:07.432: D/webviewglue(406): nativeDestroy view: 0x3037c0
04-24 21:51:07.442: D/webviewglue(406): nativeDestroy view: 0x303450
04-24 21:51:08.022: D/dalvikvm(406): GC_EXPLICIT freed 5811 objects / 296264 bytes in 501ms
04-24 21:51:08.412: E/ActivityThread(406): Activity com.my.radio.MainActivity has leaked ServiceConnection com.my.radio.BaseActivity$1@45fd26a8 that was originally bound here
04-24 21:51:08.412: E/ActivityThread(406): android.app.ServiceConnectionLeaked: Activity com.my.radio.MainActivity has leaked ServiceConnection com.my.radio.BaseActivity$1@45fd26a8 that was originally bound here
04-24 21:51:08.412: E/ActivityThread(406): at android.app.ActivityThread$PackageInfo$ServiceDispatcher.<init>(ActivityThread.java:1121)
04-24 21:51:08.412: E/ActivityThread(406): at android.app.ActivityThread$PackageInfo.getServiceDispatcher(ActivityThread.java:1016)
04-24 21:51:08.412: E/ActivityThread(406): at android.app.ContextImpl.bindService(ContextImpl.java:863)
04-24 21:51:08.412: E/ActivityThread(406): at android.content.ContextWrapper.bindService(ContextWrapper.java:347)
04-24 21:51:08.412: E/ActivityThread(406): at com.my.radio.BaseActivity.onCreate(BaseActivity.java:39)
04-24 21:51:08.412: E/ActivityThread(406): at com.my.radio.MainActivity.onCreate(MainActivity.java:79)
04-24 21:51:08.412: E/ActivityThread(406): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-24 21:51:08.412: E/ActivityThread(406): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-24 21:51:08.412: E/ActivityThread(406): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-24 21:51:08.412: E/ActivityThread(406): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-24 21:51:08.412: E/ActivityThread(406): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-24 21:51:08.412: E/ActivityThread(406): at android.os.Handler.dispatchMessage(Handler.java:99)
04-24 21:51:08.412: E/ActivityThread(406): at android.os.Looper.loop(Looper.java:123)
04-24 21:51:08.412: E/ActivityThread(406): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-24 21:51:08.412: E/ActivityThread(406): at java.lang.reflect.Method.invokeNative(Native Method)
04-24 21:51:08.412: E/ActivityThread(406): at java.lang.reflect.Method.invoke(Method.java:521)
04-24 21:51:08.412: E/ActivityThread(406): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-24 21:51:08.412: E/ActivityThread(406): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-24 21:51:08.412: E/ActivityThread(406): at dalvik.system.NativeStart.main(Native Method)
04-24 21:51:08.463: E/ActivityThread(406): Activity com.my.radio.MainActivity has leaked ServiceConnection com.my.radio.MainActivity$2@45fd30d8 that was originally bound here
04-24 21:51:08.463: E/ActivityThread(406): android.app.ServiceConnectionLeaked: Activity com.my.radio.MainActivity has leaked ServiceConnection com.my.radio.MainActivity$2@45fd30d8 that was originally bound here
04-24 21:51:08.463: E/ActivityThread(406): at android.app.ActivityThread$PackageInfo$ServiceDispatcher.<init>(ActivityThread.java:1121)
04-24 21:51:08.463: E/ActivityThread(406): at android.app.ActivityThread$PackageInfo.getServiceDispatcher(ActivityThread.java:1016)
04-24 21:51:08.463: E/ActivityThread(406): at android.app.ContextImpl.bindService(ContextImpl.java:863)
04-24 21:51:08.463: E/ActivityThread(406): at android.content.ContextWrapper.bindService(ContextWrapper.java:347)
04-24 21:51:08.463: E/ActivityThread(406): at com.my.radio.MainActivity.onCreate(MainActivity.java:85)
04-24 21:51:08.463: E/ActivityThread(406): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-24 21:51:08.463: E/ActivityThread(406): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-24 21:51:08.463: E/ActivityThread(406): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-24 21:51:08.463: E/ActivityThread(406): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-24 21:51:08.463: E/ActivityThread(406): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-24 21:51:08.463: E/ActivityThread(406): at android.os.Handler.dispatchMessage(Handler.java:99)
04-24 21:51:08.463: E/ActivityThread(406): at android.os.Looper.loop(Looper.java:123)
04-24 21:51:08.463: E/ActivityThread(406): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-24 21:51:08.463: E/ActivityThread(406): at java.lang.reflect.Method.invokeNative(Native Method)
04-24 21:51:08.463: E/ActivityThread(406): at java.lang.reflect.Method.invoke(Method.java:521)
04-24 21:51:08.463: E/ActivityThread(406): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-24 21:51:08.463: E/ActivityThread(406): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-24 21:51:08.463: E/ActivityThread(406): at dalvik.system.NativeStart.main(Native Method)
04-24 21:51:09.452: I/Process(406): Sending signal. PID: 406 SIG: 9
答案 0 :(得分:2)
欢迎来到Stackoverflow.com :),我认为你有一个IndexOutofBounds异常:java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1
这是我如何使用.M3U8
VideoView
的示例
private VideoView myvideoview;
private String urlStream;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String streamV = "http://media.jorgesys.com/reforma.m3u8";
new playM3U8().execute(streamV);
myvideoview = (VideoView)this.findViewById(R.id.myvideoview);
myvideoview.setOnPreparedListener(new OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
myvideoview.start();
}
});
myvideoview.setOnErrorListener(new OnErrorListener() {
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
Log.i("Exception", "url: " + url);
return false;
}
});
}
这个类是播放M3U8的AyncTask:
class playM3U8 extends AsyncTask<String, Void, Void> {
private Exception exception;
protected Void doInBackground(String... urls) {
urlStream = urls[0];
runOnUiThread(new Runnable() {
@Override
public void run() {
myvideoview.setVideoURI(Uri.parse(urlStream));
}
});
return null;
}
protected void onPostExecute(String feed) {
Log.i("*** Streaming M3U8", "url: " + urlStream );
}
}