2012-12-19 73 views
2

可能重複.AVI視頻文件:
Android intent for playing video?安卓播放使用默認的播放器

如何使用默認播放器播放的AVI視頻文件。

Intent intent = new Intent(MediaStore.INTENT_ACTION_MUSIC_PLAYER); 
File file = new File(arrGetVideoList.get(position)); 
intent.setDataAndType(Uri.fromFile(file), " video/*"); 
startActivity(intent); 

arrGetVideoList是一個包含videofile路徑的arraylist。

任何人都可以幫助我。

+0

arrGetVideoList.get(position)return example?是字符串? –

+0

記住你的設備應該支持.avi文件擴展名的視頻。 –

回答

3

這對我有用。

Intent intent = new Intent(android.content.Intent.ACTION_VIEW); 
Uri data = Uri.parse(Environment.getExternalStorageDirectory() 
    .getPath() 
    + "/Test.avi"); 
intent.setDataAndType(data, "video/avi"); 
startActivity(intent); 
+0

工作正常。謝謝巴拉吉 – Maddy

1

使用Android上的默認播放器無法播放.avi文件。

你可以看看http://developer.android.com/guide/appendix/media-formats.html看支持在Android

如果你真的需要打其他格式不是由Android的supporteds什麼格式,你應該看一看FFmpeg的。

下面是Android上的約JavaCV/ffmpeg的一些有用的鏈接:

http://code.google.com/p/javacv/source/browse/src/main/java/com/googlecode/javacv/ http://stackoverflow.com/questions/13770376/playing-a-video-with-javacv-and-ffmpeg

希望我可以幫助:)

+0

感謝您的回覆讓我檢查 – Maddy

+0

如果有任何答案是有用的,請投票接受爲正確答案:) – Wamasa