Can't play video (iOS17.1.1)
sycode opened this issue · 13 comments
Hello.
An issue occurred where the video URL could not be obtained on iOS17.1.1.
https://www.youtube.com/watch?v=XzOvgu3GPwY
let stream = try await YouTube(videoID: "XzOvgu3GPwY").streams
.filter { $0.isProgressive && $0.subtype == "mp4" && $0.includesVideoTrack }
.highestResolutionStream()
=> return nil
I edited the code as below, but only the video plays, the audio does not work.
let stream = try await YouTube(videoID: "XzOvgu3GPwY").streams
.filter { $0.subtype == "mp4" }
.highestResolutionStream()
Could you tell me if there is a way to improve it?
Hello @sycode,
Could you please try this:
try await YouTube(videoID: videoId).streams
.filter { $0.subtype == "mp4" && $0.includesVideoTrack }
.highestAudioBitrateStream()
Thanks,
thank you for your reply.
I tried it and the video played but there was no audio.
Next, I tried changing it as below, but this time the audio played, but there was no video.
try await self.streams
.filter { $0.subtype == "mp4" && $0.includesAudioTrack }
.highestAudioBitrateStream()?
Have YouTube specifications changed?
When I tried playing it with iOS AVPlayer, the audio length was twice the normal length and the operation became strange.
It may be a Core Audio bug in iOS17.1.1.
It's really weird because I've tried using your ID and the bunch of code I provided, and I can hear the audio, I'm also using AVPlayer
. Is your repository public?
Hi @waliid, I also experienced Same issue.
let stream = try await YouTube(videoID: "Z9iqGBYRktk").streams
.filter { $0.isProgressive && $0.subtype == "mp4" && $0.includesVideoTrack }
.highestResolutionStream()
return nil
let stream = try await YouTube(videoID: "Z9iqGBYRktk").streams
.filter { $0.subtype == "mp4" }
.highestResolutionStream()
Only video in that case.
I'm using online player(https://onelineplayer.com/) to play the stream after getting the streamUrl for testing purpose.
Hello @AdnanAliShabir
The code you provided is not exactly the same as the one I provided. Could you please try using this code.
Thanks
try await self.streams
.filter { $0.subtype == "mp4" && $0.includesAudioTrack }
.highestAudioBitrateStream()?
Only Audio no Video.
Thanks
It works if change the
class InnerTube
init(client: ClientType = .ios, useOAuth: Bool = false, allowCache: Bool = true)
with
init(client: ClientType = .web, useOAuth: Bool = false, allowCache: Bool = true)
Hello @waliid @AdnanAliShabir @sycode
Is there any latest solution? I have also encountered situations where there is only audio or only video,
thank you very much.
Hey, I've recently made numerous changes to the entire process. Could you please retry your code with the latest commit in the main branch? I would appreciate some feedback before releasing a new version.
I am very happy to try it. If there are any new questions, I will ask again. Thank you for your guidance.
I'm glad that the new update has solved my problem. Thank you for your update, and we look forward to the launch of the remote server feature.
@alexeichhorn
When I updated to the latest commit, the video was successfully played with audio!
thank you very much!
@sycode
Sounds good.