Note that there are some explanatory texts on larger screens.

plurals
  1. POVideo - Use VideoView/MediaPlayer, or intent.action_view and user's choice?
    text
    copied!<p>Forgive me if this is a newbie question, but...</p> <p>When playing video, is it better to use VideoView/MediaPlayer, or is it better to use intent.ACTION_VIEW and let the user select his/her media player?</p> <p>The videos that I need to play are very large mp4 files (20 meg - 50+ meg) which are not optimized for mobile. I have buffering issues when using VideoView/MediaPlayer. However, when I use intent.ACTION_VIEW, I can use something like RealPlayer, which does a better job of buffering (at least in my case). Plus, RealPlayer and the other players I've tried handle orientation changes without restarting the video like VideoView/MediaPlayer do. However, I don't know if this second approach is "acceptable" from a user-experience perspective.</p> <p>Here's the code for my VideoView/MediaPlayer approach:</p> <p>XML:</p> <pre><code>&lt;VideoView android:id="@+id/videoView" android:layout_width="fill_parent" android:layout_height="fill_parent" /&gt; </code></pre> <p>Java:</p> <pre><code>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(); } </code></pre> <p>And here's the code for my second approach:</p> <p>Java:</p> <pre><code>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); } </code></pre> <p>Suggestions?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload