android - Play private YouTube video using YoutubePlayerView from YoutubeAndroidPlayerAPI? -
i've started using youtube api android month ago. i'm trying make android application can play videos includes uploaded videos. public videos, works. private videos, youtubeplayerview shows: "please sign in".
i couldn't figure out how sign in , play these videos since youtubeandroidplayerapi seems not support authentication.
this i'm doing "jurb9k3_ws4" private video id.
@override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.playerview_demo); youtubeplayerview youtubeview = (youtubeplayerview) findviewbyid(r.id.youtube_view); youtubeview.initialize(developerkey.developer_key, new youtubeplayer.oninitializedlistener() { @override public void oninitializationsuccess(youtubeplayer.provider provider, youtubeplayer youtubeplayer, boolean b) { youtubeplayer.cuevideo("jurb9k3_ws4"); } @override public void oninitializationfailure(youtubeplayer.provider provider, youtubeinitializationresult youtubeinitializationresult) { } }); }
this not possible android player api. way play private videos on device implement webview in app, have user log youtube account, , play private video in that specific browser session only. youtube suggests marking videos unlisted rather private playback on mobile devices.
more info in this google groups post playing private videos using embedded player.
playing private video in embedded player work if have youtube login cookie in browser corresponds account permissioned watch video. otherwise, fail. authentication data api has nothing whether can play video in embedded player.
...
there's no programmatic way create login cookie. user has login youtube.com using same browser instance that's using embed, , can't scripted.
Comments
Post a Comment