0xced / XCDYouTubeKit

YouTube video player for iOS, tvOS and macOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Video is not working on Wi-Fi but works on cellular network.

Keane81 opened this issue · comments

I am using XCDYouTubeKit 2.15.1, it is possible to reproduce on both device and simulator.
I am trying to load video with id: "kAsoZc7MFCg", set lowQualityMode to false (the same if I set it to true). Library returns success result every time, but if I am in wi-fi network, it successfully loads only 8 from 10 times (2 times it is just spinner on player screen), but 10 from 10 if I am using cellular network. Not sure if it is strongly related to the library but would be glad to get any help here.

My observations:
in success case video object contains 20+ streamURLs objects, in failure case only 2 objects.
in success case link to the js player is https://www.youtube.com/s/player/408be03a/player_ias.vflset/en_US/base.js but in failure: https://www.youtube.com/s/player/408be03a/player-plasma-ias-phone-en_US.vflset/base.js

I've attached two log files for success and failure cases.
working_request_cellular.txt
not_working_request_wifi.txt

Thanks in advance. May be you have a suggestion what's wrong here?

Thanks! for the report are you using the cookies feature?

I noticed in the non working request there is a response from the mobile site of YouTube.

Can you download this branch here: https://codeload.github.com/0xced/XCDYouTubeKit/zip/logs and use the macOS demo and send me the request files that appear in documents?

@SoneeJohn thanks for reply
no, I don't use cookies feature, just simple call like

XCDYouTubeClient.default().getVideoWithIdentifier("kAsoZc7MFCg") { (video, error) in
  //...
}

I will try recommended branch some later and let you know.

@SoneeJohn I've tried suggested branch 4 times and results are:
1 - No stream URLs are reachable.
2 - No stream URLs are reachable.
3 - Success and play.
4 - No stream URLs are reachable.

See logs in the attach.
Keane81-logs.zip

About redirecting to mobile site. I've implemented NSURLSessionTaskDelegate and set it for session in XCDYouTubeVideoOperation class. And I see that URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:
is called and redirection to https://m.youtube.com is happened for some reasons, don't know why.

@Keane81 Thanks for investigating :-) Can you try the develop branch here: https://codeload.github.com/0xced/XCDYouTubeKit/zip/develop

That should fix your issue.

@SoneeJohn thanks a lot, it works now. I've checked both Wi-Fi and Cellular about 50 times and all is good.

Hello,

When will this issue be merged into master branch?

Thanks