Ver código fonte

improved video

marinofaggiana 4 anos atrás
pai
commit
7f6daba3ef

+ 4 - 8
Nextcloud.xcodeproj/project.pbxproj

@@ -118,6 +118,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 /* NCVideoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F752011C25480387000BF3A7 /* NCVideoViewController.swift */; };
 		F755BD9B20594AC7008C5FBB /* NCService.swift in Sources */ = {isa = PBXBuildFile; fileRef = F755BD9A20594AC7008C5FBB /* NCService.swift */; };
 		F755E6462525946C008DAB45 /* NCCollectionViewCommon.swift in Sources */ = {isa = PBXBuildFile; fileRef = F755E6442525946C008DAB45 /* NCCollectionViewCommon.swift */; };
 		F755E6472525946C008DAB45 /* NCCollectionCommon.swift in Sources */ = {isa = PBXBuildFile; fileRef = F755E6452525946C008DAB45 /* NCCollectionCommon.swift */; };
@@ -264,8 +265,6 @@
 		F7C40BF1219994F20004137E /* KTVHTTPCache.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7C40BF0219994F20004137E /* KTVHTTPCache.framework */; };
 		F7C40BF32199978B0004137E /* MBProgressHUD.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7C40BF22199978B0004137E /* MBProgressHUD.framework */; };
 		F7C4D88D2534887E00C142DA /* Parchment in Frameworks */ = {isa = PBXBuildFile; productRef = F7C4D88C2534887E00C142DA /* Parchment */; };
-		F7C6E0D1254411D0007E35FE /* NCVideo.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7C6E0D0254411D0007E35FE /* NCVideo.storyboard */; };
-		F7C6E0D7254411D9007E35FE /* NCVideo.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7C6E0D6254411D8007E35FE /* NCVideo.swift */; };
 		F7C7B489245EBA4100D93E60 /* NCViewerQuickLook.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7C7B488245EBA4100D93E60 /* NCViewerQuickLook.swift */; };
 		F7C9555321F0C4CA0024296E /* NCActivity.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7C9555221F0C4CA0024296E /* NCActivity.storyboard */; };
 		F7C9555521F0C5470024296E /* NCActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7C9555421F0C5470024296E /* NCActivity.swift */; };
@@ -464,6 +463,7 @@
 		F7514EDA1C7B1336008F3338 /* CCHud.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCHud.h; sourceTree = "<group>"; };
 		F7514EDB1C7B1336008F3338 /* CCHud.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCHud.m; sourceTree = "<group>"; };
 		F75153232226920200323DDC /* FastScroll.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FastScroll.framework; path = Carthage/Build/iOS/FastScroll.framework; sourceTree = "<group>"; };
+		F752011C25480387000BF3A7 /* NCVideoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCVideoViewController.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>"; };
@@ -642,8 +642,6 @@
 		F7C40BF22199978B0004137E /* MBProgressHUD.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MBProgressHUD.framework; path = Carthage/Build/iOS/MBProgressHUD.framework; sourceTree = "<group>"; };
 		F7C40C0F2199BA5D0004137E /* Realm.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Realm.framework; path = Carthage/Build/iOS/Realm.framework; sourceTree = "<group>"; };
 		F7C40C112199BA620004137E /* RealmSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RealmSwift.framework; path = Carthage/Build/iOS/RealmSwift.framework; sourceTree = "<group>"; };
-		F7C6E0D0254411D0007E35FE /* NCVideo.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = NCVideo.storyboard; sourceTree = "<group>"; };
-		F7C6E0D6254411D8007E35FE /* NCVideo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCVideo.swift; sourceTree = "<group>"; };
 		F7C742C01E7BD01F00D9C973 /* iOSClient.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = iOSClient.entitlements; sourceTree = "<group>"; };
 		F7C742D01E7BD35B00D9C973 /* Share.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Share.entitlements; sourceTree = "<group>"; };
 		F7C7B488245EBA4100D93E60 /* NCViewerQuickLook.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCViewerQuickLook.swift; sourceTree = "<group>"; };
@@ -1099,8 +1097,7 @@
 		F79018B1240962C7007C9B6D /* NCViewerImageAudioVideo */ = {
 			isa = PBXGroup;
 			children = (
-				F7C6E0D0254411D0007E35FE /* NCVideo.storyboard */,
-				F7C6E0D6254411D8007E35FE /* NCVideo.swift */,
+				F752011C25480387000BF3A7 /* NCVideoViewController.swift */,
 				F79630ED215527D40015EEA5 /* NCVideoCommon.swift */,
 				F70753F62542A9C000972D44 /* NCViewerImage.storyboard */,
 				F70753EA2542A99800972D44 /* NCViewerImagePageContainer.swift */,
@@ -1859,7 +1856,6 @@
 				F758B45A212C564000515F55 /* Scan.storyboard in Resources */,
 				F765F73225237E3F00391DBE /* NCRecent.storyboard in Resources */,
 				F77B0EFE1D118A16002130FE /* CCUploadFromOtherUpp.storyboard in Resources */,
-				F7C6E0D1254411D0007E35FE /* NCVideo.storyboard in Resources */,
 				F7FCFFD81D70798C000E6E29 /* CCPeekPop.storyboard in Resources */,
 				F78F74342163757000C2ADAD /* NCTrash.storyboard in Resources */,
 				F79A65C32191D90F00FF6DCC /* NCSelect.storyboard in Resources */,
@@ -2033,8 +2029,8 @@
 				F77444F522281649000D5EB0 /* NCGridMediaCell.swift in Sources */,
 				F7AE00F8230E81CB007ACF8A /* NCBrowserWeb.swift in Sources */,
 				F70A58BE24D0349500DED00D /* NCCapabilitiesViewController.swift in Sources */,
+				F752011D25480387000BF3A7 /* NCVideoViewController.swift in Sources */,
 				370D26AF248A3D7A00121797 /* NCImageCellProtocol.swift in Sources */,
-				F7C6E0D7254411D9007E35FE /* NCVideo.swift in Sources */,
 				F77B0DF51D118A16002130FE /* CCUtility.m in Sources */,
 				F710D1FE24057E5E00A6033D /* NCActionSheetHeader.swift in Sources */,
 				F790110E21415BF600D7B136 /* NCViewerRichdocument.swift in Sources */,

+ 0 - 82
iOSClient/Viewer/NCViewerImageAudioVideo/NCVideo.storyboard

@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Mmv-kq-uRN">
-    <device id="retina6_1" orientation="portrait" appearance="light"/>
-    <dependencies>
-        <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17126"/>
-        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
-        <capability name="System colors in document resources" minToolsVersion="11.0"/>
-        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
-    </dependencies>
-    <scenes>
-        <!--Video-->
-        <scene sceneID="puT-XC-QL4">
-            <objects>
-                <viewController modalPresentationStyle="fullScreen" id="Mmv-kq-uRN" customClass="NCVideo" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
-                    <view key="view" contentMode="scaleToFill" id="ZUd-xF-jbc">
-                        <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
-                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                        <subviews>
-                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="U2u-Ng-quR">
-                                <rect key="frame" x="0.0" y="79" width="414" height="763"/>
-                                <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                            </view>
-                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="oHy-h6-oBZ">
-                                <rect key="frame" x="8" y="30" width="45" height="26"/>
-                                <subviews>
-                                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="QdX-GD-p2D">
-                                        <rect key="frame" x="11.5" y="2" width="22" height="22"/>
-                                        <constraints>
-                                            <constraint firstAttribute="height" constant="22" id="dQc-qo-agC"/>
-                                            <constraint firstAttribute="width" constant="22" id="xnb-gI-bEr"/>
-                                        </constraints>
-                                        <color key="tintColor" systemColor="systemGrayColor"/>
-                                        <state key="normal" image="closeVideo">
-                                            <color key="titleColor" systemColor="systemGrayColor"/>
-                                        </state>
-                                        <connections>
-                                            <action selector="touchUpInsidecloseButton:" destination="Mmv-kq-uRN" eventType="touchUpInside" id="sQX-6Y-Yg3"/>
-                                        </connections>
-                                    </button>
-                                </subviews>
-                                <color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                                <constraints>
-                                    <constraint firstItem="QdX-GD-p2D" firstAttribute="centerX" secondItem="oHy-h6-oBZ" secondAttribute="centerX" id="4aU-y2-eVX"/>
-                                    <constraint firstItem="QdX-GD-p2D" firstAttribute="centerY" secondItem="oHy-h6-oBZ" secondAttribute="centerY" id="mBW-kE-lTZ"/>
-                                    <constraint firstAttribute="height" constant="26" id="qKQ-Gt-Qwc"/>
-                                    <constraint firstAttribute="width" constant="45" id="zII-t1-FVR"/>
-                                </constraints>
-                            </view>
-                        </subviews>
-                        <viewLayoutGuide key="safeArea" id="I8r-2q-gEp"/>
-                        <color key="backgroundColor" systemColor="systemBackgroundColor"/>
-                        <constraints>
-                            <constraint firstItem="U2u-Ng-quR" firstAttribute="top" secondItem="I8r-2q-gEp" secondAttribute="top" constant="35" id="JMx-LP-euj"/>
-                            <constraint firstItem="I8r-2q-gEp" firstAttribute="bottom" secondItem="U2u-Ng-quR" secondAttribute="bottom" constant="20" id="OB5-oL-uWd"/>
-                            <constraint firstItem="oHy-h6-oBZ" firstAttribute="leading" secondItem="ZUd-xF-jbc" secondAttribute="leading" constant="8" id="V0z-bW-qho"/>
-                            <constraint firstItem="oHy-h6-oBZ" firstAttribute="top" secondItem="ZUd-xF-jbc" secondAttribute="top" constant="30" id="WU4-yL-oxZ"/>
-                            <constraint firstAttribute="trailing" secondItem="U2u-Ng-quR" secondAttribute="trailing" id="fK9-2n-mIB"/>
-                            <constraint firstItem="U2u-Ng-quR" firstAttribute="leading" secondItem="ZUd-xF-jbc" secondAttribute="leading" id="zBR-Jl-ZtK"/>
-                        </constraints>
-                    </view>
-                    <connections>
-                        <outlet property="closeButton" destination="QdX-GD-p2D" id="1Qj-mY-fpU"/>
-                        <outlet property="closeView" destination="oHy-h6-oBZ" id="ii6-LY-JDp"/>
-                        <outlet property="videoView" destination="U2u-Ng-quR" id="rV3-kh-dBU"/>
-                    </connections>
-                </viewController>
-                <placeholder placeholderIdentifier="IBFirstResponder" id="gwo-1E-fE5" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
-            </objects>
-            <point key="canvasLocation" x="18.840579710144929" y="140.625"/>
-        </scene>
-    </scenes>
-    <resources>
-        <image name="closeVideo" width="425" height="425"/>
-        <systemColor name="systemBackgroundColor">
-            <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-        </systemColor>
-        <systemColor name="systemGrayColor">
-            <color red="0.55686274509803924" green="0.55686274509803924" blue="0.57647058823529407" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-        </systemColor>
-    </resources>
-</document>

+ 0 - 64
iOSClient/Viewer/NCViewerImageAudioVideo/NCVideo.swift

@@ -1,64 +0,0 @@
-//
-//  NCVideo.swift
-//  Nextcloud
-//
-//  Created by Marino Faggiana on 09/03/2020.
-//  Copyright © 2020 Marino Faggiana. All rights reserved.
-//
-//  Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-//  This program is free software: you can redistribute it and/or modify
-//  it under the terms of the GNU General Public License as published by
-//  the Free Software Foundation, either version 3 of the License, or
-//  (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-//
-//  You should have received a copy of the GNU General Public License
-//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-
-
-import Foundation
-
-class NCVideo: UIViewController {
-    
-    @IBOutlet weak var videoView: UIView!
-    @IBOutlet weak var closeView: UIView!
-    @IBOutlet weak var closeButton: UIButton!
-
-    let appDelegate = UIApplication.shared.delegate as! AppDelegate
-    @objc var metadata = tableMetadata()
-
-    required init?(coder: NSCoder) {
-        super.init(coder: coder)        
-    }
-    
-    override func viewDidLoad() {
-        super.viewDidLoad()
-        
-        view.backgroundColor = .black
-        
-        closeView.layer.cornerRadius = 7
-        closeView.backgroundColor = UIColor(red: 36.0/255.0, green: 36.0/255.0, blue: 36.0/255.0, alpha: 1.0)
-        
-        NCVideoCommon.shared.viewMedia(metadata, view: videoView, frame: CGRect(x: 0, y: 0, width: videoView.frame.width, height: videoView.frame.height))
-    }
-    
-    @IBAction func touchUpInsidecloseButton(_ sender: Any) {
-        
-        if NCVideoCommon.shared.player != nil && NCVideoCommon.shared.player.rate != 0 {
-            NCVideoCommon.shared.player.pause()
-        }
-        
-        if NCVideoCommon.shared.isMediaObserver {
-            NCVideoCommon.shared.isMediaObserver = false
-            NCVideoCommon.shared.removeObserver()
-        }
-
-        dismiss(animated: false) { }
-    }
-}

+ 125 - 0
iOSClient/Viewer/NCViewerImageAudioVideo/NCVideoViewController.swift

@@ -0,0 +1,125 @@
+//
+//  NCVideo.swift
+//  Nextcloud
+//
+//  Created by Marino Faggiana on 27/10/2020.
+//  Copyright © 2020 Marino Faggiana. All rights reserved.
+//
+
+import Foundation
+import KTVHTTPCache
+
+class NCVideoViewController: AVPlayerViewController {
+    
+    let appDelegate = UIApplication.shared.delegate as! AppDelegate
+    var metadata = tableMetadata()
+    var videoURL: URL?
+    var videoURLProxy: URL?
+
+    override func viewDidLoad() {
+        super.viewDidLoad()
+
+        
+        if CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView) {
+            
+            videoURL = URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView))
+            
+        } else {
+            
+            guard let stringURL = (metadata.serverUrl + "/" + metadata.fileName).addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) else {
+                return
+            }
+            
+            videoURL = URL(string: stringURL)
+            videoURLProxy = KTVHTTPCache.proxyURL(withOriginalURL: videoURL)
+            
+            guard let authData = (appDelegate.user + ":" + appDelegate.password).data(using: .utf8) else {
+                return
+            }
+            
+            let authValue = "Basic " + authData.base64EncodedString(options: [])
+            KTVHTTPCache.downloadSetAdditionalHeaders(["Authorization":authValue, "User-Agent":CCUtility.getUserAgent()])
+        }
+        
+        let video = AVPlayer(url: videoURL!)
+        player = video
+        
+        NotificationCenter.default.addObserver(forName: .AVPlayerItemDidPlayToEndTime, object: nil, queue: nil) { (notification) in
+            let player = notification.object as! AVPlayerItem
+            player.seek(to: CMTime.zero, completionHandler: nil)
+        }
+        
+        player?.addObserver(self, forKeyPath: "rate", options: [], context: nil)
+        player?.play()
+    }
+    
+    override func viewDidDisappear(_ animated: Bool) {
+        super.viewDidDisappear(animated)
+        
+    }
+    
+    deinit {
+        
+    }
+    
+    //MARK: - Observer
+
+    override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
+        
+        if keyPath != nil && keyPath == "rate" {
+            
+            if player?.rate == 1 {
+                print("start")
+            } else {
+                print("stop")
+            }
+            
+            // Save cache
+            if !CCUtility.fileProviderStorageExists(self.metadata.ocId, fileNameView:self.metadata.fileNameView) {
+                
+                guard let url = KTVHTTPCache.cacheCompleteFileURL(with: self.videoURL) else {
+                    return
+                }
+                
+                CCUtility.copyFile(atPath: url.path, toPath: CCUtility.getDirectoryProviderStorageOcId(self.metadata.ocId, fileNameView: self.metadata.fileNameView))
+                NCManageDatabase.sharedInstance.addLocalFile(metadata: self.metadata)
+                KTVHTTPCache.cacheDelete(with: self.videoURL)
+                
+                NotificationCenter.default.postOnMainThread(name: k_notificationCenter_reloadDataSource, userInfo: ["ocId":self.metadata.ocId, "serverUrl":self.metadata.serverUrl])
+            }
+        }
+    }
+    
+    @objc func removeObserver() {
+        
+        player?.removeObserver(self, forKeyPath: "rate", context: nil)
+        NotificationCenter.default.removeObserver(self, name: NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: nil)
+    }
+    
+    //MARK: - KTVHTTPCache
+    
+    @objc func setupHTTPCache() {
+        
+        KTVHTTPCache.cacheSetMaxCacheLength(Int64(k_maxHTTPCache))
+        
+        if ProcessInfo.processInfo.environment["SIMULATOR_DEVICE_NAME"] != nil {
+            KTVHTTPCache.logSetConsoleLogEnable(true)
+        }
+        
+        do {
+            try KTVHTTPCache.proxyStart()
+        } catch let error {
+            print("Proxy Start error : \(error)")
+        }
+        
+        KTVHTTPCache.encodeSetURLConverter { (url) -> URL? in
+            print("URL Filter reviced URL : " + String(describing: url))
+            return url
+        }
+        
+        KTVHTTPCache.downloadSetUnacceptableContentTypeDisposer { (url, contentType) -> Bool in
+            print("Unsupport Content-Type Filter reviced URL : " + String(describing: url) + " " + String(describing: contentType))
+            return false
+        }
+    }
+}

+ 19 - 16
iOSClient/Viewer/NCViewerImageAudioVideo/NCViewerImagePageContainer.swift

@@ -266,20 +266,22 @@ class NCViewerImagePageContainer: UIViewController, UIGestureRecognizerDelegate
     }
     
     @objc func didSingleTapWith(gestureRecognizer: UITapGestureRecognizer) {
-        // VIDEO
+        
         if currentMetadata.typeFile == k_metadataTypeFile_video || currentMetadata.typeFile == k_metadataTypeFile_audio {
-            if let viewerImageVideo = UIStoryboard(name: "NCVideo", bundle: nil).instantiateInitialViewController() as? NCVideo {
-                viewerImageVideo.metadata = currentMetadata
-                present(viewerImageVideo, animated: false) { }
-            }
-            return
-        }
-        if currentMode == .full {
-            changeScreenMode(to: .normal)
-            currentMode = .normal
+            
+            let video = NCVideoViewController()
+            video.metadata = currentMetadata
+            present(video, animated: false) { }
+            
         } else {
-            changeScreenMode(to: .full)
-            currentMode = .full
+        
+            if currentMode == .full {
+                changeScreenMode(to: .normal)
+                currentMode = .normal
+            } else {
+                changeScreenMode(to: .full)
+                currentMode = .full
+            }
         }
     }
     
@@ -293,11 +295,12 @@ class NCViewerImagePageContainer: UIViewController, UIGestureRecognizerDelegate
         currentViewerImageZoom = viewerImageZoom
         
         if (currentMetadata.typeFile == k_metadataTypeFile_video || currentMetadata.typeFile == k_metadataTypeFile_audio) && autostratVideo {
+            
             autostratVideo = false
-            if let viewerImageVideo = UIStoryboard(name: "NCVideo", bundle: nil).instantiateInitialViewController() as? NCVideo {
-                viewerImageVideo.metadata = currentMetadata
-                present(viewerImageVideo, animated: false) { }
-            }
+            
+            let video = NCVideoViewController()
+            video.metadata = currentMetadata
+            present(video, animated: false) { }
         }
     }