-->

How can I stream Youtube videos in my Roku Channel

2019-08-09 19:49发布

问题:

I am trying to create a Roku channel that could stream video content from a Youtube Channel.

I am aware of a Linux command-line program (youtube-dl) that can let me programmatically download videos that I can potentially reference via Youtube video ids obtained by the Youtube API results. My issue with youtube-dl is that I am not sure if using it in conjunction with the Youtube API is in compliance with YouTube's terms of service. (https://developers.google.com/youtube/terms). If the above can legally be done, then my problem is solved.

I am not aware of any other way that I can use the Youtube API to get raw mp4 files or any other supported format (in the Roku player) that I can easily stream in the Roku channel that I am building.

Also, Roku does not support either Flash or HTML5 so I cannot really embed a Youtube video URL like in a web page, but Youtube has their own Roku channel, so I am sure there is a way to do this (maybe not to available to developers).

I am also aware of an app called Plex that can let a user import Youtube videos into their Roku. (This requires the user to install a plugin into their browser) https://www.youtube.com/watch?v=k9OaezB3zas. (I am not sure if the content of the Youtube video is being copied by Plex or if they are streaming directly from Youtube).

The media types supported by Roku are:

Video — MKV (H.264), MP4 (H.264), MOV (H.264), WMV (VC-1, firmware 3.1 only) Music — AAC, MP3, WMA, FLAC (firmware 5.3 and later), WAV (firmware 5.3 and later) Photo — JPG, PNG, GIF (non-animated)

Thanks.

回答1:

Your assumptions are correct; downloading videos from YouTube and then re-streaming them yourself via a Roku channel would be against the YouTube ToS (and could possibly be a copyright violation as well, depending on the content, the content owner, your location, etc). There have been a number of Roku channels that have done just this and they've all been scuttled for violating the ToS.

And you are also correct that the YouTube API does not provide direct access to the mp4 files to allow you to broker a stream directly from a Roku client to the media asset (YouTube's Roku channel doesn't have that restriction, as the engineers don't go through the API given that, well, they are YouTube ...).

And since Roku doesn't support Flash or HTML5, there is no way to embed a YouTube video, either. Plex's YouTube channel does not download or import YouTube videos; rather, it creates metadata-based playlists and then just embeds the videos when needed (the plex media server supports HTML5-based video apps, including iframe embeds).

Though this isn't really a solution to your issue, hopefully the confirmation will at least get you thinking about new ways to go about creating your media apps. Some might see this as a strong argument against Roku and for more open (relatively speaking) platforms like the Chromecast ... basically, Roku requires you to use BrightScript to only stream media from your servers, while Chromecast lets you build any app with any open media APIs to stream or embed anything you could in the standard HTML5/JS/CSS app.