简体   繁体   English

Android MediaPlayer在某些设备上显示黑屏

[英]Android MediaPlayer displays black screen in some devices

I have an application that plays a video from the sdcard with MediaPlayer. 我有一个使用MediaPlayer从sdcard播放视频的应用程序。 I have used Android Developers example ( http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/media/MediaPlayerDemo_Video.html ), and it works great in some devices: HTC Desire (Android 2.2), HTC Legend (Android 2.2). 我已经使用了Android开发人员示例( http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/media/MediaPlayerDemo_Video.html ),它在某些设备上非常有效:HTC Desire (Android 2.2),HTC Legend(Android 2.2)。

However, I have tried it in a Samsung Galaxy 5 (Android 2.1) and it doesn't display the video, just a black screen. 但是,我已经在三星Galaxy 5(Android 2.1)中进行了尝试,它不显示视频,而只是显示黑屏。 No errors in LogCat. LogCat中没有错误。

Any ideas about why does this happen? 关于为什么会发生任何想法?

Thanks in advanced, 提前致谢,

Marta 玛尔塔

Have you developed the app with focus on 2.2? 您是否开发了针对2.2的应用程序? Probably there were some changes from 2.1 in this part. 这部分可能与2.1有所不同。 You could check the older API demos (they are all in your sdk fodler) and look for changes from rev. 您可以查看较早的API演示(它们都在sdk fodler中),并从rev寻找更改。 7 to 8. 7至8

However I prefer to use the VideoView http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/media/VideoViewDemo.html 但是我更喜欢使用VideoView http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/media/VideoViewDemo.html

Worked allot better on everything I made yet. 在我所做的一切上都做得更好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM