Android VideoView无法播放电影

时间:2016-07-07 07:52:11

标签: android video video-streaming android-videoview

我有以下视频:

ExifTool Version Number         : 9.46
File Name                       : capturedvideo.MOV
Directory                       : .
File Size                       : 549 kB
File Modification Date/Time     : 2016:07:07 10:41:51+03:00
File Access Date/Time           : 2016:07:07 10:41:55+03:00
File Inode Change Date/Time     : 2016:07:07 10:41:51+03:00
File Permissions                : rw-rw-r--
File Type                       : MOV
MIME Type                       : video/quicktime
Major Brand                     : Apple QuickTime (.MOV/QT)
Minor Version                   : 0.0.0
Compatible Brands               : qt
Movie Data Size                 : 556049
Movie Data Offset               : 36
Movie Header Version            : 0
Create Date                     : 2016:07:06 13:45:05
Modify Date                     : 2016:07:06 13:45:10
Time Scale                      : 600
Duration                        : 5.04 s
Preferred Rate                  : 1
Preferred Volume                : 100.00%
Preview Time                    : 0 s
Preview Duration                : 0 s
Poster Time                     : 0 s
Selection Time                  : 0 s
Selection Duration              : 0 s
Current Time                    : 0 s
Next Track ID                   : 3
Track Header Version            : 0
Track Create Date               : 2016:07:06 13:45:05
Track Modify Date               : 2016:07:06 13:45:10
Track ID                        : 1
Track Duration                  : 5.04 s
Track Layer                     : 0
Track Volume                    : 100.00%
Image Width                     : 480
Image Height                    : 360
Clean Aperture Dimensions       : 480x360
Production Aperture Dimensions  : 480x360
Encoded Pixels Dimensions       : 480x360
Graphics Mode                   : ditherCopy
Op Color                        : 32768 32768 32768
Compressor ID                   : avc1
Source Image Width              : 480
Source Image Height             : 360
X Resolution                    : 72
Y Resolution                    : 72
Compressor Name                 : H.264
Bit Depth                       : 24
Video Frame Rate                : 29.98
Matrix Structure                : 1 0 0 0 1 0 0 0 1
Media Header Version            : 0
Media Create Date               : 2016:07:06 13:45:05
Media Modify Date               : 2016:07:06 13:45:10
Media Time Scale                : 44100
Media Duration                  : 5.09 s
Media Language Code             : und
Balance                         : 0
Handler Class                   : Data Handler
Handler Vendor ID               : Apple
Handler Description             : Core Media Data Handler
Audio Format                    : mp4a
Audio Channels                  : 1
Audio Bits Per Sample           : 16
Audio Sample Rate               : 44100
Purchase File Format            : mp4a
Handler Type                    : Metadata Tags
Make                            : Apple
Software                        : 9.3.2
Model                           : iPhone 5c
Creation Date                   : 2016:07:06 16:45:05+03:00
Avg Bitrate                     : 883 kbps
Image Size                      : 480x360
Rotation                        : 90

它在iOS和浏览器中播放,压缩是H.264巫婆应该由Android支持(https://developer.android.com/guide/appendix/media-formats.html) 我尝试用

播放
final MediaController mediacontroller = new MediaController(getContext());
                mediacontroller.setAnchorView(mVideoView);
                mVideoView.setZOrderOnTop(true);
                mVideoView.setVideoURI(Uri.parse(videoURL));
                mVideoView.setMediaController(mediacontroller);
                mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
                    @Override
                    public void onPrepared(MediaPlayer mp) {
                        mVideoView.start();
                        mediacontroller.show(2000);
                    }
                });

使用此视频上方的代码:http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4播放正常。

修改 现在我用它作为解决方法来播放电影:

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(video.Url));
                intent.setDataAndType(Uri.parse(video.Url), "video/mp4");
                context.startActivity(intent);

0 个答案:

没有答案