简体   繁体   English

在Android中串流.asx

[英]Streaming .asx in Android

I've been trying to stream .asx file and it was not working and mediaplayer returns errors. 我一直在尝试流.asx文件,但该文件无法正常工作,并且Mediaplayer返回错误。

This is my code 这是我的代码

    MediaPlayer mp = new MediaPlayer();  
    MediaPlayer mp = new MediaPlayer();  
                try {
                    Uri uri = Uri.parse("http://www.tamilatlas.com/tamilrmxs/dynasty/dynastychunez.asx");
                    mp.setDataSource(uri.toString());
                    mp.prepare();
                } catch (IllegalArgumentException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IllegalStateException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

mp.start();

I found following error in logcat 我在logcat中发现以下错误

11-01 10:03:59.484: E/MediaPlayer(21233): error (1, -2147483648)
11-01 10:03:59.484: W/System.err(21233): java.io.IOException: Prepare failed.: status=0x1
11-01 10:03:59.488: W/System.err(21233):    at android.media.MediaPlayer.prepare(Native Method)
11-01 10:03:59.488: W/System.err(21233):    at com.mayuonline.streaming.StreamingActivity.onCreate(StreamingActivity.java:18)
11-01 10:03:59.488: W/System.err(21233):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-01 10:03:59.488: W/System.err(21233):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
11-01 10:03:59.488: W/System.err(21233):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
11-01 10:03:59.488: W/System.err(21233):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
11-01 10:03:59.488: W/System.err(21233):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
11-01 10:03:59.492: W/System.err(21233):    at android.os.Handler.dispatchMessage(Handler.java:99)
11-01 10:03:59.492: W/System.err(21233):    at android.os.Looper.loop(Looper.java:123)
11-01 10:03:59.496: W/System.err(21233):    at android.app.ActivityThread.main(ActivityThread.java:3683)
11-01 10:03:59.496: W/System.err(21233):    at java.lang.reflect.Method.invokeNative(Native Method)
11-01 10:03:59.499: W/System.err(21233):    at java.lang.reflect.Method.invoke(Method.java:507)
11-01 10:03:59.499: W/System.err(21233):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-01 10:03:59.499: W/System.err(21233):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-01 10:03:59.499: W/System.err(21233):    at dalvik.system.NativeStart.main(Native Method)
11-01 10:03:59.503: E/MediaPlayer(21233): start called in state 0
11-01 10:03:59.507: E/MediaPlayer(21233): error (-38, 0)
11-01 10:03:59.511: E/MediaPlayer(21233): Error (-38,0)

Thanks for your time. 谢谢你的时间。 I've been searching in many place but there are no valid example for asx streaming. 我在很多地方都进行了搜索,但是没有有效的asx流媒体示例。

You will have to parse the .asx file, to find the links(s) to the real stream there. 您将必须解析.asx文件,以找到指向真实流的链接。

Here's a link for the .asx file format, maybe that can give you some hints as to how you will parse it: http://en.wikipedia.org/wiki/Advanced_Stream_Redirector 这是.asx文件格式的链接,也许可以为您提供一些有关如何解析它的提示: http : //en.wikipedia.org/wiki/Advanced_Stream_Redirector

I can tell you that I succeded in parsing one .asx file with the Scanner class. 我可以告诉你,我成功地使用Scanner类解析了一个.asx文件。 I did not find any general solution though. 我没有找到任何一般的解决方案。 But maybe this is enough to get you started. 但这也许足以让您入门。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM