主要的.xml
<?xml version="1.0" encoding="utf-8"?>
<io.vov.vitamio.widget.CenterLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/video_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:orientation="horizontal" >
<io.vov.vitamio.widget.VideoView
android:id="@+id/video"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:saveEnabled="true" />
</io.vov.vitamio.widget.CenterLayout>
MainActivity.java
公共类 MainActivity 扩展 Activity {
private String path = "http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8";
private VideoView mVideoView;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
test_2();
}
private void test_2() throws VitamioNotCompatibleException, VitamioNotFoundException, NameNotFoundException{
VR.init(getApplicationContext());
mVideoView =(VideoView)findViewById(R.id.VideoView);
mVideoView.setVideoPath(path);
mVideoView.setVideoQuality(MediaPlayer.VIDEOQUALITY_HIGH);
mVideoView.setMediaController(new MediaController(this));
}
}
清单.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.videovit"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.GET_TASKS" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
错误:当我运行程序时,main.xml 出现错误。我不知道这段代码的主要问题是什么。我尝试在 videoview 中从远程 url 播放 flv 文件。我也尝试添加清单文件。但是不知道我应该添加什么图书馆。