Forgive me if this is a newbie question, but ...
When playing a video, is it better to use VideoView / MediaPlayer or is it better to use aim.ACTION_VIEW and let the user select their media player?
The videos I need to play are very large mp4 files (20 mega - 50+ megabytes) that are not optimized for mobile devices. I'm having buffering issues when using VideoView / MediaPlayer. However, when I use aim.ACTION_VIEW, I can use something like RealPlayer, which handles buffering better (at least in my case). In addition, RealPlayer and other players I tried to deal with orientation changes without restarting the video, like VideoView / MediaPlayer. However, I do not know if this second approach is "acceptable" from the point of view of the user.
Here is the code for my VideoView / MediaPlayer approach:
XML:
<VideoView android:id="@+id/videoView"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
Java:
public class VideoViewActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
VideoView videoView = (VideoView) findViewById(R.id.videoView);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
Uri video = Uri.parse("http://www.my.big.video.com/video.mp4");
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.start();
}
And here is the code for my second approach:
Java:
public class VideoViewActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String videoUrl = "http://www.my.big.video.com/video.mp4";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(videoUrl));
startActivity(i);
}
Suggestions?
source
share