mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 16:11:20 -08:00
use async/await
This commit is contained in:
1 parent
facf8876b5
commit
e34d09a99c
9 files changed
+86
-102
No files matched your search
@@ -13,26 +13,24 @@ const nativeScreenfull = (art) => {
|
||||
get() {
|
||||
return screenfull.isFullscreen;
|
||||
},
|
||||
set(value) {
|
||||
async set(value) {
|
||||
if (value) {
|
||||
art.normalSize = 'fullscreen';
|
||||
art.aspectRatioReset = true;
|
||||
art.autoSize = false;
|
||||
screenfull.request($player).then(() => {
|
||||
addClass($player, 'art-fullscreen');
|
||||
art.emit('resize');
|
||||
art.emit('fullscreen', true);
|
||||
notice.show = '';
|
||||
});
|
||||
await screenfull.request($player);
|
||||
addClass($player, 'art-fullscreen');
|
||||
art.emit('resize');
|
||||
art.emit('fullscreen', true);
|
||||
notice.show = '';
|
||||
} else {
|
||||
art.aspectRatioReset = true;
|
||||
art.autoSize = art.option.autoSize;
|
||||
screenfull.exit().then(() => {
|
||||
removeClass($player, 'art-fullscreen');
|
||||
art.emit('resize');
|
||||
art.emit('fullscreen');
|
||||
notice.show = '';
|
||||
});
|
||||
await screenfull.exit();
|
||||
removeClass($player, 'art-fullscreen');
|
||||
art.emit('resize');
|
||||
art.emit('fullscreen');
|
||||
notice.show = '';
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user