Separate 'isVideo' from 'isVideoReadyToPlay'
This commit is contained in:
parent
32d0afac3a
commit
c75e957b68
@ -57,7 +57,13 @@ public class ReusableMediaView {
|
||||
}
|
||||
|
||||
var isVideo: Bool {
|
||||
mediaViewAdapter is MediaViewAdapterVideo
|
||||
if mediaViewAdapter is MediaViewAdapterVideo {
|
||||
return true
|
||||
}
|
||||
if let thumbnail = mediaViewAdapter as? MediaViewAdapterBackupThumbnail {
|
||||
return thumbnail.isVideo
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// MARK: - LoadState
|
||||
@ -407,6 +413,10 @@ class MediaViewAdapterBackupThumbnail: MediaViewAdapter {
|
||||
imageView
|
||||
}
|
||||
|
||||
var isVideo: Bool {
|
||||
attachmentBackupThumbnail.attachment.contentType.isVideo
|
||||
}
|
||||
|
||||
var isLoaded: Bool {
|
||||
imageView.image != nil
|
||||
}
|
||||
|
||||
@ -88,16 +88,21 @@ struct MediaGalleryItem: Equatable, Hashable, MediaGallerySectionItem {
|
||||
var isVideo: Bool {
|
||||
switch referencedAttachment.attachment.contentType {
|
||||
case .video:
|
||||
// For now, if the video isn't a stream, don't treat it as a video.
|
||||
if referencedAttachment.asReferencedStream == nil {
|
||||
return false
|
||||
}
|
||||
return renderingFlag != .shouldLoop
|
||||
return true
|
||||
case .file, .image, .audio:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
var isVideoReadyToPlay: Bool {
|
||||
switch referencedAttachment.attachment.contentType {
|
||||
case .video where referencedAttachment.asReferencedStream != nil:
|
||||
return renderingFlag != .shouldLoop
|
||||
case .file, .image, .audio, .video:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
var isAnimated: Bool {
|
||||
switch referencedAttachment.attachment.contentType {
|
||||
case .video:
|
||||
|
||||
@ -59,8 +59,7 @@ class MediaItemViewController: OWSViewController, VideoPlaybackStatusProvider {
|
||||
}
|
||||
|
||||
private func configureVideoPlaybackControls() {
|
||||
guard videoPlayerView != nil else {
|
||||
owsFailBeta("No videoPlayer")
|
||||
guard isVideo else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@ -296,7 +296,7 @@ class MediaPageViewController: UIPageViewController {
|
||||
}
|
||||
|
||||
let mediaPage = buildGalleryPage(galleryItem: item)
|
||||
mediaPage.shouldAutoPlayVideo = true
|
||||
mediaPage.shouldAutoPlayVideo = item.isVideoReadyToPlay
|
||||
setViewControllers([mediaPage], direction: direction, animated: animated) { _ in
|
||||
self.didTransitionToNewPage(animated: animated, direction: direction)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user