如何在android videoView中播放Mov扩展ios视频

时间:2018-01-22 11:50:07

标签: android

我可以运行.mp4和.3gp视频但是当我从ios发送视频时我无法播放.Mov文件 那些视频无法在Android视频中播放

 void playFunction(){
         //this is play video function          
         String path = "";

                     VideoView mVideoView;
                     EditText mEditText;
                    mEditText = (EditText) findViewById(R.id.url);
                    mVideoView = (VideoView) findViewById(R.id.surface_view);
                    if (path == "") {
                        // Tell the user to provide a media file URL/path.
                        Toast.makeText(VideoViewDemo.this, "Please edit VideoViewDemo Activity, and set path" + " variable to your media file URL/path", Toast.LENGTH_LONG).show();
                        return;
                    } else {
                        /*
                         * Alternatively,for streaming media you can use
                         * mVideoView.setVideoURI(Uri.parse(URLstring));
                         */
                        mVideoView.setVideoPath(path);
                        mVideoView.setMediaController(new MediaController(this));
                        mVideoView.requestFocus();

                        mVideoView.setOnPreparedListener(new 
                    MediaPlayer.OnPreparedListener() {
                            @Override
                            public void onPrepared(MediaPlayer mediaPlayer) {

                                mediaPlayer.setPlaybackSpeed(1.0f);
                            }
                        });
                    }
        }

1 个答案:

答案 0 :(得分:2)

有媒体播放器" ExoPlayer"这是由谷歌开发并支持所有类型的视频和音频格式。这可能会根据您的要求支持.mov文件。您可以使用以下内容。

在应用级别build.gradle中进行编译

compile 'com.google.android.exoplayer:exoplayer:2.6.1'

您可以参考有关此lib的详细信息:https://github.com/google/ExoPlayer

希望这有帮助。