Closed hoangnam714 closed 4 months ago
Yes, you can use the VideoInfosWithDownloadFormatsResponse
to retrieve many different formats. Just be aware that some of them are video/audio only and you would need to merge two of them.
I do see fetchAllPossibleHostPlaylistsThrowing, but i tried using this func but after calling it it seems to be stuck here, nothing is returned, Can you help me see where I went wrong?
It seems like there was an error thrown during the process that is handled by Task
, probably because you didn't provide any cookies or that they aren't valid.
The method fetchAllPossibleHostPlaylistsThrowing
fetches all the playlists that the account of the provided cookies has and indicates whether the video is already in them or not. If you want to fetch the formats you should use is fetchStreamingInfosWithDownloadFormatsThrowing
, let me know if you have any other questions!
Can you give me a specific example, in my case, I have 1 video ID, I want to have urls for each video quality to use for each network condition
You should probably delete your comment as it contains an image with some cookies and I don't think it's safe to put them on the Internet available to everyone.
For archives here is the message:
Can you give me a specific example, in my case, I have 1 video ID, I want to have urls for each video quality to use for each network condition
The tests contain an example here. In it, two YTVideos are instantiated with the videoId as their only property, you can do as in the test or manually use the VideoInfosWithDownloadFormatsResponse
this way
let formatsResponse = try await VideoInfosWithDownloadFormatsResponse.sendThrowingRequest(
youtubeModel: youtubeModel,
data: [.query: videoId],
useCookies: true)
Yes, you can use the
VideoInfosWithDownloadFormatsResponse
to retrieve many different formats. Just be aware that some of them are video/audio only and you would need to merge two of them.
Sorry to bother you, but is there a faster way to merge video and audio into one url, similar to VideoInfosWithDownloadFormatsResponse.videoInfos.streamingURL, because I'm using AVplayer to play video, if I merge video and audio when play, I will have to fix a lot of things. I am very grateful for your help
Sorry to bother you, but is there a faster way to merge video and audio into one url, similar to VideoInfosWithDownloadFormatsResponse.videoInfos.streamingURL, because I'm using AVplayer to play video, if I merge video and audio when play, I will have to fix a lot of things. I am very grateful for your help
No problem! Unfortunately there's no (at least I've not found how) way to do that with the native AVPlayer "quickly". You can still create an AVMutableComposition
but that will download the two medias entirely before showing them in the player or you can use the streamingURL from the VideoInfosResponse
that is an HLS stream that AVPlayer knows how to fetch it cleverly (different qualities depending on the network conditions).
Is it possible for you to support retrieving videos in many different qualities?