Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Keane81 opened this issue Dec 4, 2020 · 9 comments
Closed

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

Keane81 opened this issue Dec 4, 2020 · 9 comments

Comments

@Keane81
Copy link

Keane81 commented Dec 4, 2020

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?

@SoneeJohn
Copy link
Collaborator

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

@SoneeJohn
Copy link
Collaborator

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

@SoneeJohn
Copy link
Collaborator

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 added a commit that referenced this issue Dec 4, 2020
It seems that YouTube sometimes returns the mobile site in instead of the desktop one see #510
@Keane81
Copy link
Author

Keane81 commented Dec 4, 2020

@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.

@Keane81
Copy link
Author

Keane81 commented Dec 6, 2020

@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

@Keane81
Copy link
Author

Keane81 commented Dec 6, 2020

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.

@SoneeJohn
Copy link
Collaborator

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

That should fix your issue.

@Keane81
Copy link
Author

Keane81 commented Dec 6, 2020

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

SoneeJohn added a commit that referenced this issue Dec 7, 2020
YouTube seems to still want to serve up the mobile website randomly so this should help to prevent that. #510
@oTranAnhMinh
Copy link

Hello,

When will this issue be merged into master branch?

Thanks

SoneeJohn added a commit that referenced this issue Dec 8, 2020
* Adaptation to YouTube API change (#510)
dpwilhelmsen pushed a commit to dpwilhelmsen/XCDYouTubeKit that referenced this issue Jun 19, 2021
It seems that YouTube sometimes returns the mobile site in instead of the desktop one see 0xced#510
dpwilhelmsen pushed a commit to dpwilhelmsen/XCDYouTubeKit that referenced this issue Jun 19, 2021
dpwilhelmsen pushed a commit to dpwilhelmsen/XCDYouTubeKit that referenced this issue Jun 19, 2021
YouTube seems to still want to serve up the mobile website randomly so this should help to prevent that. 0xced#510
dpwilhelmsen pushed a commit to dpwilhelmsen/XCDYouTubeKit that referenced this issue Jun 19, 2021
YouTube appears to randomly redirect client to mobile site. This should fix the issue for now
Hesowcharov pushed a commit to Hesowcharov/XCDYouTubeKit that referenced this issue Sep 27, 2023
It seems that YouTube sometimes returns the mobile site in instead of the desktop one see 0xced#510
Hesowcharov pushed a commit to Hesowcharov/XCDYouTubeKit that referenced this issue Sep 27, 2023
Hesowcharov pushed a commit to Hesowcharov/XCDYouTubeKit that referenced this issue Sep 27, 2023
YouTube seems to still want to serve up the mobile website randomly so this should help to prevent that. 0xced#510
Hesowcharov pushed a commit to Hesowcharov/XCDYouTubeKit that referenced this issue Sep 27, 2023
YouTube appears to randomly redirect client to mobile site. This should fix the issue for now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants