Don't loop secret videos

This commit is contained in:
Ali
2021-07-19 15:54:29 +02:00
parent 891de085da
commit 10fd84b541
3 changed files with 8 additions and 6 deletions

View File

@@ -37,6 +37,7 @@ public class UniversalVideoGalleryItem: GalleryItem {
let displayInfoOnTop: Bool
let hideControls: Bool
let fromPlayingVideo: Bool
let isSecret: Bool
let landscape: Bool
let timecode: Double?
let configuration: GalleryConfiguration?
@@ -46,7 +47,7 @@ public class UniversalVideoGalleryItem: GalleryItem {
let storeMediaPlaybackState: (MessageId, Double?) -> Void
let present: (ViewController, Any?) -> Void
public init(context: AccountContext, presentationData: PresentationData, content: UniversalVideoContent, originData: GalleryItemOriginData?, indexData: GalleryItemIndexData?, contentInfo: UniversalVideoGalleryItemContentInfo?, caption: NSAttributedString, credit: NSAttributedString? = nil, displayInfoOnTop: Bool = false, hideControls: Bool = false, fromPlayingVideo: Bool = false, landscape: Bool = false, timecode: Double? = nil, configuration: GalleryConfiguration? = nil, playbackCompleted: @escaping () -> Void = {}, performAction: @escaping (GalleryControllerInteractionTapAction) -> Void, openActionOptions: @escaping (GalleryControllerInteractionTapAction) -> Void, storeMediaPlaybackState: @escaping (MessageId, Double?) -> Void, present: @escaping (ViewController, Any?) -> Void) {
public init(context: AccountContext, presentationData: PresentationData, content: UniversalVideoContent, originData: GalleryItemOriginData?, indexData: GalleryItemIndexData?, contentInfo: UniversalVideoGalleryItemContentInfo?, caption: NSAttributedString, credit: NSAttributedString? = nil, displayInfoOnTop: Bool = false, hideControls: Bool = false, fromPlayingVideo: Bool = false, isSecret: Bool = false, landscape: Bool = false, timecode: Double? = nil, configuration: GalleryConfiguration? = nil, playbackCompleted: @escaping () -> Void = {}, performAction: @escaping (GalleryControllerInteractionTapAction) -> Void, openActionOptions: @escaping (GalleryControllerInteractionTapAction) -> Void, storeMediaPlaybackState: @escaping (MessageId, Double?) -> Void, present: @escaping (ViewController, Any?) -> Void) {
self.context = context
self.presentationData = presentationData
self.content = content
@@ -58,6 +59,7 @@ public class UniversalVideoGalleryItem: GalleryItem {
self.displayInfoOnTop = displayInfoOnTop
self.hideControls = hideControls
self.fromPlayingVideo = fromPlayingVideo
self.isSecret = isSecret
self.landscape = landscape
self.timecode = timecode
self.configuration = configuration
@@ -1024,7 +1026,7 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
private var actionAtEnd: MediaPlayerPlayOnceWithSoundActionAtEnd {
if let item = self.item {
if let content = item.content as? NativeVideoContent, content.duration <= 30 {
if !item.isSecret, let content = item.content as? NativeVideoContent, content.duration <= 30 {
return .loop
}
}