Merge branch 'feature-media_kit' into alpha
This commit is contained in:
@ -73,6 +73,7 @@ class PlPlayerController {
|
|||||||
|
|
||||||
Rx<bool> videoFitChanged = false.obs;
|
Rx<bool> videoFitChanged = false.obs;
|
||||||
final Rx<BoxFit> _videoFit = Rx(BoxFit.contain);
|
final Rx<BoxFit> _videoFit = Rx(BoxFit.contain);
|
||||||
|
final Rx<String> _videoFitDesc = Rx('包含');
|
||||||
|
|
||||||
///
|
///
|
||||||
// ignore: prefer_final_fields
|
// ignore: prefer_final_fields
|
||||||
@ -183,6 +184,7 @@ class PlPlayerController {
|
|||||||
|
|
||||||
/// 视频比例
|
/// 视频比例
|
||||||
Rx<BoxFit> get videoFit => _videoFit;
|
Rx<BoxFit> get videoFit => _videoFit;
|
||||||
|
Rx<String> get videoFitDEsc => _videoFitDesc;
|
||||||
|
|
||||||
/// 是否长按倍速
|
/// 是否长按倍速
|
||||||
Rx<bool> get doubleSpeedStatus => _doubleSpeedStatus;
|
Rx<bool> get doubleSpeedStatus => _doubleSpeedStatus;
|
||||||
@ -445,7 +447,7 @@ class PlPlayerController {
|
|||||||
} else {
|
} else {
|
||||||
await setPlaybackSpeed(1.0);
|
await setPlaybackSpeed(1.0);
|
||||||
}
|
}
|
||||||
|
getVideoFit();
|
||||||
// if (_looping) {
|
// if (_looping) {
|
||||||
// await setLooping(_looping);
|
// await setLooping(_looping);
|
||||||
// }
|
// }
|
||||||
@ -734,37 +736,34 @@ class PlPlayerController {
|
|||||||
if (attrs.indexOf(_videoFit.value) < attrs.length - 1) {
|
if (attrs.indexOf(_videoFit.value) < attrs.length - 1) {
|
||||||
int index = attrs.indexOf(_videoFit.value);
|
int index = attrs.indexOf(_videoFit.value);
|
||||||
_videoFit.value = attrs[index + 1];
|
_videoFit.value = attrs[index + 1];
|
||||||
print(videoFitType[index + 1]['desc']);
|
_videoFitDesc.value = videoFitType[index + 1]['desc'];
|
||||||
SmartDialog.showToast(videoFitType[index + 1]['desc']);
|
SmartDialog.showToast(videoFitType[index + 1]['desc']);
|
||||||
} else {
|
} else {
|
||||||
// 默认 contain
|
// 默认 contain
|
||||||
_videoFit.value = videoFitType.first['attr'];
|
_videoFit.value = videoFitType.first['attr'];
|
||||||
|
_videoFitDesc.value = videoFitType.first['desc'];
|
||||||
SmartDialog.showToast(videoFitType.first['desc']);
|
SmartDialog.showToast(videoFitType.first['desc']);
|
||||||
}
|
}
|
||||||
videoFitChangedTimer = Timer(const Duration(seconds: 1), () {
|
videoFitChangedTimer = Timer(const Duration(seconds: 1), () {
|
||||||
videoFitChangedTimer = null;
|
videoFitChangedTimer = null;
|
||||||
videoFitChanged.value = false;
|
videoFitChanged.value = false;
|
||||||
});
|
});
|
||||||
print(_videoFit.value);
|
setVideoFit();
|
||||||
}
|
|
||||||
|
|
||||||
/// Change Video Fit accordingly
|
|
||||||
void onVideoFitChange(BoxFit fit) {
|
|
||||||
_videoFit.value = fit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 缓存fit
|
/// 缓存fit
|
||||||
// Future<void> setVideoFit() async {
|
Future<void> setVideoFit() async {
|
||||||
// videoStorage.put(VideoBoxKey.videoBrightness, _videoFit.value.name);
|
List attrs = videoFitType.map((e) => e['attr']).toList();
|
||||||
// }
|
int index = attrs.indexOf(_videoFit.value);
|
||||||
|
videoStorage.put(VideoBoxKey.cacheVideoFit, index);
|
||||||
|
}
|
||||||
|
|
||||||
/// 读取fit
|
/// 读取fit
|
||||||
// Future<void> getVideoFit() async {
|
Future<void> getVideoFit() async {
|
||||||
// String fitValue =
|
int fitValue = videoStorage.get(VideoBoxKey.cacheVideoFit, defaultValue: 0);
|
||||||
// videoStorage.get(VideoBoxKey.videoBrightness, defaultValue: 'contain');
|
_videoFit.value = videoFitType[fitValue]['attr'];
|
||||||
// _videoFit.value = videoFitType
|
_videoFitDesc.value = videoFitType[fitValue]['desc'];
|
||||||
// .firstWhere((element) => element['attr'] == fitValue)['attr'];
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
/// 读取亮度
|
/// 读取亮度
|
||||||
// Future<void> getVideoBrightness() async {
|
// Future<void> getVideoBrightness() async {
|
||||||
|
@ -115,13 +115,20 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
ComBtn(
|
SizedBox(
|
||||||
icon: const Icon(
|
height: 30,
|
||||||
Icons.settings_overscan_outlined,
|
child: TextButton(
|
||||||
size: 18,
|
onPressed: () => _.toggleVideoFit(),
|
||||||
color: Colors.white,
|
style: ButtonStyle(
|
||||||
|
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||||
|
),
|
||||||
|
child: Obx(
|
||||||
|
() => Text(
|
||||||
|
_.videoFitDEsc.value,
|
||||||
|
style: const TextStyle(color: Colors.white, fontSize: 13),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
fuc: () => _.toggleVideoFit(),
|
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
// 全屏
|
// 全屏
|
||||||
@ -139,7 +146,7 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 8),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -170,4 +170,6 @@ class VideoBoxKey {
|
|||||||
static const String longPressSpeedDefault = 'longPressSpeedDefault';
|
static const String longPressSpeedDefault = 'longPressSpeedDefault';
|
||||||
// 自定义倍速集合
|
// 自定义倍速集合
|
||||||
static const String customSpeedsList = 'customSpeedsList';
|
static const String customSpeedsList = 'customSpeedsList';
|
||||||
|
// 画面填充比例
|
||||||
|
static const String cacheVideoFit = 'cacheVideoFit';
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user