Accessing YouTube Videos on tvOS

Hi all,

I’m considering porting one of my apps (currently in development on multiple platforms) to include the new Apple TV and tvOS - however one of the key elements to my app is the ability to search through and play streamed content from a specific YouTube channel that has a library of just over 300 videos.

Currently to get YouTube playback to work I’m using native.newWebView() with a minimal dynamically generated local HTML page.

Having looked through the tvOS guidelines it looks like native.newWebView() is currently supported (and it doesn’t look like it will be anytime soon), so my question is…

Is it possible to stream YouTube videos on an AppleTV app via Corona SDK, if so can someone point me in the right direction to get started?

TIA

Jon…

Currently there isn’t a way outside of a webView to stream YouTube videos. You probably could provide an index and use system.openURL() to load YouTube via URL Scheme, but that would be kinda clunky. Our team wants to improve the video playback across all platforms, but I don’t know if streaming YouTube is part of that or when we will get to it.

Rob

Hi Rob,

Thanks for letting me know - and as a side note - replying on a Sunday afternoon when the rest of the world is having a weekend, now that’s what I call customer service!

+1000 for the Corona team! :slight_smile:

I guess I could investigate native.newVideo() and see if I could arrange for the content to be hosted elsewhere, but that might get prohibitively expensive, but thanks for the heads up anyway.

Actually - what would be a (potentially) quick fix might be for the native.showWebPopup() function to actually point to a .TVML file instead of a .HTML file then this solution (http://stackoverflow.com/questions/32528624/how-to-play-youtube-content-on-tvos) might be an answer.

“native.newVideo() and see if I could arrange for the content to be hosted elsewhere”

Last time I check video streaming did not work on tvOS, either with an HLS stream or an MP4 file, unless that has changed recently :frowning:

We currently do not support video streaming for videos that are not a physical download. If it’s a URL that ends with .mp4 then native.newVideo() should be able to play it.

Streaming has two definitions:

  1. Start playing a video/audio track before it’s completely downloaded. This should work on all platforms. Though I’ve not tested trying to play a .mp4, the docs say native.newVideo() is supported.

  2. Play from a service that continuously steams data, for instance Spotify. This doesn’t work on any of our supported platforms.

The problem with YouTube is their videos are played through their player and are not things you download to play. Even if we did support real streaming, unless you can get the URL of the video and not the YouTube player, you’re not going to play it in a local player. You can grab the embed code and put it in a webView as you’re best bet for YouTube. I’ve not messed much with Vimeo but I suspect it’s a similar setup.

Rob

Currently there isn’t a way outside of a webView to stream YouTube videos. You probably could provide an index and use system.openURL() to load YouTube via URL Scheme, but that would be kinda clunky. Our team wants to improve the video playback across all platforms, but I don’t know if streaming YouTube is part of that or when we will get to it.

Rob

Hi Rob,

Thanks for letting me know - and as a side note - replying on a Sunday afternoon when the rest of the world is having a weekend, now that’s what I call customer service!

+1000 for the Corona team! :slight_smile:

I guess I could investigate native.newVideo() and see if I could arrange for the content to be hosted elsewhere, but that might get prohibitively expensive, but thanks for the heads up anyway.

Actually - what would be a (potentially) quick fix might be for the native.showWebPopup() function to actually point to a .TVML file instead of a .HTML file then this solution (http://stackoverflow.com/questions/32528624/how-to-play-youtube-content-on-tvos) might be an answer.

“native.newVideo() and see if I could arrange for the content to be hosted elsewhere”

Last time I check video streaming did not work on tvOS, either with an HLS stream or an MP4 file, unless that has changed recently :frowning:

We currently do not support video streaming for videos that are not a physical download. If it’s a URL that ends with .mp4 then native.newVideo() should be able to play it.

Streaming has two definitions:

  1. Start playing a video/audio track before it’s completely downloaded. This should work on all platforms. Though I’ve not tested trying to play a .mp4, the docs say native.newVideo() is supported.

  2. Play from a service that continuously steams data, for instance Spotify. This doesn’t work on any of our supported platforms.

The problem with YouTube is their videos are played through their player and are not things you download to play. Even if we did support real streaming, unless you can get the URL of the video and not the YouTube player, you’re not going to play it in a local player. You can grab the embed code and put it in a webView as you’re best bet for YouTube. I’ve not messed much with Vimeo but I suspect it’s a similar setup.

Rob