alexeichhorn / YouTubeKit

YouTube video and audio extractor for iOS, watchOS, visionOS, tvOS and macOS
MIT License
207 stars 46 forks source link

Unable to stream video, audio working ok. #12

Open bobbysoftware opened 1 year ago

bobbysoftware commented 1 year ago

Hi, I'm unable to stream video, the audio is working fine. I've listed the errors below. [Extraction] applying descrambler [Extraction] finding initial function name [Extraction] Failed to decode object from given start point: The data couldn’t be read because it isn’t in the correct format. pattern (ytplayer.config\s=\s) failed: The operation couldn’t be completed. (YouTubeKit.YouTubeKitError error 1.) signature found, skip decipher

Screenshot 2023-07-20 at 12 09 21 PM

The code fails on line 67 and the error is being thrown on line 69. I'm using the 0.1.8 release. The audio plays but no video. I'm using SwiftUI Xcode 14.3.1, iOS 16.5.1 (c). Mac Mini M1.

Any help would be appreciated. Thanks.

alexeichhorn commented 1 year ago

Can you give me 1-2 example youtube videos where you experience this behavior?

bobbysoftware commented 1 year ago

Hi Alex,

Thanks for replying. These are shorts where no video plays, audio works. Id: SGM2epABErg, Ed8QtV8aP84. This video doesn't play at all. Id: e-B9nwgxSOA.

let video = YouTube(videoID: "Ed8QtV8aP84") let stream = try await video.streams .filter { $0.isProgressive && $0.subtype == "mp4" } .highestResolutionStream() let streamURL = stream?.url let playerItem = AVPlayerItem(url: streamURL!) player = AVPlayer(playerItem: playerItem)

Best, Bobby

On Jul 23, 2023, at 2:48 PM, Alexander Eichhorn @.***> wrote:

Can you give me 1-2 example youtube videos where you experience this behavior?

— Reply to this email directly, view it on GitHub https://github.com/alexeichhorn/YouTubeKit/issues/12#issuecomment-1646967485, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANINV7RGZ3ESXPY2E2ISNTXRWLZPANCNFSM6AAAAAA2R3235U. You are receiving this because you authored the thread.

alexeichhorn commented 1 year ago

Both of the videos work for me. I just copied both stream urls to Safari and it played flawlessly. Which country are you trying it from? Can be a factor sometimes

bobbysoftware commented 1 year ago

United States, California.

On Jul 25, 2023, at 2:47 PM, Alexander Eichhorn @.***> wrote:

Both of the videos work for me. I just copied both stream urls to Safari and it played flawlessly. Which country are you trying it from? Can be a factor sometimes

— Reply to this email directly, view it on GitHub https://github.com/alexeichhorn/YouTubeKit/issues/12#issuecomment-1650606063, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANINV3B2BROTSDDLQYCASLXSA5HZANCNFSM6AAAAAA2R3235U. You are receiving this because you authored the thread.

bobbysoftware commented 1 year ago

The URL I get for videoID: "Ed8QtV8aP84" works in Safari, but in the player audio only. This URL I get for videoID: "SGM2epABErg" doesn't work in Safari, but in the player audio only.

https://rr1---sn-o097znzr.googlevideo.com/videoplayback?expire=1690344013&ei=7UXAZImMDJCPkATK5qaQBQ&ip=108.204.121.222&id=o-ACrL5LPzavrOM7qQ2tYUm2tsIRmXsez6itpg9DADM5NG&itag=22&source=youtube&requiressl=yes&mh=KU&mm=31%2C29&mn=sn-o097znzr%2Csn-n4v7snll&ms=au%2Crdu&mv=m&mvi=1&pl=21&ctier=SH&initcwndbps=1188750&spc=Ul2SqwDxMtmWb8QFnqbGCI7GWlL74u7TNYMWBFpruQ&vprv=1&svpuc=1&mime=video%2Fmp4&cnr=14&ratebypass=yes&dur=44.837&lmt=1663199724702797&mt=1690322002&fvip=5&fexp=24007246%2C24363392&c=ANDROID&txp=6318224&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cctier%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Ccnr%2Cratebypass%2Cdur%2Clmt&sig=AOq0QJ8wRAIgGGq1_zG4l9Byv4wRQgvfMSyLTURCrG0P_VxUQtoBP70CIAHwXXNdwx4AN17_QGAW8Sjb6ojSipFHOaSDJUs1dpDD&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRAIgLeWmF5dVpUkS3yp7KuPsefbh3D7ArniuqPj4vmHxMngCICB0e7g9tPjh-y2_qsnPBW4r338DU2D42yziD8yO1wF2

bobbysoftware commented 1 year ago

Hey Eric, I think the error was mine. Looks like you can't stream YouTube URL's in AVPlayer. Thanks for your time, Bobby

JaydeepVirani303 commented 1 year ago

Hello @bobbysoftware @\ Hope you are doing well. i faced the same issue, can you help me to fix this issue? thanks in advanced.

hoangnam714 commented 6 months ago

Same issue, my case is worse than not having access to video

image