marinofaggiana 3 years ago
parent
commit
df138ed74c

+ 4 - 4
Nextcloud.xcodeproj/project.pbxproj

@@ -152,7 +152,7 @@
 		F74DE14425135B6800917068 /* NCTransfers.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F74DE14225135B6800917068 /* NCTransfers.storyboard */; };
 		F7501C322212E57500FB1415 /* NCMedia.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7501C302212E57400FB1415 /* NCMedia.storyboard */; };
 		F7501C332212E57500FB1415 /* NCMedia.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7501C312212E57400FB1415 /* NCMedia.swift */; };
-		F752011D25480387000BF3A7 /* NCViewerVideo.swift in Sources */ = {isa = PBXBuildFile; fileRef = F752011C25480387000BF3A7 /* NCViewerVideo.swift */; };
+		F752011D25480387000BF3A7 /* NCViewerAVPlayerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F752011C25480387000BF3A7 /* NCViewerAVPlayerViewController.swift */; };
 		F755BD9B20594AC7008C5FBB /* NCService.swift in Sources */ = {isa = PBXBuildFile; fileRef = F755BD9A20594AC7008C5FBB /* NCService.swift */; };
 		F7581D1A25EFDA61004DC699 /* NCLoginWeb+Menu.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7581D1925EFDA60004DC699 /* NCLoginWeb+Menu.swift */; };
 		F7581D2425EFDDDF004DC699 /* NCMedia+Menu.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7581D2325EFDDDF004DC699 /* NCMedia+Menu.swift */; };
@@ -553,7 +553,7 @@
 		F7501C302212E57400FB1415 /* NCMedia.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = NCMedia.storyboard; sourceTree = "<group>"; };
 		F7501C312212E57400FB1415 /* NCMedia.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCMedia.swift; sourceTree = "<group>"; };
 		F75153232226920200323DDC /* FastScroll.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FastScroll.framework; path = Carthage/Build/iOS/FastScroll.framework; sourceTree = "<group>"; };
-		F752011C25480387000BF3A7 /* NCViewerVideo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCViewerVideo.swift; sourceTree = "<group>"; };
+		F752011C25480387000BF3A7 /* NCViewerAVPlayerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCViewerAVPlayerViewController.swift; sourceTree = "<group>"; };
 		F753701822723D620041C76C /* gl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = gl; path = gl.lproj/Localizable.strings; sourceTree = "<group>"; };
 		F753701922723E0D0041C76C /* ca */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ca; path = ca.lproj/Localizable.strings; sourceTree = "<group>"; };
 		F753701A22723EC80041C76C /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Localizable.strings; sourceTree = "<group>"; };
@@ -1235,7 +1235,7 @@
 			isa = PBXGroup;
 			children = (
 				F703FFEA268CA60D00FA1459 /* NCKTVHTTPCache.swift */,
-				F752011C25480387000BF3A7 /* NCViewerVideo.swift */,
+				F752011C25480387000BF3A7 /* NCViewerAVPlayerViewController.swift */,
 			);
 			path = NCViewerVideo;
 			sourceTree = "<group>";
@@ -2090,7 +2090,7 @@
 				F7AE00F8230E81CB007ACF8A /* NCBrowserWeb.swift in Sources */,
 				F702F30825EE5D47008F8E80 /* NCPopupViewController.swift in Sources */,
 				F70A58BE24D0349500DED00D /* NCCapabilitiesViewController.swift in Sources */,
-				F752011D25480387000BF3A7 /* NCViewerVideo.swift in Sources */,
+				F752011D25480387000BF3A7 /* NCViewerAVPlayerViewController.swift in Sources */,
 				F733598125C1C188002ABA72 /* NCAskAuthorization.swift in Sources */,
 				370D26AF248A3D7A00121797 /* NCImageCellProtocol.swift in Sources */,
 				F77B0DF51D118A16002130FE /* CCUtility.m in Sources */,

+ 1 - 1
iOSClient/AppDelegate.swift

@@ -48,7 +48,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
     @objc var activeMedia: NCMedia?
     var activeServerUrl: String = ""
     @objc var activeViewController: UIViewController?
-    var activeViewerVideo: NCViewerVideo?
+    var activeViewerAVPlayerViewController: NCViewerAVPlayerViewController?
     var mainTabBar: NCMainTabBar?
     var activeMetadata: tableMetadata?
     

+ 7 - 7
iOSClient/Viewer/NCViewerImage/NCViewerImage.swift

@@ -707,14 +707,14 @@ extension NCViewerImage: UIGestureRecognizerDelegate {
             if pictureInPictureOcId != currentMetadata.ocId {
                                 
                 // Kill PIP
-                appDelegate.activeViewerVideo?.player?.replaceCurrentItem(with: nil)
+                appDelegate.activeViewerAVPlayerViewController?.player?.replaceCurrentItem(with: nil)
                 // --------
                 
-                appDelegate.activeViewerVideo = NCViewerVideo()
-                appDelegate.activeViewerVideo?.metadata = currentMetadata
-                appDelegate.activeViewerVideo?.imageBackground = UIImage(named: "file_audio")
-                appDelegate.activeViewerVideo?.delegateViewerVideo = self
-                if let currentViewerVideo = appDelegate.activeViewerVideo {
+                appDelegate.activeViewerAVPlayerViewController = NCViewerAVPlayerViewController()
+                appDelegate.activeViewerAVPlayerViewController?.metadata = currentMetadata
+                appDelegate.activeViewerAVPlayerViewController?.imageBackground = UIImage(named: "file_audio")
+                appDelegate.activeViewerAVPlayerViewController?.delegateViewerVideo = self
+                if let currentViewerVideo = appDelegate.activeViewerAVPlayerViewController {
                     present(currentViewerVideo, animated: false) { }
                     self.videoStop()
                 }
@@ -814,7 +814,7 @@ extension NCViewerImage: NCViewerImageZoomDelegate {
 
 //MARK: - NCViewerVideoDelegate
 
-extension NCViewerImage: NCViewerVideoDelegate {
+extension NCViewerImage: NCViewerAVPlayerViewControllerDelegate {
     
     func startPictureInPicture(metadata: tableMetadata) {
         pictureInPictureOcId = metadata.ocId

+ 5 - 5
iOSClient/Viewer/NCViewerVideo/NCViewerVideo.swift → iOSClient/Viewer/NCViewerVideo/NCViewerAVPlayerViewController.swift

@@ -1,5 +1,5 @@
 //
-//  NCViewerVideo.swift
+//  NCViewerAVPlayerViewController.swift
 //  Nextcloud
 //
 //  Created by Marino Faggiana on 27/10/2020.
@@ -25,18 +25,18 @@ import UIKit
 import AVKit
 import NCCommunication
 
-protocol NCViewerVideoDelegate {
+protocol NCViewerAVPlayerViewControllerDelegate {
     func startPictureInPicture(metadata: tableMetadata)
     func stopPictureInPicture(metadata: tableMetadata, playing: Bool)
 }
 
-class NCViewerVideo: AVPlayerViewController {
+class NCViewerAVPlayerViewController: AVPlayerViewController {
     
     let appDelegate = UIApplication.shared.delegate as! AppDelegate
     var metadata = tableMetadata()
     var pictureInPicture: Bool = false
     var imageBackground: UIImage?
-    var delegateViewerVideo: NCViewerVideoDelegate?
+    var delegateViewerVideo: NCViewerAVPlayerViewControllerDelegate?
     private var rateObserverToken: Any?
 
     // MARK: - View Life Cycle
@@ -146,7 +146,7 @@ class NCViewerVideo: AVPlayerViewController {
     }
 }
 
-extension NCViewerVideo: AVPlayerViewControllerDelegate {
+extension NCViewerAVPlayerViewController: AVPlayerViewControllerDelegate {
     
     func playerViewControllerShouldAutomaticallyDismissAtPictureInPictureStart(_ playerViewController: AVPlayerViewController) -> Bool {
         true