无法从远程 url android VIdeoview 中播放 mp4 视频

Can not play a mp4 video in android VIdeoview from a remote url

我一直在尝试从远程播放 mp4 视频 url/dailymotion。我从其他网站播放了另一个 .3gp 格式的视频,效果很好,但无法播放日常运动中的任何视频在我的 android 应用程序中,这是我的所有代码,无法理解 issue.any 帮助

<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" />

`

public class 歌曲扩展 Activity {

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());
    }

   }}

ASAIK,我们无法在正常 android 视频视图中播放 dailymotion 视频。所以而不是视频视图为什么你不能尝试他们的 SDK here 并在 webview 中呈现它。

Dailymotion 提供了一个基于 WebView 的 SDK,其中包含您轻松播放视频所需的所有技巧:

Github link:: dailymotion-sdk-android/

自述文件提供了一个简单的集成示例

希望对您有所帮助