Android VideoView can't play movie
I have the following video:
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
It plays on iOS and in Browser, the compression is H.264 witch should be supported by Android(https://developer.android.com/guide/appendix/media-formats.html) I try to play it with
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);
}
});
with the code above this video: http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4 plays ok.
EDIT: For now I use this as workaround to play the movie:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(video.Url));
intent.setDataAndType(Uri.parse(video.Url), "video/mp4");
context.startActivity(intent);
链接地址: http://www.djcxy.com/p/84046.html
上一篇: jQuery检查平板电脑?