This commit is contained in:
Ilya Laktyushin
2020-02-12 03:06:42 +04:00
parent adc000ddf6
commit c896a5886c
2 changed files with 9 additions and 4 deletions

View File

@@ -256,6 +256,7 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
private var initiallyActivated = false
private var hideStatusNodeUntilCentrality = false
private var playOnContentOwnership = false
private var skipInitialPause = false
private var validLayout: (ContainerViewLayout, CGFloat)?
private var didPause = false
private var isPaused = true
@@ -480,6 +481,7 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
if strongSelf.playOnContentOwnership {
strongSelf.playOnContentOwnership = false
strongSelf.initiallyActivated = true
strongSelf.skipInitialPause = true
strongSelf.videoNode?.playOnceWithSound(playAndRecord: false, actionAtEnd: .stop)
}
}
@@ -786,8 +788,12 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
if hadPreviousValue {
videoNode.canAttachContent = isVisible
if isVisible {
videoNode.pause()
videoNode.seek(0.0)
if self.skipInitialPause {
self.skipInitialPause = false
} else {
videoNode.pause()
videoNode.seek(0.0)
}
} else {
videoNode.continuePlayingWithoutSound()
}

View File

@@ -530,8 +530,7 @@ private final class MediaPlayerContext {
} else {
if case let .timecode(time) = seek {
self.seek(timestamp: Double(time), action: .play)
}
else if case .playing = self.state {
} else if case .playing = self.state {
} else {
self.play()
}