3
我試圖用videoview lib在我的nexus 7(android 4.2)上流式傳輸視頻,但是當我啓動時,我的nexus 7顯示「Can not play this Video」該應用程序,希望你能幫助。 我的源代碼:Nexus 7 Android Java VideoView,無法播放這個視頻
package com.test.prog;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.VideoView;
public class MainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Uri viduri=Uri.parse("http://www.law.duke.edu/cspd/contest/finalists/viewentry.php?file=docandyou");
VideoView video=(VideoView)findViewById(R.id.videoview);
video.setVideoURI(viduri);
}
}
和佈局
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
tools:context=".MainActivity" >
<VideoView
android:id="@+id/videoview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
/>
</RelativeLayout>
logcat的說:
11-19 17:46:08.504: D/VideoView(16804): Error: 1,0
11-19 17:46:19.504: D/MediaPlayer(16804): Couldn't open file on client side, trying server side
11-19 17:46:19.504: E/MediaPlayer(16804): Unable to to create media player
問候 基督教
Android不會播放所有內容。檢查http://developer.android.com/guide/appendix/media-formats.html – zapl
我嘗試了很多不同類型的視頻,但沒有人在我的Nexus 7上工作,你是否有視頻工作視頻樣本? – user1836363
我在同一臺設備上遇到同樣的問題。我已經添加了一個onPrepare監聽器來調用VideoView.start,並獲取音頻,但沒有視頻。你有沒有設法解決這個問題? –