From 6c852bf4031af97c947fca04e570c0040e33d219 Mon Sep 17 00:00:00 2001 From: Marco Schmickler Date: Sun, 22 Jul 2018 10:24:27 +0200 Subject: [PATCH] Swift 4 --- Podfile | 6 ++-- kplayer.xcodeproj/project.pbxproj | 40 +++++++++++++--------- kplayer/core/MediaItem.swift | 2 +- kplayer/detail/VideoPlayerController.swift | 3 ++ 4 files changed, 30 insertions(+), 21 deletions(-) diff --git a/Podfile b/Podfile index 7fa8194..ea2c944 100644 --- a/Podfile +++ b/Podfile @@ -7,15 +7,15 @@ target 'kplayer' do # pod 'Player' #pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'swift-2.0' #pod 'Alamofire', '~> 1.2' - pod 'Alamofire', '~> 4.2' - pod 'ALMoviePlayerController', '~>0.3.0' + pod 'Alamofire', '4.7' + pod 'ALMoviePlayerController', '0.3.0' #pod 'DZVideoPlayerViewController' #pod 'SwiftyJSON' #pod 'HanekeSwift' pod 'HanekeSwift', :git => 'https://github.com/jasonnoahchoi/HanekeSwift', :branch => 'swift3' pod 'Nimbus/Photos' pod 'Nimbus/PagingScrollView' - pod 'BMPlayer' + pod 'BMPlayer', '0.8.6' #pod 'AFNetworking', '~>2.1' #pod 'Dollar', '6.1.0' #pod 'Cent', '6.0.3' diff --git a/kplayer.xcodeproj/project.pbxproj b/kplayer.xcodeproj/project.pbxproj index 7960e99..ebb9466 100644 --- a/kplayer.xcodeproj/project.pbxproj +++ b/kplayer.xcodeproj/project.pbxproj @@ -29,6 +29,7 @@ 1C736D16E81BA1FB325200E0 /* HanekeFetchOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C7360744ABACC3557D05760 /* HanekeFetchOperation.swift */; }; 1C736D24891597F2728230EE /* ImageLoadOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C7360A94DBECA685ED8602F /* ImageLoadOperation.swift */; }; 1C736D24B49451141CD4B64D /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C7369F53095B7A4D65679C2 /* DetailViewController.swift */; }; + 1C736E1B6330FC91332F204D /* scratch2.txt in Resources */ = {isa = PBXBuildFile; fileRef = 1C7362A332872013B9B04CBB /* scratch2.txt */; }; 1C736F6A223D4ADB2E1BA733 /* ItemCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C736069C214E9522BB1BD97 /* ItemCell.swift */; }; 1C736FB92B19FE17E4357C85 /* MediaItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C73688DAB88F9360FB62A49 /* MediaItem.swift */; }; AA74B07A01F0E99E6DEC7D1B /* Pods_kplayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B75159FFCD5A882E6F167FE /* Pods_kplayer.framework */; }; @@ -59,6 +60,7 @@ 1C73620D01687FB4F1811C5C /* NetworkHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkHelper.swift; sourceTree = ""; }; 1C736253AB7A95EA41B605B7 /* ItemModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ItemModel.swift; sourceTree = ""; }; 1C736260E748CF136FF37EA7 /* UploadOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UploadOperation.swift; sourceTree = ""; }; + 1C7362A332872013B9B04CBB /* scratch2.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = scratch2.txt; sourceTree = ""; }; 1C73648CEC974A2500172064 /* ViewControllerExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewControllerExtensions.swift; sourceTree = ""; }; 1C7365B06FA66294E99AC2D3 /* NetworkManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkManager.swift; sourceTree = ""; }; 1C7367379DEE94EBF3FAFA78 /* VideoPlayerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoPlayerController.swift; sourceTree = ""; }; @@ -228,6 +230,7 @@ 1C7363B608460DED4F522D1C /* photo */, 1C736E3BE8EC464D6F5DC8FA /* scratch.txt */, 1C736F3946A38499113D351A /* video */, + 1C7362A332872013B9B04CBB /* scratch2.txt */, ); path = kplayer; sourceTree = ""; @@ -269,7 +272,6 @@ C98AF5CC1B124D6A00D196CC /* Frameworks */, C98AF5CD1B124D6A00D196CC /* Resources */, 34FE5806529FEB6C56D30822 /* [CP] Embed Pods Frameworks */, - 9901417B0A169BA87853DAAE /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -351,6 +353,7 @@ C98AF5E11B124D6A00D196CC /* Images.xcassets in Resources */, 1C736A5FA5BA53B2597F2ED7 /* Kirschkeks-256x256.png in Resources */, 1C73651E1241702E5032A8A4 /* scratch.txt in Resources */, + 1C736E1B6330FC91332F204D /* scratch2.txt in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -370,9 +373,24 @@ files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-kplayer/Pods-kplayer-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/ALMoviePlayerController/ALMoviePlayerController.framework", + "${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework", + "${BUILT_PRODUCTS_DIR}/BMPlayer/BMPlayer.framework", + "${BUILT_PRODUCTS_DIR}/HanekeSwift/Haneke.framework", + "${BUILT_PRODUCTS_DIR}/NVActivityIndicatorView/NVActivityIndicatorView.framework", + "${BUILT_PRODUCTS_DIR}/Nimbus/Nimbus.framework", + "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ALMoviePlayerController.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Alamofire.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/BMPlayer.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Haneke.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NVActivityIndicatorView.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Nimbus.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SnapKit.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -385,28 +403,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-kplayer-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; - 9901417B0A169BA87853DAAE /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-kplayer/Pods-kplayer-resources.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ diff --git a/kplayer/core/MediaItem.swift b/kplayer/core/MediaItem.swift index c9f7955..1fcdcaa 100644 --- a/kplayer/core/MediaItem.swift +++ b/kplayer/core/MediaItem.swift @@ -120,7 +120,7 @@ class MediaItem: CustomDebugStringConvertible { var snapshotDirPathForVideo: String { let len = "/srv/samba/ren".count let rootPostfix = (root as NSString).substring(from: len) - let tpath = "/srv/samba/ren/thumb\(rootPostfix)/\(path)/\(name)" + let tpath = "/srv/samba/ren/thumb\(rootPostfix)/\(path)\(name)" let enc = tpath.addingPercentEscapes(using: String.Encoding.isoLatin1)! return enc + "/" diff --git a/kplayer/detail/VideoPlayerController.swift b/kplayer/detail/VideoPlayerController.swift index d2f3e5e..0e1df99 100644 --- a/kplayer/detail/VideoPlayerController.swift +++ b/kplayer/detail/VideoPlayerController.swift @@ -103,6 +103,9 @@ print("play") } @IBAction func back(_ sender: AnyObject) { + if moviePlayer!.playbackState == MPMoviePlaybackState.playing { + moviePlayer!.pause() + } completionHandler!() }