0

I'm successfully playing a video retrieved from YouTube API in YTPlayerView This is the video: https://www.youtube.com/watch?v=sV1e-iSo5As Viewing directly in Chrome, I'm able to change player rate to various rates (0.25, 0.5 etc) However when I attempt one of these rates, during playback in my App using, say: setPlaybackRate(0.5), nothing changes (I've tried this both pre, and during playback)

Calling availablePlaybackRates() returns nil (I've tried this both pre, and during playback)

I have attempted this both on physical devices (iPhone ios10.3 + iPad ios10.3) as well as on various simulators. I have also tried with various other YouTube videos - same result.

Is it not possible to change playback rates in YTPlayerView, or is there some pre-setup required?

Relevant Code

func ytPlayerViewLoad(vid: String) {
    playerView.load(withVideoId: vid, playerVars: ["playsinline" : 1])
    playerView.webView.allowsInlineMediaPlayback = true
}
@IBAction func speedHalf(_ sender: Any) {
    if playerView.availablePlaybackRates() == nil {
        print("Do'h - no playback rates available")
    } else {
        print("Yay - playback rates available")
    }
    playerView.setPlaybackRate(0.5)
}

I'm starting to experiment with bypassing YTPlayerView and using UIWebView directly - passing in javascript to change player rate - but not getting far - but if anyone knows of an example of this that would be great! THanks

Jon Cook
  • 127
  • 1
  • 11
  • look in to this may be it help https://stackoverflow.com/questions/9606159/playback-speed-control-for-youtube-videos-html5 – Ravi Panchal Aug 22 '17 at 13:18
  • thanks - that led me to this IFrame Player example https://developers.google.com/youtube/youtube_player_demo which I successfully embedded into my app. However the speed change still doesn't work. My Googling around leads me to believe that this is just not possible on Apps for YouTube. Even YouTube's own app doesn't support it. That leads me to wonder how an App like SpeedTube is doing it. I suspect they must be using a URL converter - I'm not keen on this approach because of YouTube TOS - guess that's why they're on iOS store, not GooglePlay :> – Jon Cook Aug 22 '17 at 23:11
  • your welcome mate... :) – Ravi Panchal Aug 23 '17 at 11:41
  • I've also given the https://github.com/mojilala/YoutubeSourceParserKit a go. It does seem to work on the URL in their demo, but other URLs I tried failed. Posting the converted URLs into Chrome directly resulted in an Access Denied message, so I guess this has been cracked down on. I now feel totally stuck : – Jon Cook Aug 25 '17 at 05:11

0 Answers0