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 –