Android VideoView 的奇怪行为 - “无法播放视频”

发布于 2024-12-10 16:10:08 字数 10024 浏览 3 评论 0原文

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

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

现在,当我在 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 输出,但没有看到任何错误/异常。

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; [email protected];
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) }

如果您发现任何描述得不好的地方,请在下面评论。

其他细节(摘自评论):

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

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.

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.

Now when i test this app in Samsung Fascinate 2.1 the video view shows the message "Can't Play Video" no matter i select existing video or take new one.

Remember the app is working fine with the above 2 devices.

In the ShowVideo activity i have button to upload the video, when i got the message "Can't Play Video" i been able to take video from the same path and upload it and can check that video at server side but video view didn't played that video.

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

.

My Questions Are :

1)When the message "Can't Play Video" occurs?
2)What are the Solution for that?
and 3) What could be possible mistakes in my application?

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; [email protected];
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):

  • They are merely of 1 minutes and the last one I tested and failed on Samsung that was of only 20 seconds. and sizes are mostly in MB not more than 20 MB right now.
  • The video is taken from the same device and immediately after taking that video I try to show in my activity same way other already stored video are also fine...actually after uploading that video I can see that video and can download also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(11

凉风有信 2024-12-17 16:10:08

1)当出现“无法播放视频”的信息时?

当 Android 无法播放媒体内容时,通常会发出此消息。发生这种情况的原因可能是

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

等等。

2)解决方案是什么?

除非您的应用程序中有自己的媒体框架,否则没有应用程序级别的解决方案

3) 我的应用程序中可能存在哪些错误?

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

”请注意,某些手机比其他手机具有更好的多媒体功能,因为 OEM 可以自行改进多媒体功能。因此,没有书面保证所有文件都可以在所有设备上播放,即使它符合 Android 提到的支持格式、编解码器。

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

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

  • Unsupported file format
  • Unsupported codecs
  • Erroneous content

to mention a few.

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) What could be possible mistakes in my application?

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"

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.

梦一生花开无言 2024-12-17 16:10:08

这都是关于格式问题,有些手机以 mp4 格式录制视频,有些以 3gp 格式录制视频,但几乎所有手机的默认媒体播放器都支持 3gp 格式。所以解决办法就是在玩的时候需要将其转换成3gp。这件事在 android 中很难处理,所以在服务器端你可以轻松地做到这一点,因此无论上传的视频格式是什么,你都可以以一种格式 .3gp 下载它,它会正常工作。

Its all about format problem, Some phone record the video in mp4 format and some in 3gp format, but in almost all phones the default mediaplayer support 3gp format. So the solution is you need to convert it into 3gp at the time of playing. This thing is difficult to handle in android, So at server end you can do it easily and hence whatever the format of the video is being uploaded you can download it in one format .3gp and it will work fine.

弥繁 2024-12-17 16:10:08

确保您的视频是 MP4 格式,但如果仍然无法播放或显示相同的错误,则问题不在于代码。故障在于视频分辨率。只需检查视频的高度和宽度并将其与视频视图组件相匹配。在线有很多免费的视频压缩器可用。因此,只需压缩您的视频并进行测试即可。

它会起作用的。
干杯!!!

Make sure that your video is in MP4 format , but if still does not play or shows same error then fault is not with the code. Fault is in the video resolution. just check height and width of you video and match it with you video view component. There are lot of free video compressors Online available. So just compress your video and test it.

It will work.
Cheers!!!

盗琴音 2024-12-17 16:10:08

当我尝试从手机本身播放视频时,我不断收到相同的“无法播放视频”消息。首先,我没有输入正确的文件路径,但还有另一个有趣的问题。

  1. 我已经从根目录输入了路径,例如/videoFileName.mp4,我应该在中间输入sdcard,例如/sdcard/videoFileName.mp4

  2. 当我通过 adb 运行我的应用程序时,我的 Sony Ercisson Xperia Arc 作为 USB 大容量设备存储进行连接,因此内部 SD 卡已卸载且无法找到文件。当我在 Samsung Galaxy S 上尝试相同的代码时,我发现了这一点,连接时表现不同。

I kept getting the same "Can't Play Video" message while trying to play video from the phone itself. First I didn't input good path to a file but there was anther interesting issue.

  1. I've type path from the root, example /videoFileName.mp4 and I should have type it with sdcard in between like /sdcard/videoFileName.mp4

  2. My Sony Ercisson Xperia Arc was connected as a usb mass device storage at the same time I was running my app through adb, so internal sd card was unmounted and file could not be found. I've discovered this when I tryed same code on Samsung Galaxy S which behaves differently when connected.

梓梦 2024-12-17 16:10:08

如果您的 mp4 文件具有 H.264 基线编码,但您仍然无法在 Android 设备中播放视频,那么服务器端的 .htAccess 文件可能存在问题。它可能正在压缩 .mp4 文件。很少有设备能够通过解压缩并流式传输视频来播放视频,但并非在所有设备情况下都如此。您需要更改服务器端的 .htAccess 文件。更改输出过滤器并包含文件格式 .mp4,以将其排除在流式传输时进行 zip 处理。

SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|swf|mp4)$ \ no-gzip dont-vary

If you have mp4 file having H.264 baseline encoding and still you are unable to play video in your android device then it might be problem in .htAccess file on server side. It might be zipping .mp4 file. few devices are able to play video by unzipping it and stream it but not in all device cases. You need to change .htAccess file on server side. Change in output filter and include file format .mp4 to exclude it from being zip at streaming time.

SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|swf|mp4)$ \ no-gzip dont-vary
最初的梦 2024-12-17 16:10:08

Google 最近在 Google IO 2014 之后开源了 Exoplayer
到目前为止,我使用它播放视频的体验很好。

https://github.com/google/ExoPlayer

  • 我可以从 Dropbox/AWS
  • 流式传输视频 从以下位置流式传输视频YouTube。

事情仍然取决于设备支持的编解码器

Google recently open-sourced Exoplayer after Google IO 2014.
My experience with video playing with it was good so far.

https://github.com/google/ExoPlayer

  • I could stream videos from Dropbox/AWS
  • Stream videos from youtube.

Things still depend upon codecs supported by the device.

拥醉 2024-12-17 16:10:08

我在使用 VideoView 时遇到了同样的问题,当我尝试检查有关视频的所有内容时,问题出在 AndroidManifest.xml 文件中,它与使用 外部存储 尝试一下可能会解决问题。

I had this same issue while using VideoView, while i tried to check all things regarding the video the issue was in the AndroidManifest.xml File, It was regarding the permission to use EXTERNAL STORAGE give it a shot it might solve the issue.

旧时浪漫 2024-12-17 16:10:08

我遇到了同样的问题,有效的方法是将互联网权限添加到清单文件中,因为我从 url 获取视频。

 <uses-permission android:name="android.permission.INTERNET"/>

这就是我填充视频列表视图的方式。

   //assign video
    mVideosListView = (ListView) findViewById(R.id.videoListView);

    //create videos
    Video riverVideo = new Video("https://s3.amazonaws.com/androidvideostutorial/862009639.mp4");
    Video carsVideo = new Video("https://s3.amazonaws.com/androidvideostutorial/862013714.mp4");
    Video townVideo = new Video("https://s3.amazonaws.com/androidvideostutorial/862014159.mp4");
    Video whiteCarVideo = new Video("https://s3.amazonaws.com/androidvideostutorial/862014159.mp4");
    Video parkVideo = new Video("https://s3.amazonaws.com/androidvideostutorial/862014834.mp4");
    Video busyCityVideo = new Video("https://s3.amazonaws.com/androidvideostutorial/862017385.mp4");

    mVideosList.add(riverVideo);
    mVideosList.add(carsVideo);
    mVideosList.add(townVideo);
    mVideosList.add(whiteCarVideo);
    mVideosList.add(parkVideo);
    mVideosList.add(busyCityVideo);

    /***populate video list to adapter**/
    mVideoAdapter = new VideoAdapter(this, mVideosList);
    mVideosListView.setAdapter(mVideoAdapter);

输入图片此处描述

I came across the same problem and what worked for is adding the Internet permission to the manifest file since I am getting video from url.

 <uses-permission android:name="android.permission.INTERNET"/>

This is how I am populating listview of videos.

   //assign video
    mVideosListView = (ListView) findViewById(R.id.videoListView);

    //create videos
    Video riverVideo = new Video("https://s3.amazonaws.com/androidvideostutorial/862009639.mp4");
    Video carsVideo = new Video("https://s3.amazonaws.com/androidvideostutorial/862013714.mp4");
    Video townVideo = new Video("https://s3.amazonaws.com/androidvideostutorial/862014159.mp4");
    Video whiteCarVideo = new Video("https://s3.amazonaws.com/androidvideostutorial/862014159.mp4");
    Video parkVideo = new Video("https://s3.amazonaws.com/androidvideostutorial/862014834.mp4");
    Video busyCityVideo = new Video("https://s3.amazonaws.com/androidvideostutorial/862017385.mp4");

    mVideosList.add(riverVideo);
    mVideosList.add(carsVideo);
    mVideosList.add(townVideo);
    mVideosList.add(whiteCarVideo);
    mVideosList.add(parkVideo);
    mVideosList.add(busyCityVideo);

    /***populate video list to adapter**/
    mVideoAdapter = new VideoAdapter(this, mVideosList);
    mVideosListView.setAdapter(mVideoAdapter);

enter image description here

微凉徒眸意 2024-12-17 16:10:08

我曾经遇到过同样的问题。就我而言,唯一的问题是 fie 格式。我刚刚将视频格式更改为 .mp4,它在我使用的所有设备和模拟器上都像魅力一样工作。
我的建议是先检查您的视频格式,然后尝试其他解决方案。

I faced the same issue once. In My case only issue was fie format. i Just changed the video format to .mp4 and it works like charm on all the devices and emulator i used.
my suggestion is to check your video format first and then try other solutions.

黎夕旧梦 2024-12-17 16:10:08

对我来说是视频使用的编解码器的问题。
我安装了 Any Video Converter 并使用 Google Android (x264) 的设置转换视频。
现在我可以在所有设备上玩。

For me was a problem with the codec used by video.
I installed the Any Video Converter and converted the video using the settings for Google Android (x264).
Now I can play on every device.

挽手叙旧 2024-12-17 16:10:08

我的问题是我将其保存为 .avi 格式而不是 .m4v 格式,并且它在我的三星上运行得非常顺利...感谢大家的帮助!

My problem was I had saved it in .avi format instead of .m4v format, and it worked liked a charm on my Samsung...thanks for everyone's help!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文