Skip to content

Commit af8276c

Browse files
author
Isaac
committed
Fix video playback in iOS < 17.5
(cherry picked from commit 5c5236c)
1 parent 67ed6f9 commit af8276c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

submodules/MediaPlayer/Sources/MediaPlayer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ private final class MediaPlayerContext {
342342
let _ = self.playerStatusValue.swap(status)
343343
}
344344

345-
let frameSource = FFMpegMediaFrameSource(queue: self.queue, postbox: self.postbox, userLocation: self.userLocation, userContentType: self.userContentType, resourceReference: self.resourceReference, tempFilePath: self.tempFilePath, limitedFileRange: self.limitedFileRange, streamable: self.streamable.enabled, isSeekable: self.streamable.isSeekable, video: self.video, preferSoftwareDecoding: self.preferSoftwareDecoding, fetchAutomatically: self.fetchAutomatically, stallDuration: self.streamable.parameters.0, lowWaterDuration: self.streamable.parameters.1, highWaterDuration: self.streamable.parameters.2, storeAfterDownload: self.storeAfterDownload)
345+
let frameSource = FFMpegMediaFrameSource(queue: self.queue, postbox: self.postbox, userLocation: self.userLocation, userContentType: self.userContentType, resourceReference: self.resourceReference, tempFilePath: self.tempFilePath, limitedFileRange: self.limitedFileRange, streamable: self.streamable.enabled, isSeekable: self.streamable.isSeekable, video: self.video, preferSoftwareDecoding: self.preferSoftwareDecoding, fetchAutomatically: self.fetchAutomatically, stallDuration: self.streamable.parameters.0, lowWaterDuration: self.streamable.parameters.1, highWaterDuration: self.streamable.parameters.2, storeAfterDownload: self.storeAfterDownload, isAudioVideoMessage: self.isAudioVideoMessage)
346346
let disposable = MetaDisposable()
347347
let updatedSeekState: MediaPlayerSeekState?
348348
if let loadedDuration = loadedDuration {

submodules/MediaPlayer/Sources/MediaPlayerNode.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,10 @@ public final class MediaPlayerNode: ASDisplayNode {
221221
videoLayer.enqueue(frame.sampleBuffer)
222222
if #available(iOS 17.4, *) {
223223
} else {
224-
strongSelf.hasSentFramesToDisplay?()
224+
if !strongSelf.didNotifyVideoLayerReadyForDisplay {
225+
strongSelf.didNotifyVideoLayerReadyForDisplay = true
226+
strongSelf.hasSentFramesToDisplay?()
227+
}
225228
}
226229
}
227230
}
@@ -257,7 +260,10 @@ public final class MediaPlayerNode: ASDisplayNode {
257260
return
258261
}
259262
videoLayer.enqueue(frame.sampleBuffer)
260-
//strongSelf.hasSentFramesToDisplay?()
263+
if !strongSelf.didNotifyVideoLayerReadyForDisplay {
264+
strongSelf.didNotifyVideoLayerReadyForDisplay = true
265+
strongSelf.hasSentFramesToDisplay?()
266+
}
261267
}
262268

263269
Queue.mainQueue().async {

0 commit comments

Comments
 (0)