无法使用RTSP流在VideoView播放YouTube视频的 [英] Unable to play YouTube video in VideoView using RTSP streaming

查看:287
本文介绍了无法使用RTSP流在VideoView播放YouTube视频的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在写一个使用VideoView从YouTube播放视频的应用程序。

下面是我的code:

  VideoView videoView =(VideoView)findViewById(R.id.video_view);
videoView.setVideoURI(Uri.parse(文件路径));
videoView.setMediaController(新的MediaController(本));
videoView.requestFocus();
videoView.start();

在code可与此网址:http://commonsware.com/misc/test2.3gp

但不是这一个(从YouTube通过API):
\"rtsp://v4.cache7.c.youtube.com/CjsLENy73wIaMgl4q-dkJkOfrRMYDSANFEIXZ29vZ2xlLW1vdW50YWludmlldy0wLjFIBlIGdmlkZW9zDA==/0/0/0/video.3gp\"

错误日志如下。请注意:我想控制播放,所以我不找,涉及使用意图启动独立的YouTube播放器的解决方案。当我这样做,YouTube的视频播放,但它不是我需要做的。

真的会AP preciate任何帮助。

 八月八日至九日:01:34.923:信息/ AwesomePlayer(已34): setDataSource_l('rtsp://v4.cache7.c.youtube.com/CjsLENy73wIaMgl4q-dkJkOfrRMYDSANFEIXZ29vZ2xlLW1vdW50YWludmlldy0wLjFIBlIGdmlkZW9zDA==/0/0/0/video.3gp')
8月8日至9日:01:35.003:信息/ MyHandler的(34):连接请求与结果完成0(未知错误:0)
8月8日至9日:01:35.053:信息/ ARTSPConnection(34):状态:RTSP / 1.0 200 OK
8月8日至9日:01:35.083:信息/ MyHandler的(34):描述与结果0结束(未知错误:0)
08-09 08:01:35.103:信息/ ASessionDescription(34):V = 0
8月8日至9日:01:35.103:信息/ ASessionDescription(34):O = GoogleStreamer 1080479110 1215825987 IN IP4 74.125.214.211
8月8日至9日:01:35.103:信息/ ASessionDescription(34):S =视频
8月8日至9日:01:35.103:信息/ ASessionDescription(34):C = IN IP4 0.0.0.0
8月8日至9日:01:35.112:信息/ ASessionDescription(34):B = AS:73
8月8日至9日:01:35.112:信息/ ASessionDescription(34):T = 0 0
8月8日至9日:01:35.112:信息/ ASessionDescription(34):A =控制:*
8月8日至9日:01:35.112:信息/ ASessionDescription(34):A =范围:NPT = 0-21.333000
8月8日至9日:01:35.112:信息/ ASessionDescription(34):M = 0的视频RTP / AVP 98
8月8日至9日:01:35.112:信息/ ASessionDescription(34):B = AS:61
08-09 08:01:35.122:信息/ ASessionDescription(34)为:a = rtpmap:98 H263-2000 / 90000
8月8日至9日:01:35.122:信息/ ASessionDescription(34):A =控制:的TrackID = 0
8月8日至9日:01:35.122:信息/ ASessionDescription(34):A = CLI preCT:0,0,144,176
08-09 08:01:35.122:信息/ ASessionDescription(34):A =框架尺寸:98 176-144
08-09 08:01:35.122:信息/ ASessionDescription(34):A = FMTP:98信息= 0;水平= 10
08-09 08:01:35.122:信息/ ASessionDescription(34):M =音频0 RTP / AVP 99
8月8日至9日:01:35.143:信息/ ASessionDescription(34):B = AS:12
08-09 08:01:35.143:信息/ ASessionDescription(34)为:a = rtpmap:99 AMR /一分之八千
8月8日至9日:01:35.143:信息/ ASessionDescription(34):A =控制:的TrackID = 1
08-09 08:01:35.143:信息/ ASessionDescription(34):A = FMTP:99个八位字节对齐
8月8日至9日:01:35.212:信息/ ARTSPConnection(34):状态:RTSP / 1.0 200 OK
8月8日至9日:01:35.232:DEBUG / dalvikvm(567):GC_CONCURRENT释放443K,7%的游离7156K / 7687K,暂停为5ms + 4ms的
8月8日至9日:01:35.242:信息/ MyHandler的(34):SETUP(1)完成了结果0(未知错误:0)
8月8日至9日:01:35.292:信息/ ARTSPConnection(34):状态:RTSP / 1.0 200 OK
8月8日至9日:01:35.312:信息/ MyHandler的(34):SETUP(2)完成了与结果0(未知错误:0)
8月8日至9日:01:35.353:信息/ ARTSPConnection(34):状态:RTSP / 1.0 200 OK
8月8日至9日:01:35.382:信息/ MyHandler的(34):播放与结果完成0(未知错误:0)
8月8日至9日:01:45.383:WARN / MyHandler的(34):从未收到任何数据,交换传输。
8月8日至9日:01:45.424:信息/ ARTSPConnection(34):状态:RTSP / 1.0 200 OK
8月8日至9日:01:45.433:信息/ MyHandler的(34):TEARDOWN与结果完成0(未知错误:0)
8月8日至9日:01:455.38:信息/ MyHandler的(34):连接请求与结果完成0(未知错误:0)
8月8日至9日:01:45.582:信息/ ARTSPConnection(34):状态:RTSP / 1.0 200 OK
8月8日至9日:01:45.612:信息/ MyHandler的(34):描述与结果0结束(未知错误:0)
08-09 08:01:45.612:信息/ ASessionDescription(34):V = 0
8月8日至9日:01:45.612:信息/ ASessionDescription(34):O = GoogleStreamer 845535255 1838195113 IN IP4 74.125.214.211
8月8日至9日:01:45.612:信息/ ASessionDescription(34):S =视频
8月8日至9日:01:45.612:信息/ ASessionDescription(34):C = IN IP4 0.0.0.0
8月8日至9日:01:45.612:信息/ ASessionDescription(34):B = AS:73
8月8日至9日:01:45.612:信息/ ASessionDescription(34):T = 0 0
8月8日至9日:01:45.623:信息/ ASessionDescription(34):A =控制:*
8月8日至9日:01:45.623:信息/ ASessionDescription(34):A =范围:NPT = 0-21.333000
8月8日至9日:01:45.623:信息/ ASessionDescription(34):M = 0的视频RTP / AVP 98
8月8日至9日:01:45.623:信息/ ASessionDescription(34):B = AS:61
08-09 08:01:45.623:信息/ ASessionDescription(34)为:a = rtpmap:98 H263-2000 / 90000
8月8日至9日:01:45.623:信息/ ASessionDescription(34):A =控制:的TrackID = 0
8月8日至9日:01:45.633:信息/ ASessionDescription(34):A = CLI preCT:0,0,144,176
08-09 08:01:45.633:信息/ ASessionDescription(34):A =框架尺寸:98 176-144
08-09 08:01:45.633:信息/ ASessionDescription(34):A = FMTP:98信息= 0;水平= 10
08-09 08:01:45.633:信息/ ASessionDescription(34):M =音频0 RTP / AVP 99
8月8日至9日:01:45.633:信息/ ASessionDescription(34):B = AS:12
08-09 08:01:45.633:信息/ ASessionDescription(34)为:a = rtpmap:99 AMR /一分之八千
8月8日至9日:01:45.643:信息/ ASessionDescription(34):A =控制:的TrackID = 1
08-09 08:01:45.643:信息/ ASessionDescription(34):A = FMTP:99个八位字节对齐
8月8日至9日:01:45.673:信息/ ARTSPConnection(34):状态:RTSP / 1.0 461不支持交通运输
8月8日至9日:01:45.683:信息/ MyHandler的(34):SETUP(1)完成了结果0(未知错误:0)
8月8日至9日:01:45.713:信息/ ARTSPConnection(34):状态:RTSP / 1.0 461不支持交通运输
8月8日至9日:01:45.723:信息/ MyHandler的(34):SETUP(2)完成了与结果0(未知错误:0)
8月8日至9日:01:45.733:信息/ AwesomePlayer(已34):ARTSPController ::返回进行连接-2147483648
8月8日至9日:01:45.733:ERROR / MediaPlayer的(567):错误(1,-2147483648)
8月8日至9日:01:45.733:ERROR / MediaPlayer的(567):错误(1,-2147483648)
8月8日至9日:01:45.733:DEBUG / VideoView(567):错误:1,-2147483648


解决方案

添加Internet权限清单文件

 <使用许可权的android:NAME =android.permission.INTERNET对/>

和也请尝试这些URI:

 的rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.movhttp://www.wowza.com/_h264/BigBuckBunny_175k.mov

I'm writing an app that uses VideoView to play a video from YouTube.

Here's my code:

VideoView videoView = (VideoView)findViewById(R.id.video_view);
videoView.setVideoURI(Uri.parse(filePath));
videoView.setMediaController(new MediaController(this));
videoView.requestFocus();
videoView.start();

The code works with this url: "http://commonsware.com/misc/test2.3gp"

But not with this one (from YouTube via the API): "rtsp://v4.cache7.c.youtube.com/CjsLENy73wIaMgl4q-dkJkOfrRMYDSANFEIXZ29vZ2xlLW1vdW50YWludmlldy0wLjFIBlIGdmlkZW9zDA==/0/0/0/video.3gp"

Error logs are below. Please note: I want to control the playback, so I'm not looking for a solution that involves using intents to start the standalone youtube player. When I do that, the YouTube video plays, but it's not what I need to do.

Really would appreciate any help with this.

08-09 08:01:34.923: INFO/AwesomePlayer(34): setDataSource_l('rtsp://v4.cache7.c.youtube.com/CjsLENy73wIaMgl4q-dkJkOfrRMYDSANFEIXZ29vZ2xlLW1vdW50YWludmlldy0wLjFIBlIGdmlkZW9zDA==/0/0/0/video.3gp')
08-09 08:01:35.003: INFO/MyHandler(34): connection request completed with result 0 (Unknown error: 0)
08-09 08:01:35.053: INFO/ARTSPConnection(34): status: RTSP/1.0 200 OK
08-09 08:01:35.083: INFO/MyHandler(34): DESCRIBE completed with result 0 (Unknown error: 0)
08-09 08:01:35.103: INFO/ASessionDescription(34): v=0
08-09 08:01:35.103: INFO/ASessionDescription(34): o=GoogleStreamer 1080479110 1215825987 IN IP4 74.125.214.211
08-09 08:01:35.103: INFO/ASessionDescription(34): s=Video
08-09 08:01:35.103: INFO/ASessionDescription(34): c=IN IP4 0.0.0.0
08-09 08:01:35.112: INFO/ASessionDescription(34): b=AS:73
08-09 08:01:35.112: INFO/ASessionDescription(34): t=0 0
08-09 08:01:35.112: INFO/ASessionDescription(34): a=control:*
08-09 08:01:35.112: INFO/ASessionDescription(34): a=range:npt=0-21.333000
08-09 08:01:35.112: INFO/ASessionDescription(34): m=video 0 RTP/AVP 98
08-09 08:01:35.112: INFO/ASessionDescription(34): b=AS:61
08-09 08:01:35.122: INFO/ASessionDescription(34): a=rtpmap:98 H263-2000/90000
08-09 08:01:35.122: INFO/ASessionDescription(34): a=control:trackID=0
08-09 08:01:35.122: INFO/ASessionDescription(34): a=cliprect:0,0,144,176
08-09 08:01:35.122: INFO/ASessionDescription(34): a=framesize:98 176-144
08-09 08:01:35.122: INFO/ASessionDescription(34): a=fmtp:98 profile=0;level=10
08-09 08:01:35.122: INFO/ASessionDescription(34): m=audio 0 RTP/AVP 99
08-09 08:01:35.143: INFO/ASessionDescription(34): b=AS:12
08-09 08:01:35.143: INFO/ASessionDescription(34): a=rtpmap:99 AMR/8000/1
08-09 08:01:35.143: INFO/ASessionDescription(34): a=control:trackID=1
08-09 08:01:35.143: INFO/ASessionDescription(34): a=fmtp:99 octet-align
08-09 08:01:35.212: INFO/ARTSPConnection(34): status: RTSP/1.0 200 OK
08-09 08:01:35.232: DEBUG/dalvikvm(567): GC_CONCURRENT freed 443K, 7% free 7156K/7687K, paused 5ms+4ms
08-09 08:01:35.242: INFO/MyHandler(34): SETUP(1) completed with result 0 (Unknown error: 0)
08-09 08:01:35.292: INFO/ARTSPConnection(34): status: RTSP/1.0 200 OK
08-09 08:01:35.312: INFO/MyHandler(34): SETUP(2) completed with result 0 (Unknown error: 0)
08-09 08:01:35.353: INFO/ARTSPConnection(34): status: RTSP/1.0 200 OK
08-09 08:01:35.382: INFO/MyHandler(34): PLAY completed with result 0 (Unknown error: 0)
08-09 08:01:45.383: WARN/MyHandler(34): Never received any data, switching transports.
08-09 08:01:45.424: INFO/ARTSPConnection(34): status: RTSP/1.0 200 OK
08-09 08:01:45.433: INFO/MyHandler(34): TEARDOWN completed with result 0 (Unknown error: 0)
08-09 08:01:45.538: INFO/MyHandler(34): connection request completed with result 0 (Unknown error: 0)
08-09 08:01:45.582: INFO/ARTSPConnection(34): status: RTSP/1.0 200 OK
08-09 08:01:45.612: INFO/MyHandler(34): DESCRIBE completed with result 0 (Unknown error: 0)
08-09 08:01:45.612: INFO/ASessionDescription(34): v=0
08-09 08:01:45.612: INFO/ASessionDescription(34): o=GoogleStreamer 845535255 1838195113 IN IP4 74.125.214.211
08-09 08:01:45.612: INFO/ASessionDescription(34): s=Video
08-09 08:01:45.612: INFO/ASessionDescription(34): c=IN IP4 0.0.0.0
08-09 08:01:45.612: INFO/ASessionDescription(34): b=AS:73
08-09 08:01:45.612: INFO/ASessionDescription(34): t=0 0
08-09 08:01:45.623: INFO/ASessionDescription(34): a=control:*
08-09 08:01:45.623: INFO/ASessionDescription(34): a=range:npt=0-21.333000
08-09 08:01:45.623: INFO/ASessionDescription(34): m=video 0 RTP/AVP 98
08-09 08:01:45.623: INFO/ASessionDescription(34): b=AS:61
08-09 08:01:45.623: INFO/ASessionDescription(34): a=rtpmap:98 H263-2000/90000
08-09 08:01:45.623: INFO/ASessionDescription(34): a=control:trackID=0
08-09 08:01:45.633: INFO/ASessionDescription(34): a=cliprect:0,0,144,176
08-09 08:01:45.633: INFO/ASessionDescription(34): a=framesize:98 176-144
08-09 08:01:45.633: INFO/ASessionDescription(34): a=fmtp:98 profile=0;level=10
08-09 08:01:45.633: INFO/ASessionDescription(34): m=audio 0 RTP/AVP 99
08-09 08:01:45.633: INFO/ASessionDescription(34): b=AS:12
08-09 08:01:45.633: INFO/ASessionDescription(34): a=rtpmap:99 AMR/8000/1
08-09 08:01:45.643: INFO/ASessionDescription(34): a=control:trackID=1
08-09 08:01:45.643: INFO/ASessionDescription(34): a=fmtp:99 octet-align
08-09 08:01:45.673: INFO/ARTSPConnection(34): status: RTSP/1.0 461 Unsupported Transport
08-09 08:01:45.683: INFO/MyHandler(34): SETUP(1) completed with result 0 (Unknown error: 0)
08-09 08:01:45.713: INFO/ARTSPConnection(34): status: RTSP/1.0 461 Unsupported Transport
08-09 08:01:45.723: INFO/MyHandler(34): SETUP(2) completed with result 0 (Unknown error: 0)
08-09 08:01:45.733: INFO/AwesomePlayer(34): ARTSPController::connect returned -2147483648
08-09 08:01:45.733: ERROR/MediaPlayer(567): error (1, -2147483648)
08-09 08:01:45.733: ERROR/MediaPlayer(567): Error (1,-2147483648)
08-09 08:01:45.733: DEBUG/VideoView(567): Error: 1,-2147483648

解决方案

add the Internet permission to the manifest file

 <uses-permission android:name="android.permission.INTERNET" />

and also please try these URIs:

rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov

http://www.wowza.com/_h264/BigBuckBunny_175k.mov

这篇关于无法使用RTSP流在VideoView播放YouTube视频的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆