mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 00:31:20 -08:00
add airplay
This commit is contained in:
1 parent
55c7560ce2
commit
fbd1d2170a
20 files changed
+210
-17
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import { def } from '../utils';
|
||||
|
||||
export default function airplayMix(art) {
|
||||
const {
|
||||
i18n,
|
||||
notice,
|
||||
events: { proxy },
|
||||
template: { $video },
|
||||
} = art;
|
||||
|
||||
let available = false;
|
||||
|
||||
if (window.WebKitPlaybackTargetAvailabilityEvent && $video.webkitShowPlaybackTargetPicker) {
|
||||
proxy($video, 'webkitplaybacktargetavailabilitychanged', (event) => {
|
||||
switch (event.availability) {
|
||||
case 'available':
|
||||
available = true;
|
||||
break;
|
||||
case 'not-available':
|
||||
available = false;
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
def(art, 'airplay', {
|
||||
value() {
|
||||
if (available) {
|
||||
$video.webkitShowPlaybackTargetPicker();
|
||||
art.emit('airplay');
|
||||
} else {
|
||||
notice.show = i18n.get('AirPlay Not Available');
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import themeMix from './themeMix';
|
||||
import titleMix from './titleMix';
|
||||
import normalSizeMix from './normalSizeMix';
|
||||
import subtitleOffsetMix from './subtitleOffsetMix';
|
||||
import airplayMix from './airplayMix';
|
||||
import optionInit from './optionInit';
|
||||
import eventInit from './eventInit';
|
||||
|
||||
@@ -63,6 +64,7 @@ export default class Player {
|
||||
titleMix(art);
|
||||
normalSizeMix(art);
|
||||
subtitleOffsetMix(art);
|
||||
airplayMix(art);
|
||||
eventInit(art);
|
||||
optionInit(art);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user