title: Android Streaming Video using MediaPlayer
body: <p>I'm back with another problem!</p>
  
  <p>I'm trying to create an app that would list a selected Livestreams, from Own3d.TV, Justin.Tv etc...</p>
  
  <p>If my research isn't totally failed, I can use the MediaPlayer object to Stream video, the only question is how do I use it?</p>
  
  <p>So far my code looks like this, but it's giving me an Exception when trying to prepare the MediaPlayer.</p>
  
  <pre><code>public class Media extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      SurfaceView sw = new SurfaceView(this);
      SurfaceHolder sh = sw.getHolder();
  
      setContentView(sw);
  
      Uri ur = Uri.parse("http://www.twitch.tv/widgets/live_embed_player.swf?channel=hashe");
  
      MediaPlayer mp = new MediaPlayer();
  
      mp.setDisplay(sh);
  
      try {
          mp.setDataSource("http://www.twitch.tv/widgets/live_embed_player.swf?channel=hashe");
          mp.prepare();
      } catch (IllegalStateException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  
      mp.start();
      //mp.setDisplay(sw);
  
  
  
  }
  }
  </code></pre>
  
  <p>Is it even possible to Stream the video from these sites using the MediaPlayer?</p>
  
  <p>If not, how shoud I approach this problem? </p>
  
  <p>Thanks!</p>