0xced / XCDYouTubeKit

YouTube video player for iOS, tvOS and macOS
MIT License
2.93k stars 626 forks source link

(iOS) XCDYouTubeVideoErrorDomain: -2 with empty User Info for upcoming live stream #541

Open Kiu212 opened 3 years ago

Kiu212 commented 3 years ago

Hello everyone, I used XCDYouTubeKit for my project and encounter a problem for upcoming live stream video in Youtube. XCDYouTubeKit used to return the remaining time before live stream. However, it is not working now.

Here is the result in Xcode. [XCDYouTubeKit] Video operation finished with error: The operation couldn’t be completed. (XCDYouTubeVideoErrorDomain error -2.) Domain: XCDYouTubeVideoErrorDomain Code: -2 User Info: { }

May I know there is anyone encounter the same problem? Is there any idea to fix this issue? Thanks.

Kiu212 commented 3 years ago

I followed 2 modifications from another closed issue to fix the live broadcast cannot be played problem. https://github.com/0xced/XCDYouTubeKit/issues/538

  1. XCDYouTubeVideoOperation.m self.eventLabels = [[NSMutableArray alloc] initWithArray:@[ @"embedded", @"detailpage" ]]; --->> [Edit] self.eventLabels =[[NSMutableArray alloc] init];
  2. XCDYouTubeVideo.m NSString httpLiveStream = info[@"hlsvp"] ?: XCDHTTPLiveStreamingStringWithString(playerResponse); --->> [Edit] NSString httpLiveStream = info[@"hlsvp"] ?: XCDHTTPLiveStreamingStringWithString(playerResponse); if(httpLiveStream.length == 0){ httpLiveStream = info[@"streamingData"][@"hlsManifestUrl"]; }

It seems like the first modification makes the user info become empty. After I use the old code in XCDYouTubeVideoOperation.m, it is working very well.

kosswong commented 3 years ago

The method you provided is worked, thank you bro