0

我正在制作一个应用程序,它需要显示我从服务器下载的一些视频。然而,一些视频只是在 Gingerbread 上出现错误,而在 Jelly Bean 上运行良好。

File f = new File(file);
// Tried to set source with the absolute path (file)
mPlayer.setDataSource(ParcelFileDescriptor.open(f, ParcelFileDescriptor.MODE_READ_ONLY).getFileDescriptor());
// holder is the surfaceholder for the SurfaceView
mPlayer.setDisplay(holder);
mPlayer.prepare();

我已经在老三星、模拟器和老索尼爱立信上测试了视频。有些手机可以播放其他手机不能播放的视频。

我收到了 Quicktime 格式 (.mov) 的视频并使用了

ffmpeg -i file.mov -vcodec copy -acodec copy file.mp4

在所有视频上获取 android 应该理解的 MPEG-4。这就是为什么有些视频有效而另一些视频无效的原因。

视频下载到

context.getExternalFilesDir(null).getAbsolutePath() + "/path/to/videos/";

我检查了 sha1sum 以验证下载是否正常。

我得到的错误各不相同。

我在模拟器上收到 MediaPlayer 错误 (1, -2147483648),在三星设备上收到 MediaPlayer 错误 (1, -15)。

那么如何让视频播放?

4

0 回答 0