Skip to content

Commit

Permalink
Changed smart resume conditions and implemented no subtitle audio export
Browse files Browse the repository at this point in the history
  • Loading branch information
arianneorpilla committed May 23, 2021
1 parent 76526bf commit 7e78182
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
3 changes: 3 additions & 0 deletions chewie/lib/src/material_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ class _MaterialControlsState extends State<MaterialControls>
openExtraShare();
break;
case 6:
chewieController.wasPlaying.value =
(chewieController.videoPlayerController.value.isPlaying ||
chewieController.wasPlaying.value);
chewieController.exportSingleCallback();
break;
}
Expand Down
20 changes: 17 additions & 3 deletions lib/player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,18 @@ class _VideoPlayerState extends State<VideoPlayer>
);
}

Subtitle getExportSubtitle() {
if (_currentSubTrack.value == 99999) {
return Subtitle(
startTime: _videoPlayerController.value.position,
endTime: _videoPlayerController.value.position,
text: "",
);
} else {
return _currentSubtitle.value;
}
}

void exportSingleCallback() {
getVideoPlayerController().pause();
_clipboard.value = "&<&>export&<&>";
Expand All @@ -580,7 +592,7 @@ class _VideoPlayerState extends State<VideoPlayer>
getChewieController(),
getVideoPlayerController(),
_clipboard,
_currentSubtitle.value,
getExportSubtitle(),
_currentDictionaryEntry.value,
_wasPlaying.value,
[_currentSubtitle.value],
Expand Down Expand Up @@ -669,7 +681,7 @@ class _VideoPlayerState extends State<VideoPlayer>

void toggleShadowingMode() {
if (_shadowingSubtitle.value == null) {
_shadowingSubtitle.value = _currentSubtitle.value;
_shadowingSubtitle.value = getExportSubtitle();
} else {
_shadowingSubtitle.value = null;
}
Expand Down Expand Up @@ -1719,7 +1731,9 @@ class _VideoPlayerState extends State<VideoPlayer>
_wasPlaying.value),
);

if (wasPlaying && !isExporting) {
if (wasPlaying &&
!isExporting &&
(!getFocusMode() || _clipboard.value == "")) {
getVideoPlayerController().play();
}
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: jidoujisho
description: A mobile video player tailored for Japanese language learners.
publish_to: none

version: 0.16.6+30
version: 0.16.7+30

environment:
sdk: ">=2.7.0 <3.0.0"
Expand Down

0 comments on commit 7e78182

Please sign in to comment.