Android 媒体播放器无法播放 RTSP 流抛出错误 (100, 0)
Posted
技术标签:
【中文标题】Android 媒体播放器无法播放 RTSP 流抛出错误 (100, 0)【英文标题】:Android media player unable to play RTSP stream throwing error (100, 0) 【发布时间】:2012-04-02 09:45:50 【问题描述】:我正在尝试使用视频视图播放 rtsp 流:-
@Override
protected void onCreate(Bundle savedInstanceState)
HEADER_BLOCK = true;
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.video_view);
super.onCreate(savedInstanceState);
progressDialog = ProgressDialog.show(this, "Loading", "Opening video...", true);
mediaController = new MediaController(VideoStreamingActivity.this);
videoView = (VideoView) findViewById(R.id.myvideoview);
videoView.setMediaController(mediaController);
videoView.setVideoURI(Uri.parse(streamerUrl));
videoView.setOnPreparedListener(new OnPreparedListener()
@Override
public void onPrepared(MediaPlayer mp)
progressDialog.dismiss();
videoView.start();
startTime = startTime * 60000;
videoView.seekTo(Integer.parseInt(String.valueOf(startTime).substring(0, String.valueOf(startTime).indexOf("."))));
mediaController.show();
);
videoView.setOnErrorListener(new OnErrorListener()
@Override
public boolean onError(MediaPlayer mp, int what, int extra)
progressDialog.dismiss();
if(what==1 && extra==-1)
Toast.makeText(VideoStreamingActivity.this,
"Sorry!! unable to play the video since the video not compatible with your android player.",
Toast.LENGTH_LONG).show();
else
Toast.makeText(VideoStreamingActivity.this,
"Unable to play selected video", Toast.LENGTH_LONG).show();
VideoStreamingActivity.super.onBackPressed();
return true;
);
“streamerUrl”是从 wowza 服务器生成的正确 rtsp url...但在 logcat 中我收到以下错误。
04-02 09:22:41.476: D/VideoView(9178): onMeasure()
04-02 09:22:41.476: I/VideoView(9178): Setting size: 320x221
04-02 09:22:41.484: D/VideoView(9178): onMeasure()
04-02 09:22:41.484: I/VideoView(9178): Setting size: 320x221
04-02 09:22:41.546: V/GoogleAnalyticsTracker(9178): HTTP Response Code: 200
04-02 09:22:41.578: I/MediaPlayer(9178): path is null
04-02 09:22:41.578: D/MediaPlayer(9178): Couldn't open file on client side, trying server side
04-02 09:22:41.679: D/VideoView(9178): onMeasure()
04-02 09:22:41.679: I/VideoView(9178): Setting size: 320x221
04-02 09:22:41.679: D/VideoView(9178): onMeasure()
04-02 09:22:41.679: I/VideoView(9178): Setting size: 320x221
04-02 09:22:50.210: W/Audiosystem(9178): AudioFlinger server died!
04-02 09:22:50.210: W/IMediaDeathNotifier(9178): media server died
04-02 09:22:50.210: E/MediaPlayer(9178): error (100, 0)
04-02 09:22:50.210: E/MediaPlayer(9178): Error (100,0)
04-02 09:22:50.210: D/VideoView(9178): Error: 100,0
谁能告诉我发生了什么?
【问题讨论】:
您找到解决错误 100 的方法了吗? 【参考方案1】:记得在 manifest.xml 文件中添加上网权限:
<uses-permission android:name="android.permission.INTERNET" />
您能否通过尝试测试 rtsp 视频流:
rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov
如果还是不行,请告诉我是什么问题
【讨论】:
以上是关于Android 媒体播放器无法播放 RTSP 流抛出错误 (100, 0)的主要内容,如果未能解决你的问题,请参考以下文章
直播 RTMP/RTSP 播放器,无需在 Android 上使用 webview(WOWZA 服务器)