I'm trying to play video's on Android, by launching an intent. The code I'm using is:
tostart = new Intent(Intent.ACTION_VIEW); tostart.setDataAndType(Uri.parse(movieurl), "video/*"); startActivity(tostart);
This works on most phones, but not on the HTC Hero. It seems to load a bit different video player. This does play the first video thrown at it. However, every video after that it doesn't respond. (it keeps in some loop).
If I add an explicit
(before the startactivity) it does work on the HTC Hero. However, since this is a HTC specific call, I can't run this code on other phones (such as the G1). On the G1, this works:
tostart.setClassName("com.android.camera","com.android.camera.MovieView"); //g1 version
But this intent is missing from the hero. Does anybody know a list of intents/classnames that should be supported by all Android devices? Or a specific one to launch a video? Thanks!
Use setDataAndType on the Intent
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(newVideoPath)); intent.setDataAndType(Uri.parse(newVideoPath), "video/mp4"); startActivity(intent);
Use "video/mp4" as MIME or use "video/*" if you don't know the type.