kaltura / playkit-ios

PlayKit: Kaltura Player SDK for iOS
https://developer.kaltura.com/player/ios
GNU Affero General Public License v3.0
86 stars 37 forks source link

AirPlay not working for downloaded videos #454

Open olliestringfield-accedo opened 2 years ago

olliestringfield-accedo commented 2 years ago

We are unable to AirPlay downloaded videos with the Kaltura iOS frameworks. The HLS(.m3u8) video files are downloaded using the DownloadToGo framework and are played using the PlayKit framework.

Steps to reproduce:

  1. Download HLS video file from remote
  2. AirPlay video to an external device (i.e. Macbook Pro)
  3. Play video.

We are using the following framework versions managed by cocoapods in our project: PlayKit: 3.25.0 PlayKit Providers: 1.10.0 PlayKitKava: 1.6.0 DownloadToGo: 3.15.0 KalturaClient: 14.1.0

Note: If the content is not downloaded and is being streamed then AirPlay works correctly

Prerequisites
Expected behavior

Video is played on the target AirPlay device

Actual behavior

Video cannot be played on the target AirPlay device

Console output
2022-02-21 10:04:34.722355+1300 Releases[2690:521657] Sentry - Debug:: Add breadcrumb: <SentryBreadcrumb: 0x2872c87c0>
2022-02-21 10:04:34.730 [Debug] [AVPlayerEngine.swift:294] play() > Play player
2022-02-21 10:04:34.731 [Debug] [AVPlayerEngine+Observation.swift:224] handleRate() > player rate was changed, now: 1.0
2022-02-21 10:04:34.751 [Debug] [KavaPlugin+AnalyticsPluginProtocol.swift:145] handlePlay() > play event
2022-02-21 10:04:34.817 [Debug] [KavaPlugin+AnalyticsPluginProtocol.swift:162] handlePlaying() > playing event
2022-02-21 10:04:34.818 [Debug] [KavaPlugin.swift:283] sendAnalyticsEvent(event:) > Action: resume
2022-02-21 10:04:34.818 [Debug] [KavaPlugin.swift:353] sendAnalyticsEvent(event:) > Sending Kava Event, resume (4): ["service": "analytics", "clientVer": "playkit/ios-3.25.0", "actualBitrate": "1922.881", "action": "trackEvent", "applicationVer": "505", "eventIndex": "9", "bufferTimeSum": "0.0", "referrer": "app://com.example.app1", "sessionId": "2A8071D2-8A1B-4493-8CFC-6996FF8ABF1C:0EBD01FF-D6C1-4CBA-ACC5-3DCF18B64AA8", "sessionStartTime": "1645391060.891", "eventType": "4", "bufferTime": "0.0", "deliveryType": "hls", "entryId": "1_q3eq1mi7", "position": "1.122", "playbackType": "vod", "application": "com.example.app1", "partnerId": "2066791"]
2022-02-21 10:04:34.823463+1300 Releases[2690:523443] 8.9.1 - [Firebase/Performance][I-PRF300005] URL length exceeds limits, truncating recorded URL - https://analytics.kaltura.com/api_v3/index.php.
2022-02-21 10:04:35.218882+1300 Releases[2690:524505] [tcp] tcp_input [C54.1.1.1:3] flags=[R] seq=1765588340, ack=0, win=0 state=LAST_ACK rcv_nxt=1765588340, snd_una=1153075
2022-02-21 10:04:35.221383+1300 Releases[2690:524505] [tcp] tcp_input [C54.1.1.1:3] flags=[R] seq=1765588340, ack=0, win=0 state=CLOSED rcv_nxt=1765588340, snd_una=1153075
2022-02-21 10:04:35.378564+1300 Releases[2690:521657] Sentry - Debug:: Add breadcrumb: <SentryBreadcrumb: 0x2872ade80>
2022-02-21 10:04:35.420567+1300 Releases[2690:521657] Sentry - Debug:: Add breadcrumb: <SentryBreadcrumb: 0x2872ad9c0>
2022-02-21 10:04:35.426470+1300 Releases[2690:521657] Sentry - Debug:: Add breadcrumb: <SentryBreadcrumb: 0x2872ca640>
2022-02-21 10:04:35.768 [Debug] [KavaPlugin.swift:326] sendAnalyticsEvent(event:) > Response:
Status Code: 0
Error: 
Data: {
    time = "1645391075.631";
    viewEventsEnabled = 1;
}
2022-02-21 10:04:35.776308+1300 Releases[2690:524505] 8.9.1 - [Firebase/Performance][I-PRF100009] Logging network request trace - https://analytics.kaltura.com/api_v3/index.php, Response code: 200, 947.5600ms
2022-02-21 10:04:35.778184+1300 Releases[2690:524505] 8.9.1 - [Firebase/Installations][I-FIS002000] -[FIRInstallationsIDController createGetInstallationItemPromise], appName: __FIRAPP_DEFAULT
2022-02-21 10:04:35.778425+1300 Releases[2690:524505] 8.9.1 - [Firebase/Installations][I-FIS002001] -[FIRInstallationsIDController installationWithValidAuthTokenForcingRefresh:0], appName: __FIRAPP_DEFAULT
2022-02-21 10:04:37.005884+1300 Releases[2690:524518] [MediaRemote] No local output device available: (
    "<MRAVConcreteOutputDevice:0x116e5d930 (local) \"Speaker\" uid=\"Speaker\" group_id=\"E667F8BA-E5FD-4194-BA70-B0088606ABA4\" bluetooth_id=(null) type=BuiltIn subtype=Speaker enc-prog-dl-assets fetch-sender-media-data opt-audio-ui>",
    "<MRAVConcreteOutputDevice:0x116e5deb0  \"Ollie\U2019s MacBook Pro\" uid=\"ACE59E4D-A413-4399-BD46-699C7D06A8AC\" group_id=\"6D0EE75F-696A-43DA-B744-C0BA0F0EF18B\" bluetooth_id=(null) type=AirPlay subtype=Mac airplay2 airplay-receiving fetch-sender-media-data opt-audio-ui MacBookPro16,1>"
)
2022-02-21 10:04:37.009 [Debug] [AVPlayerEngine+Observation.swift:224] handleRate() > player rate was changed, now: 0.0
2022-02-21 10:04:37.015 [Debug] [AVPlayerEngine+Observation.swift:365] handleDurationChanged() > Duration in seconds: 3568.32
2022-02-21 10:04:43.823 [Debug] [KavaPlugin.swift:283] sendAnalyticsEvent(event:) > Action: view
2022-02-21 10:04:43.824 [Debug] [KavaPlugin.swift:353] sendAnalyticsEvent(event:) > Sending Kava Event, view (99): ["sessionStartTime": "1645391060.891", "averageBitrate": "1922.881", "deliveryType": "hls", "entryId": "1_q3eq1mi7", "service": "analytics", "eventType": "99", "application": "com.example.app1", "playbackType": "vod", "bufferTime": "0.0", "playTimeSum": "10.0", "eventIndex": "10", "captionsLanguage": "none", "partnerId": "2066791", "referrer": "app://com.example.app1", "bufferTimeSum": "0.0", "action": "trackEvent", "sessionId": "2A8071D2-8A1B-4493-8CFC-6996FF8ABF1C:0EBD01FF-D6C1-4CBA-ACC5-3DCF18B64AA8", "position": "3.252", "audioLanguage": "en", "clientVer": "playkit/ios-3.25.0", "applicationVer": "505", "actualBitrate": "1922.881"]
2022-02-21 10:04:43.828533+1300 Releases[2690:523443] 8.9.1 - [Firebase/Performance][I-PRF300005] URL length exceeds limits, truncating recorded URL - https://analytics.kaltura.com/api_v3/index.php.
2022-02-21 10:04:44.062 [Debug] [KavaPlugin.swift:326] sendAnalyticsEvent(event:) > Response:
Status Code: 0
Error: 
Data: {
    time = "1645391083.925";
    viewEventsEnabled = 1;
}
2022-02-21 10:04:44.066275+1300 Releases[2690:524518] 8.9.1 - [Firebase/Performance][I-PRF100009] Logging network request trace - https://analytics.kaltura.com/api_v3/index.php, Response code: 200, 232.3020ms
2022-02-21 10:04:44.074071+1300 Releases[2690:524518] 8.9.1 - [Firebase/Installations][I-FIS002000] -[FIRInstallationsIDController createGetInstallationItemPromise], appName: __FIRAPP_DEFAULT
2022-02-21 10:04:44.074458+1300 Releases[2690:524518] 8.9.1 - [Firebase/Installations][I-FIS002001] -[FIRInstallationsIDController installationWithValidAuthTokenForcingRefresh:0], appName: __FIRAPP_DEFAULT
2022-02-21 10:04:47.359100+1300 Releases[2690:521657] Sentry - Debug:: Add breadcrumb: <SentryBreadcrumb: 0x2872a3880>
2022-02-21 10:04:47.424680+1300 Releases[2690:521657] Sentry - Debug:: Add breadcrumb: <SentryBreadcrumb: 0x2805ea3c0>
2022-02-21 10:04:47.429104+1300 Releases[2690:521657] Sentry - Debug:: Add breadcrumb: <SentryBreadcrumb: 0x2872b0640>
2022-02-21 10:04:48.804 [Debug] [AVPlayerEngine+Observation.swift:75] onAccessLogEntryNotification(notification:) > event log:
 event log: averageAudioBitrate - 85728.0
 event log: averageVideoBitrate - 2961376.0
 event log: indicatedAverageBitrate - -1.0
 event log: indicatedBitrate - 1969030.0
 event log: observedBitrate - 36811172.0
 event log: observedMaxBitrate - -1.0
 event log: observedMinBitrate - -1.0
 event log: switchBitrate - -1.0
 event log: numberOfBytesTransferred - 761776
 event log: numberOfStalls - 0
 event log: URI - 'http://localhost:51856/1_q3eq1mi7/video/20b3cf06e10ac8f0ddac1e6c4c9a1fc4.m3u8'
 event log: startupTime - -1.0
2022-02-21 10:04:48.821 [Debug] [AVPlayerEngine+Observation.swift:365] handleDurationChanged() > Duration in seconds: 3568.32
2022-02-21 10:04:48.822 [Debug] [AVPlayerEngine.swift:387] postStateChange(newState:oldState:) > stateChanged:: new:Ready old:Ready
2022-02-21 10:04:48.823 [Debug] [KavaPlugin+AnalyticsPluginProtocol.swift:105] handleStateChanged(event:) > state changed event: PlayerEvent.StateChanged
2022-02-21 10:04:48.823 [Info] [KavaPlugin+AnalyticsPluginProtocol.swift:109] handleStateChanged(event:) > media ready
2022-02-21 10:04:48.849 [Warning] [AVPlayerEngine+Observation.swift:91] onErrorLogEntryNotification(notification:) > error description: Optional("Segment exceeds specified bandwidth for variant"), error domain: CoreMediaErrorDomain, error code: -12318
2022-02-21 10:04:49.175 [Debug] [AVPlayerEngine+Observation.swift:157] observeValue(forKeyPath:of:change:context:) > Buffer Full
2022-02-21 10:04:53.822 [Debug] [KavaPlugin.swift:283] sendAnalyticsEvent(event:) > Action: view
2022-02-21 10:04:53.824 [Debug] [KavaPlugin.swift:353] sendAnalyticsEvent(event:) > Sending Kava Event, view (99): ["actualBitrate": "1922.881", "audioLanguage": "en", "bufferTime": "0.0", "partnerId": "2066791", "sessionId": "2A8071D2-8A1B-4493-8CFC-6996FF8ABF1C:0EBD01FF-D6C1-4CBA-ACC5-3DCF18B64AA8", "position": "0.000", "averageBitrate": "1922.881", "application": "com.example.app1", "playTimeSum": "10.0", "applicationVer": "505", "clientVer": "playkit/ios-3.25.0", "entryId": "1_q3eq1mi7", "sessionStartTime": "1645391060.891", "eventIndex": "11", "service": "analytics", "referrer": "app://com.example.app1", "captionsLanguage": "none", "bufferTimeSum": "0.0", "playbackType": "vod", "eventType": "99", "deliveryType": "hls", "action": "trackEvent"]
2022-02-21 10:04:53.828872+1300 Releases[2690:524518] 8.9.1 - [Firebase/Performance][I-PRF300005] URL length exceeds limits, truncating recorded URL - https://analytics.kaltura.com/api_v3/index.php.
2022-02-21 10:04:54.197 [Debug] [KavaPlugin.swift:326] sendAnalyticsEvent(event:) > Response:
Status Code: 0
Error: 
Data: {
    time = "1645391093.92";
    viewEventsEnabled = 1;
}
2022-02-21 10:04:54.197642+1300 Releases[2690:523443] 8.9.1 - [Firebase/Performance][I-PRF100009] Logging network request trace - https://analytics.kaltura.com/api_v3/index.php, Response code: 200, 367.3770ms
2022-02-21 10:04:54.199318+1300 Releases[2690:524504] 8.9.1 - [Firebase/Installations][I-FIS002000] -[FIRInstallationsIDController createGetInstallationItemPromise], appName: __FIRAPP_DEFAULT
2022-02-21 10:04:54.203900+1300 Releases[2690:524504] 8.9.1 - [Firebase/Installations][I-FIS002001] -[FIRInstallationsIDController installationWithValidAuthTokenForcingRefresh:0], appName: __FIRAPP_DEFAULT
x-NR-x commented 2 years ago

Hello @olliestringfield-accedo,

Thank you for contacting us. We will investigate this.

Thanks, Nilit