android - Playing YouTube Videos using mediaplayer of eclipse -


there many controls play youtube videos in eclipse webview, youtubeplayerview, videoview etc.

my doubt can play using media player? found that, url having extension .mp4 can play using media player. when tried youtube video url shows error start called in state 0 .

if(isytflag){ //if youtube url              mediaplayer.setdatasource(videourl);         }         else{ //local mp4              afd = this.getresources().openrawresourcefd(integer.parseint(videourl));             mediaplayer.setdatasource(afd.getfiledescriptor(), afd.getstartoffset(), afd.getdeclaredlength());         } 

please verify

have tried this?

btnplay.setonclicklistener(new onclicklistener() {public void onclick(view v) { startactivity(new intent(intent.action_view,uri.parse("https://www.youtube.com/watch?v=jhhn52khbkq"))); }}}); 

in solution can directly pass youtube video url intent want play media player.

for playing video try link playing(streaming) video mediaplayer

use videourl instead of 3gp video url.