Note that there are some explanatory texts on larger screens.

plurals
  1. POplay youtube video in android
    text
    copied!<p>I am working on an android app and i want to play streaming video from youtube. I read posts like this: <a href="https://stackoverflow.com/questions/4654878/how-to-play-youtube-video-in-my-android-application">How to play YouTube video in my Android application?</a> I tried with that source:</p> <pre><code> startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("http://www.youtube.com/watch?v=tsDYIgX_gDs"))); </code></pre> <p>i got video in WebView, i can heard sound but no pictures..Also that is not what i want because i want video to start automatically when the activity start, without clicking Button play(because i want also to add some counters,timers.. for other treatments). Then, i tried whith MediaPlayer:</p> <pre><code> String FILE_PATH="http://www.youtube.com/watch?v=tsDYIgX_gDs"; MediaPlayer mp = new MediaPlayer(); mp.setDataSource(FILE_PATH); mp.prepare(); mp.start(); </code></pre> <p>Hopping here having a control on video start by <code>mp.start();</code> . But i have these errors:</p> <pre><code>05-20 15:36:36.279: ERROR/HTTPStream(33): recv failed, errno = 11 (Try again) 05-20 15:36:36.808: ERROR/HTTPDataSource(33): HTTP request failed w/ http status 303 05-20 15:36:36.808: ERROR/HTTPDataSource(33): retrying connection failed 05-20 15:36:41.834: ERROR/HTTPStream(33): recv failed, errno = 11 (Try again) 05-20 15:36:48.389: ERROR/HTTPStream(33): recv failed, errno = 11 (Try again) 05-20 15:36:54.913: ERROR/HTTPStream(33): recv failed, errno = 11 (Try again) 05-20 15:36:54.913: ERROR/HTTPStream(33): recv failed, errno = 9 (Bad file number) 05-20 15:36:54.918: ERROR/HTTPStream(33): recv failed, errno = 9 (Bad file number) 05-20 15:36:54.918: ERROR/HTTPStream(33): recv failed, errno = 9 (Bad file number) 05-20 15:36:54.918: ERROR/MediaPlayer(6392): error (1, -2147483648) 05-20 15:36:55.219: ERROR/MediaPlayer(6392): start called in state 0 05-20 15:36:55.219: ERROR/MediaPlayer(6392): error (-38, 0) 05-20 15:36:55.228: ERROR/MediaPlayer(6392): Error (-38,0) </code></pre> <p>Can someone help plz?</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