Video link of unlisted youtube video

2019-06-10 19:34发布

问题:

I am developing an android application that streams and shows a couple of videos. Instead of storing videos on my server, I thought uploading them to youtube as unlisted, and getting them from youtube is a great idea. After getting the video, I want to show them in default android video player, not in youtube app or web view.

I don't have any problem when I put videos in my server (for example www.mysite.com/video.mp4), but is there any way to get the url of a youtube video?

回答1:

You can upload the videos using the YouTube Data API v3:

https://developers.google.com/youtube/v3/docs/videos/insert

And setting the status.privacyStatus as unlisted

Then you can use the YouTube Android Player API to include the Video Player on your own Android App

https://developers.google.com/youtube/android/player/

To play a video, you only need the video ID, not the full url..

eg:

player.loadVideo("wKJ9KzGQq0w");