From 8fb0fb66e3e1a41485fc8dd85423b16571ce9cb5 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Fri, 6 Jan 2023 21:43:27 -0400 Subject: [PATCH] Start playing video attachments immediately on appear --- .../Attachment Gallery/GalleryPlayerViewController.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Tusker/Screens/Attachment Gallery/GalleryPlayerViewController.swift b/Tusker/Screens/Attachment Gallery/GalleryPlayerViewController.swift index 407276abf3..2d3f265dc9 100644 --- a/Tusker/Screens/Attachment Gallery/GalleryPlayerViewController.swift +++ b/Tusker/Screens/Attachment Gallery/GalleryPlayerViewController.swift @@ -16,6 +16,8 @@ class GalleryPlayerViewController: UIViewController { var attachment: Attachment! + private var isFirstAppearance = true + override func viewDidLoad() { super.viewDidLoad() @@ -44,6 +46,13 @@ class GalleryPlayerViewController: UIViewController { DispatchQueue.global(qos: .userInitiated).async { AudioSessionHelper.enable() AudioSessionHelper.setVideoPlayback() + + DispatchQueue.main.async { + if self.isFirstAppearance { + self.isFirstAppearance = false + self.playerVC.player?.play() + } + } } }