mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: 默认字幕偏好错误、全屏逻辑独立、新增全屏不转方向、字幕无法关闭
This commit is contained in:
@@ -389,7 +389,7 @@ class PlPlayerController {
|
|||||||
refreshSubtitles().then((value) {
|
refreshSubtitles().then((value) {
|
||||||
if (_vttSubtitles.isNotEmpty){
|
if (_vttSubtitles.isNotEmpty){
|
||||||
String preference = setting.get(SettingBoxKey.subtitlePreference,
|
String preference = setting.get(SettingBoxKey.subtitlePreference,
|
||||||
defaultValue: SubtitlePreference.values.first.index);
|
defaultValue: SubtitlePreference.values.first.code);
|
||||||
if (preference == 'on') {
|
if (preference == 'on') {
|
||||||
setSubtitle(vttSubtitles[1]);
|
setSubtitle(vttSubtitles[1]);
|
||||||
} else if (preference == 'withoutAi') {
|
} else if (preference == 'withoutAi') {
|
||||||
@@ -545,6 +545,15 @@ class PlPlayerController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> autoEnterFullscreen() async {
|
||||||
|
bool autoEnterFullscreen =
|
||||||
|
GStrorage.setting.get(SettingBoxKey.enableAutoEnter, defaultValue: false);
|
||||||
|
if (autoEnterFullscreen) {
|
||||||
|
await Future.delayed(const Duration(milliseconds: 300));
|
||||||
|
triggerFullScreen(status: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<StreamSubscription> subscriptions = [];
|
List<StreamSubscription> subscriptions = [];
|
||||||
final List<Function(Duration position)> _positionListeners = [];
|
final List<Function(Duration position)> _positionListeners = [];
|
||||||
final List<Function(PlayerStatus status)> _statusListeners = [];
|
final List<Function(PlayerStatus status)> _statusListeners = [];
|
||||||
@@ -975,6 +984,9 @@ class PlPlayerController {
|
|||||||
/// 进入全屏
|
/// 进入全屏
|
||||||
FullScreenMode mode = FullScreenModeCode.fromCode(
|
FullScreenMode mode = FullScreenModeCode.fromCode(
|
||||||
setting.get(SettingBoxKey.fullScreenMode, defaultValue: 0))!;
|
setting.get(SettingBoxKey.fullScreenMode, defaultValue: 0))!;
|
||||||
|
if (mode == FullScreenMode.none) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (mode == FullScreenMode.vertical ||
|
if (mode == FullScreenMode.vertical ||
|
||||||
(mode == FullScreenMode.auto && direction.value == 'vertical') ||
|
(mode == FullScreenMode.auto && direction.value == 'vertical') ||
|
||||||
(mode == FullScreenMode.ratio &&
|
(mode == FullScreenMode.ratio &&
|
||||||
@@ -1122,7 +1134,7 @@ class PlPlayerController {
|
|||||||
|
|
||||||
// 设定字幕轨道
|
// 设定字幕轨道
|
||||||
setSubtitle(Map<String, String> s) {
|
setSubtitle(Map<String, String> s) {
|
||||||
if (s['text'] == null) {
|
if (s['text'] == '') {
|
||||||
_videoPlayerController?.setSubtitleTrack(SubtitleTrack.no());
|
_videoPlayerController?.setSubtitleTrack(SubtitleTrack.no());
|
||||||
_vttSubtitlesIndex.value = 0;
|
_vttSubtitlesIndex.value = 0;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
enum FullScreenMode {
|
enum FullScreenMode {
|
||||||
// 根据内容自适应
|
// 根据内容自适应
|
||||||
auto,
|
auto,
|
||||||
|
// 不改变当前方向
|
||||||
|
none,
|
||||||
// 始终竖屏
|
// 始终竖屏
|
||||||
vertical,
|
vertical,
|
||||||
// 始终横屏
|
// 始终横屏
|
||||||
@@ -11,11 +13,11 @@ enum FullScreenMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension FullScreenModeDesc on FullScreenMode {
|
extension FullScreenModeDesc on FullScreenMode {
|
||||||
String get description => ['按视频方向(默认)', '强制竖屏', '强制横屏', '屏幕长宽比<1.25或为竖屏视频时竖屏,否则横屏'][index];
|
String get description => ['按视频方向(默认)', '不改变当前方向','强制竖屏', '强制横屏', '屏幕长宽比<1.25或为竖屏视频时竖屏,否则横屏'][index];
|
||||||
}
|
}
|
||||||
|
|
||||||
extension FullScreenModeCode on FullScreenMode {
|
extension FullScreenModeCode on FullScreenMode {
|
||||||
static final List<int> _codeList = [0, 1, 2, 3];
|
static final List<int> _codeList = [0, 1, 2, 3, 4];
|
||||||
int get code => _codeList[index];
|
int get code => _codeList[index];
|
||||||
|
|
||||||
static FullScreenMode? fromCode(int code) {
|
static FullScreenMode? fromCode(int code) {
|
||||||
|
|||||||
Reference in New Issue
Block a user