我有大麻烦了,我不能在我的安卓videoview中播放m3u8文件,但在iPhone中它是如此简单。我在谷歌上搜索并访问了几个论坛,都说这是不可能的。但我试过vitamio(http://vov.io/vitamio/),它可以流媒体5到6秒。这是一个流媒体的机会,但如何呢?
如果android中的m3u8流媒体很难,如何从IPcamera流媒体到我的android设备?
如果有人知道这件事,请给我回复,我非常感谢你的回复,因为我为此花费了更多的时间。
发布于 2012-05-11 15:46:29
我试过安卓2.1、2.2、2.3、2.3.6和4.0版本的设备。vitamio应用程序可以在除具有android版本4.0的设备HTC onex之外的所有设备中流式传输url 5到6秒。
我调用简单m3u8 url的代码如下所示。非常感谢你。
活动:
package com.livestrean;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.MediaController;
import android.widget.Toast;
import android.widget.VideoView;
public class streamplayer extends Activity {
/** Called when the activity is first created. */
private String path = "An m3u8 Url";
private VideoView mVideoView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try
{
setContentView(R.layout.surface_view_1);
mVideoView = (VideoView) findViewById(R.id.surface_view);
mVideoView.setVideoURI(Uri.parse(path));
mVideoView.setMediaController(new MediaController(this));
mVideoView.requestFocus();
mVideoView.postInvalidateDelayed(100);
mVideoView.start();
}catch (Exception e) {
Toast.makeText(streamplayer.this,"Error Occured:- " + e.getMessage(),Toast.LENGTH_SHORT).show();
}
}
}布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<VideoView
android:id="@+id/surface_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"/>
</LinearLayout>谢谢
https://stackoverflow.com/questions/10407833
复制相似问题