1

main.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));
}

}

Manifest.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でエラーが発生しました。このコードの主な問題は何ですか。ビデオビューでリモートURLからflvファイルを再生しようとしています。マニフェストファイルも追加してみます。しかし、私がそれに追加する必要のあるライブラリを知らないでください。

4

1 に答える 1

0

レイアウトにカスタム ウィジェットを使用しています。あなたio.vov.vitamio.widget.CenterLayout はクラスパスに含まれていますか?おそらく、Android は csutom ウィジェットを解決できず、エラーが発生します。

于 2012-12-31T09:13:50.177 に答える