Skip to content

Commit

Permalink
v1.4.1(49)
Browse files Browse the repository at this point in the history
- Add option close or keep open when media player done.
- Fix bug on custom FFmpeg player skip button when media is preloading.
  • Loading branch information
lithium0003 committed Nov 18, 2019
1 parent d0837e6 commit 8bb7f55
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 28 deletions.
6 changes: 4 additions & 2 deletions ccViewer/CryptCloudViewer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = ccViewer/ccViewer.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 47;
CURRENT_PROJECT_VERSION = 49;
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
DEVELOPMENT_TEAM = 7A9X38B4YU;
"ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES;
Expand All @@ -828,6 +828,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.4.1;
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
Expand All @@ -847,7 +848,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = ccViewer/ccViewer.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 47;
CURRENT_PROJECT_VERSION = 49;
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
DEVELOPMENT_TEAM = 7A9X38B4YU;
"ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES;
Expand All @@ -862,6 +863,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.4.1;
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
Expand Down
38 changes: 19 additions & 19 deletions ccViewer/ccViewer/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

21 changes: 16 additions & 5 deletions ccViewer/ccViewer/CustomPlayerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ class CustomPlayerView: NSObject, AVPlayerViewControllerDelegate {
return viewController
}()

var finish = false
var iscancel = false
var isVideo = false

Expand Down Expand Up @@ -414,8 +413,16 @@ class CustomPlayerView: NSObject, AVPlayerViewControllerDelegate {

func nextTrack() {
let url = prevURL
var reload = UserDefaults.standard.bool(forKey: "keepOpenWhenDone")
if player.items().count <= 2 {
if loop {
reload = false
loopSetup()
}
if reload {
if player.items().count > 1 {
reload = false
}
loopSetup()
}
}
Expand Down Expand Up @@ -447,6 +454,9 @@ class CustomPlayerView: NSObject, AVPlayerViewControllerDelegate {
}
}
}
if reload {
player.pause()
}
}

@objc func didPlayToEndTime(_ notification: Notification) {
Expand All @@ -461,18 +471,19 @@ class CustomPlayerView: NSObject, AVPlayerViewControllerDelegate {

func playerViewController(_ playerViewController: AVPlayerViewController, restoreUserInterfaceForPictureInPictureStopWithCompletionHandler completionHandler: @escaping (Bool) -> Void) {

if let currentViewController = UIApplication.topViewController() {
if let currentViewController = UIApplication.topViewController(), !iscancel {
currentViewController.present(playerViewController, animated: true) {
completionHandler(true)
}
}
else {
finishDisplay()
completionHandler(true)
}
}

func playerViewControllerDidStopPictureInPicture(_ playerViewController: AVPlayerViewController) {
CustomPlayerView.pipVideo = false
if playerViewController.player?.rate ?? 0 == 0 {
finishDisplay()
}
}

func finishDisplay() {
Expand Down
2 changes: 1 addition & 1 deletion ccViewer/ccViewer/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.4.0</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand Down
11 changes: 10 additions & 1 deletion ccViewer/ccViewer/TableViewControllerSetting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ class TableViewControllerSetting: UITableViewController, UITextFieldDelegate {
[NSLocalizedString("Start skip", comment: ""),
NSLocalizedString("Stop after specified duration", comment: "")],
[NSLocalizedString("Skip foward (sec)", comment: ""),
NSLocalizedString("Skip backward (sec)", comment: "")],
NSLocalizedString("Skip backward (sec)", comment: ""),
NSLocalizedString("Keep open when done", comment: "")],
[NSLocalizedString("Ignore overlay subtiles", comment: ""),
NSLocalizedString("Auto select streams", comment: "")],
[NSLocalizedString("View online help", comment: ""),
Expand Down Expand Up @@ -250,6 +251,12 @@ class TableViewControllerSetting: UITableViewController, UITextFieldDelegate {
UserDefaults.standard.set(value, forKey: "playSkipBackwardSec")
}
cell.accessoryView = picker
case 2:
let aSwitch = UISwitch()
aSwitch.addTarget(self, action: #selector(switchChanged), for: .valueChanged)
aSwitch.isOn = UserDefaults.standard.bool(forKey: "keepOpenWhenDone")
aSwitch.tag = 14
cell.accessoryView = aSwitch
default:
break
}
Expand Down Expand Up @@ -322,6 +329,8 @@ class TableViewControllerSetting: UITableViewController, UITextFieldDelegate {
UserDefaults.standard.set(value, forKey: "noOverlaySubtitles")
case 13:
UserDefaults.standard.set(value, forKey: "autoSelectStreams")
case 14:
UserDefaults.standard.set(value, forKey: "keepOpenWhenDone")
default:
break
}
Expand Down
2 changes: 2 additions & 0 deletions ccViewer/ccViewer/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@
"Player control" = "再生コントロール";
"Skip foward (sec)" = "早送り (秒)";
"Skip backward (sec)" = "巻戻し (秒)";
"Keep open when done" = "再生終了後に閉じない";

"Cast converter" = "Cast時の変換設定";
"Ignore overlay subtiles" = "焼き込み字幕を入れない";
"Auto select streams" = "自動で映像と焼き込み字幕を選択する";

12 changes: 12 additions & 0 deletions ffplayer/ffplayer/player_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,18 @@ void Player::Quit()
std::unique_lock<std::mutex> lk(video.pictq_mutex);
video.pictq_cond.notify_one();
}
if (video.videoStream >= 0) {
av_log(NULL, AV_LOG_INFO, "video abort.\n");
video.videoq.AbortQueue();
}
if (audio.audioStream >= 0) {
av_log(NULL, AV_LOG_INFO, "audio abort.\n");
audio.audioq.AbortQueue();
}
if (subtitle.subtitleStream >= 0) {
av_log(NULL, AV_LOG_INFO, "subtitle abort.\n");
subtitle.subtitleq.AbortQueue();
}
av_usleep(100*1000);
}

Expand Down

0 comments on commit 8bb7f55

Please sign in to comment.