Android VideoView 的奇怪行为——“无法播放视频" [英] Strange Behavior of Android VideoView - "Can't Play Video"

查看:63
本文介绍了Android VideoView 的奇怪行为——“无法播放视频"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,通过传递所选视频的文件路径,在不同 Activity 的 VideoView 中显示来自 sdcard 文件夹的视频或来自视频意图的新拍摄的视频.

In my application,showing video from sdcard folder or new taken video from Video intent in a VideoView in different Activity by passing file path of the video selected.

现在的问题是,我已经在我的 2 台设备 LG Optimus Black 和 LG Optimus Me 中测试了这个应用程序,它的工作原理就像魅力一样,没有问题,没有强制关闭.

Now the problem is, I have tested this app in my 2 devices LG Optimus Black and LG Optimus Me and it works like charm not problem no force close.

现在,当我在 Samsung Fascinate 2.1 中测试此应用程序时,无论我选择现有视频还是拍摄新视频,视频视图都会显示消息无法播放视频".

请记住,该应用可以在上述 2 台设备上正常运行.

在 ShowVideo 活动中,我有上传视频的按钮,当我收到消息无法播放视频"时,我能够从同一路径拍摄视频并上传,并且可以在服务器上检查该视频侧但视频视图没有播放该视频.

So, the Video Path of the SDCard is not the problem thats for sure.

also the Video are of .3gp or .mp4 format only so the format is also supported by android

.

我的问题是:

1)当出现无法播放视频"的消息时?2)什么是解决方案?和 3) 我的申请中可能存在哪些错误?

这是我收到该消息时的 logcat 输出,但没有看到任何错误/异常.

here is the logcat output while i got that message but don't see any error/exception in that.

I/ActivityManager( 2227): Starting activity: Intent { cmp=com.zoodigapp.zoodig/com.zoodigapp.media.ShowVideo (has extras) }
V/SettingsProvider( 2227): system <- value=1.0 name=font_scale
V/SettingsProvider( 2227): property: sys.settings_system_version=26
V/SettingsProvider( 2227): notifying: content://settings/system/font_scale
D/HardwareService( 2227): Brightness NATIVE setBacklightBrightness running. light: 2bightness ==> 30  mode:  1
D/NetworkLocationProvider( 2227): onDataConnectionStateChanged 6
D/MobileDataStateTracker( 2227): default Received state= CONNECTING, old= CONNECTING, reason= (unspecified), apnTypeList= *
D/AGPSManagerService( 2227): state: CONNECTING apnName: Verizon reason: null
D/dalvikvm( 3326): GC freed 2472 objects / 140504 bytes in 73ms
I/File    ( 3326): /sdcard/DCIM/Camera/video-2011-10-17-10-40-54.mp4
V/MediaStore( 3326): We probably run out of space, so create the thumbnail in memory.
I/MediaPlayerService( 2182): Use PV_PLAYER for url:/sdcard/DCIM/Camera/video-2011-10-17-10-40-54.mp4
E/MetadataDriver( 2182): MetadataDriver::setDataSource url file type is isAudiofile(0)
D/        ( 2182): SISO TEST registering PVMFRecognizerPluginFactory
D/        ( 2182): SISO TEST registering PVMFRecognizerPluginFactory success
E/MetadataDriver( 2182): isCommandSuccessful: Command id(0 and expected 0) and status (-17 and expected 1), data corruption (false) at state (4).
E/MetadataDriver( 2182): isCommandSuccessful: Command id(1 and expected 1) and status (-14 and expected 1), data corruption (false) at state (5).
E/MetadataDriver( 2182): captureFrame :  time = 0
E/MetadataDriver( 2182): captureFrame :  inputWidth = 0, inputHeight =0, bAspectratio=0, bResize=0
D/MediaUploader( 2492): UploadsQueue.getAllPending: elapsed msec=449
I/MediaUploader( 2492): UploadManager.uploadPendingItems: Found 1 items in queue.
I/Selected( 3326): =============Second
D/MediaUploader( 2492): isGphotosSynced: FALSE -- starting gphotos update refresh for -5709461173740324808
W/IInputConnectionWrapper( 3505): showStatusIcon on inactive InputConnection
I/copybit ( 2227): [createPP] fimc version : 50
I/MediaPlayerService( 2182): Use PV_PLAYER for url:/DCIM/Camera/video-2011-10-17-10-40-54.mp4
D/        ( 2182): SISO TEST registering PVMFRecognizerPluginFactory
D/        ( 2182): SISO TEST registering PVMFRecognizerPluginFactory success
D/        ( 2182): SISO TEST PVOMA1FFRecognizerFactory::CreateRecognizerPlugin()
D/        ( 2182): SISO TEST PVOMA1FFRecognizerFactory::CreateRecognizerPlugin() plugin found
D/        ( 2182): SISO TEST PVOMA1FFRecognizerFactory::DestroyRecognizerPlugin()
E/OsclDirectFileIO( 2182): [LargeFileSupport] OsclDirectFileIO::OpenFileOrSharedFd Error = -1
W/MediaPlayer( 3326): info/warning (1, 26)
E/PlayerDriver( 2182): Command PLAYER_SET_DATA_SOURCE completed with an error or info -4
E/MediaPlayer( 3326): SISO TEST MEDIA_ERROR
E/MediaPlayer( 3326): error (-4, -4)
W/PlayerDriver( 2182): PVMFInfoErrorHandlingComplete
V/MediaProvider( 2349): stopThumbWorkerSuspendTimer
V/MediaProvider( 2349): Resuming ThumbWorker
W/MediaProvider( 2349): Have message but no request?
I/System.out( 2647): interface name: null
I/MediaPlayer( 3326): Info (1,26)
E/MediaPlayer( 3326): Error (-4,-4)
D/VideoView( 3326): Error: -4,-4
D/MediaUploader( 2492): UploadManager.uploadPendingItems: Waiting for GPhotos sync
D/MediaUploader( 2492): UploadsQueue.getAllPending: elapsed msec=5
I/MediaUploader( 2492): UploadManager.uploadPendingItems: Found 1 items in queue.
I/POWER_OFF_TEST( 2227): mBatteryLevel = 38   mBatteryDecimalPoint = 1
D/MediaUploader( 2492): UploadsAsyncQueryHandler.notifiyDatabaseChangeListeners
D/MediaUploader( 2492): isGphotosSynced: FALSE -- update is in progress for -5709461173740324808
D/MediaUploader( 2492): UploadManager.uploadPendingItems: Waiting for GPhotos sync
D/MediaUploader( 2492): updateQueueState: RUNNING
I/GooglePlusOne( 2492): Starting new CAMERA_SYNC_CREATED request 1
I/ActivityManager( 2227): Displayed activity com.zoodigapp.zoodig/com.zoodigapp.media.ShowVideo: 1251 ms (total 1251 ms)
V/InputDevice( 2227): ID[0]=0 Dn (0=>1)
V/WindowManager( 2227): Dsptch >Window{47a67278 com.zoodigapp.zoodig/com.zoodigapp.media.ShowVideo paused=false}
D/dalvikvm( 2227): GC freed 4009 objects / 210024 bytes in 155ms
V/InputDevice( 2227): ID[0]=0 Up (1=>0)
V/WindowManager( 2227): Dsptch >Window{47a67278 com.zoodigapp.zoodig/com.zoodigapp.media.ShowVideo paused=false}
W/InputManagerService( 2227): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@47d89250
D/dalvikvm( 2492): GC freed 11952 objects / 682568 bytes in 171ms
D/dalvikvm( 2647): GC freed 7435 objects / 656456 bytes in 26ms
D/dalvikvm( 2647): GC freed 3079 objects / 498304 bytes in 60ms
I/System.out( 2647): interface name: null
I/GooglePlusOne( 2492): CAMERA_SYNC_CREATED request 1 completed with code=200
D/MediaUploader( 2492): onGphotosChange: sawError=false; errs=0; retry=Wed Dec 31 17:00:00 America/Boise 1969; expiry=Mon Oct 17 10:56:20 America/Boise 2011
D/MediaUploader( 2492): UploadsQueue.getAllPending: elapsed msec=17
I/MediaUploader( 2492): UploadManager.uploadPendingItems: Found 1 items in queue.
D/MediaUploader( 2492): isGphotosSynced: TRUE for -5709461173740324808
D/MediaUploader( 2492): existsInGphotos: false info=name=video-2011-10-17-10-40-54.mp4 fileUri=content://media/external/video/media/37 fileSize=2477915;
D/MediaUploader( 2492): UploadManager.uploadPendingItems: starting upload...
D/MediaUploader( 2492): UploadManager.upload: info=name=video-2011-10-17-10-40-54.mp4 fileUri=content://media/external/video/media/37 fileSize=2477915
I/NetworkStat( 2678): Network type: MOBILE
I/NetworkStat( 2678): -------- mobile data network is NOT available as of now
D/NotificationService( 2227): enqueueNotification :: notification.defaults = 0, Notification.DEFAULT_SOUND = 1, notification.sound = null
D/dalvikvm( 2492): GC freed 4032 objects / 238248 bytes in 49ms
I/dalvikvm-heap( 2492): Grow heap (frag case) to 6.708MB for 524304-byte allocation
D/dalvikvm( 2492): GC freed 291 objects / 13392 bytes in 58ms
D/MediaUploader( 2492): UploadsAsyncQueryHandler.notifiyDatabaseChangeListeners
D/MediaUploader( 2492): GlsAuthorizer.getAuthToken: authTokenType=lh2; account=dprichards@gmail.com;
D/MediaUploader( 2492): executeWithAuthRetry: starting httpClient.execute #1
D/dalvikvm( 2870): GC freed 555 objects / 24144 bytes in 269ms
I/System.out( 2492): interface name: null
V/InputDevice( 2227): ID[0]=0 Dn (0=>1)
V/WindowManager( 2227): Dsptch >Window{47cf6308 com.zoodigapp.zoodig/com.zoodigapp.media.ShowVideo paused=false}
V/InputDevice( 2227): ID[0]=0 Up (1=>0)
V/WindowManager( 2227): Dsptch >Window{47cf6308 com.zoodigapp.zoodig/com.zoodigapp.media.ShowVideo paused=false}
D/dalvikvm( 2647): GC freed 7301 objects / 659064 bytes in 78ms
I/System.out( 2647): interface name: null
I/System.out( 2647): interface name: null
I/System.out( 2647): interface name: null
D/dalvikvm( 2647): GC freed 2654 objects / 324016 bytes in 149ms
I/System.out( 2647): interface name: null
D/MediaUploader( 2492): getStatusCode: status=HTTP/1.1 200 OK
D/MediaUploader( 2492): getStatusCode: status=HTTP/1.1 200 OK
D/MediaUploader( 2492): UPLOAD_START: uploadUrl=https://picasaweb.google.com/data/upload/resumable/media/create-session/feed/api/user/default/albumid/camera-sync?xmlerrors=1&upload_id=AEnB2Uqe2bdvyx5p31Ta-sS4ytggj07_6-uiKG_hCOc6sT1u8eqhvr-8oZdUT1uPHxuAxXphUiJXyq-i_8YaJlT2YLholp__Sw
D/MediaUploader( 2492): UploadManager.onProgress
V/MediaUploader( 2492): UploadManager.progressUpdate: guid=1351689615505998240; bytes=0
D/dalvikvm( 2647): GC freed 920 objects / 202544 bytes in 53ms
D/dalvikvm( 2492): GC freed 7362 objects / 498448 bytes in 73ms
D/MediaUploader( 2492): UploadsAsyncQueryHandler.notifiyDatabaseChangeListeners
D/dalvikvm( 2492): GC freed 658 objects / 129232 bytes in 42ms
I/dalvikvm-heap( 2492): Grow heap (frag case) to 7.250MB for 262160-byte allocation
D/dalvikvm( 2492): GC freed 0 objects / 0 bytes in 41ms
D/dalvikvm( 2492): GC freed 92 objects / 135128 bytes in 30ms
I/dalvikvm-heap( 2492): Grow heap (frag case) to 7.621MB for 524304-byte allocation
D/dalvikvm( 2492): GC freed 0 objects / 0 bytes in 44ms
D/MediaUploader( 2492): executeWithAuthRetry: starting httpClient.execute #1
D/dalvikvm( 2647): GC freed 576 objects / 53240 bytes in 182ms
V/InputDevice( 2227): ID[0]=0 Dn (0=>1)
V/WindowManager( 2227): Dsptch >Window{47cf6308 com.zoodigapp.zoodig/com.zoodigapp.media.ShowVideo paused=false}
V/InputDevice( 2227): ID[0]=0 Up (1=>0)
V/WindowManager( 2227): Dsptch >Window{47cf6308 com.zoodigapp.zoodig/com.zoodigapp.media.ShowVideo paused=false}
I/ActivityManager( 2227): Starting activity: Intent { cmp=com.zoodigapp.zoodig/.WriteMessage (has extras) }

如果您发现任何未描述清楚的内容,请在下方评论.

If you find anything not described well please comment below.

其他细节(从评论中移出):

Additional details (moved from comments):

  • 它们只有 1 分钟,而我在三星上测试并失败的最后一个只有 20 秒.并且大小大多以 MB 为单位,目前不超过 20 MB.
  • 该视频是从同一设备拍摄的,在拍摄该视频后,我立即尝试以相同的方式在我的活动中显示其他已存储的视频也很好...实际上在上传该视频后我可以看到该视频并且也可以下载

推荐答案

1)出现无法播放视频"的时候?

1)When the message "Can't Play Video" occurs?

Android 在无法播放媒体内容时通常会发出此消息.发生这种情况的原因可能类似于

Android usually gives out this message, when it is not able to play the media content. The reasons for this to happen can be anything like

  • 不支持的文件格式
  • 不受支持的编解码器
  • 错误内容

举几个.

2) 对此有什么解决方案?

2)What are the Solution for that?

除非你的应用中有自己的媒体框架,否则应用层面没有解决方案

Unless you have your own Media Framework in your app, there is no solution from the application level

3) 我的申请中可能存在哪些错误?

3) What could be possible mistakes in my application?

错误极不可能出在您的应用程序中.如果您阅读日志,您会发现该错误似乎源自 opencore 的 DataSource(您运行的是哪个版本的 android?它仍在使用 Opencore 而不是 StageFright).它将它识别为一个大文件 (> 2GB) 并因此给出错误E/OsclDirectFileIO(2182): [LargeFileSupport] OsclDirectFileIO::OpenFileOrSharedFd Error = -1"

Very unlikely the mistake is in your application. If you read the logs, you will see that the error seems to originate from the DataSource of opencore (Which version of android are you running anyway? It is still using Opencore instead of StageFright). It is recognizing it as a large file (> 2GB) and hence giving out the error "E/OsclDirectFileIO( 2182): [LargeFileSupport] OsclDirectFileIO::OpenFileOrSharedFd Error = -1"

另一件需要注意的事情是某些手机比其他手机具有更好的多媒体功能,因为 OEM 本身可以提高多媒体功能.因此,无法书面保证所有文件都可以在所有设备上播放,即使它符合 Android 提到的受支持格式和编解码器.

The other thing to note is certain phones have better multimedia capability than the other phones, since OEM's can themselves improve the multimedia capability. So there is no written guarantee that all files can be played on all devices, even though it conforms to the supported formats, codecs mentioned by Android.

这篇关于Android VideoView 的奇怪行为——“无法播放视频"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆