hyzp_ybqx-Commit179:已经实现视频播放的暂停、播放和重新播放

master
WinUser01 3 years ago
parent c38bfd7224
commit c2660b5e22

@ -111,6 +111,7 @@ class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListe
await _playerController.setDataSource(widget.url, autoPlay: true).catchError((e) {
print("setDataSource error: $e");
});
playerRegionProvide.changePlayerState(bPlaying);
}
// Future<void> init() async {
@ -641,25 +642,39 @@ class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListe
bool bPlaying = true;
void playOrPause() {
//state : 1 2
// _playerController.getPlayState().then((state) {
// print('state = $state');
// if (1 == state) {
// bPlaying = false;
// _playerController.pause();
// } else {
// bPlaying = true;
// _playerController.resume();
// }
// playerRegionProvide.changePlayerState(bPlaying);
// Storage.setString('bPlaying', bPlaying ? 'true' : 'false');
// setState(() {});
// playerRegionProvide.changePlayerState(bPlaying);
//
// if (bPlaying) {
// _playerController.start();
// } else {
// _playerController.pause();
// }
//
// setState(() {
// bPlaying = !bPlaying;
// });
//state : 1 2
if (FijkState.started == _playerController.state) {
bPlaying = false;
_playerController.pause();
} else {
bPlaying = true;
_playerController.start();
}
playerRegionProvide.changePlayerState(bPlaying);
Storage.setString('bPlaying', bPlaying ? 'true' : 'false');
setState(() {});
}
void restartPlay(String url) async {
_playState = 4;
bPlaying = true;
await _playerController.stop();
await _playerController.reset();
startPlay();
// _playerController.resetPlayer();
// _playerController.resume();

Loading…
Cancel
Save