我有一个摄像头,可以流式传输 application/x-mplayer2 类型的视频,格式:MSMPEG-4 V3 Video。当我尝试使用 android 打开流时,它会引发错误:“抱歉,无法播放此视频。”。我尝试用这个流式传输:
private void playVideo() {
try {
final String path = "http://82.140.132.217:8001";
System.out.println("path --> "+path);
Log.v(TAG, "path: " + path);
if (path == null || path.length() == 0) {
Toast.makeText(MainActivity.this, "File URL/path is empty",
Toast.LENGTH_LONG).show();
} else {
// If the path has not changed, just start the media player
if (path.equals(current) && mVideoView != null) {
mVideoView.start();
mVideoView.requestFocus();
return;
}
current = path;
System.out.println("Current path --> "+path);
mVideoView.setVideoPath(getDataSource(path));
mVideoView.start();
mVideoView.requestFocus();
System.out.println("end try in play");
}
} catch (Exception e) {
Log.e(TAG, "error: " + e.getMessage(), e);
if (mVideoView != null) {
mVideoView.stopPlayback();
}
}
}
如何流式传输此类视频?或者有什么方法可以将视频流转换为另一种类型?谢谢!