2
我一直在嘗試播放來自遠程網址/ dailymotion的mp4視頻。我從其他網站以.3gp格式播放過其他視頻,它工作正常,不能在我的Android應用播放從日常運動的任何視頻,在這裏是我的代碼,無法瞭解issue.any幫助從遠程URL無法在Android VIdeoview中播放mp4視頻
<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" >
<VideoView
android:id="@+id/VideoView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
`
公共類歌曲延伸活動{
String VideoURL = "http://www.dailymotion.com/video/x2trnoh_indian-girl-mehndi-dance_fun";
VideoView videoview;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get the layout from video_main.xml
setContentView(R.layout.songs);
// Find your VideoView in your video_main.xml layout
videoview = (VideoView) findViewById(R.id.VideoView);
try {
// Start the MediaController
MediaController mediacontroller = new MediaController(
songs.this);
mediacontroller.setAnchorView(videoview);
// Get the URL from String VideoURL
Uri video = Uri.parse(VideoURL);
videoview.setMediaController(mediacontroller);
videoview.setVideoURI(video);
videoview.requestFocus();
videoview.setOnPreparedListener(new OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
videoview.start();
}
});
} catch (Exception e) {
System.out.println("Video Play Error :" + e.getMessage());
}
}}
好的,謝謝,讓我看看,我希望,它會工作 – aleem4
我已經下載這dailymotion -SDK-android,我怎樣才能導入這個每日議案sdk在我的eclipse項目,執行盟友我是一個完整的初學者 – aleem4
按照此鏈接http://stackoverflow.com/questions/23984962/how-to-play-dailymotion-video-inside-a-webview-in-android –