Skip to content

Commit

Permalink
fix: buffer display, improved set external subtitles
Browse files Browse the repository at this point in the history
  • Loading branch information
nini22P committed Jan 31, 2025
1 parent 144986e commit 3e4cc2e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## v1.3.0

### Changelog

* Add [FVP](https://github.com/wang-bin/fvp) player backend (Experimental, with unknown bugs)
* Add file sort

### 更新日志
* 添加 [FVP](https://github.com/wang-bin/fvp) 播放器后端(实验性,有未知bug)
* 添加文件排序


## v1.2.1

### Changelog
Expand Down
14 changes: 13 additions & 1 deletion lib/hooks/use_fvp_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,18 @@ FvpPlayer useFvpPlayer(BuildContext context) {
return;
}, [duration]);

useEffect(() {
if (externalSubtitle.value == null) {
controller.setExternalSubtitle('');
} else if (externalSubtitles.isNotEmpty &&
externalSubtitle.value != null &&
externalSubtitle.value! < externalSubtitles.length) {
controller
.setExternalSubtitle(externalSubtitles[externalSubtitle.value!].uri);
}
return;
}, [externalSubtitle.value]);

useEffect(() {
() async {
if (currentPlay != null &&
Expand Down Expand Up @@ -243,7 +255,7 @@ FvpPlayer useFvpPlayer(BuildContext context) {
duration: duration,
buffer: buffered.isEmpty || duration == Duration.zero
? Duration.zero
: buffered.last.end,
: buffered.reduce((max, curr) => curr.end > max.end ? curr : max).end,
aspect: aspect,
width: size.width,
height: size.height,
Expand Down
5 changes: 0 additions & 5 deletions lib/pages/subtitle_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ class SubtitleList extends HookWidget {
onTap: () {
logger('Set subtitle: ${t.off}');
(player as FvpPlayer).externalSubtitle.value = null;
(player as FvpPlayer).controller.setExternalSubtitle('');
(player as FvpPlayer).controller.setSubtitleTracks([]);
Navigator.of(context).pop();
},
Expand Down Expand Up @@ -134,7 +133,6 @@ class SubtitleList extends HookWidget {
logger(
'Set subtitle: ${subtitle.metadata['title'] ?? subtitle.metadata['language'] ?? subtitle.index.toString()}');
(player as FvpPlayer).externalSubtitle.value = null;
(player as FvpPlayer).controller.setExternalSubtitle('');
(player as FvpPlayer)
.controller
.setSubtitleTracks([subtitles.indexOf(subtitle)]);
Expand Down Expand Up @@ -173,9 +171,6 @@ class SubtitleList extends HookWidget {
(player as FvpPlayer)
.externalSubtitles
.indexOf(subtitle);
(player as FvpPlayer)
.controller
.setExternalSubtitle(subtitle.uri);
Navigator.of(context).pop();
},
),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.2.1+3
version: 1.3.0+3

environment:
sdk: ^3.5.4
Expand Down

0 comments on commit 3e4cc2e

Please sign in to comment.