negromate/web/static/js/videojs-playlist/test/player-proxy-maker.js

38 lines
931 B
JavaScript
Raw Normal View History

2021-09-29 09:36:46 +02:00
import window from 'global/window';
import videojs from 'video.js';
const proxy = (props) => {
const player = Object.assign({}, videojs.EventTarget.prototype, {
play: () => {},
paused: () => {},
ended: () => {},
poster: () => {},
src: () => {},
currentSrc: () => {},
addRemoteTextTrack: () => {},
removeRemoteTextTrack: () => {},
remoteTextTracks: () => {},
playlist: {
autoadvance_: {},
currentIndex_: -1,
autoadvance: () => {},
contains: () => {},
currentItem: () => {},
first: () => {},
indexOf: () => {},
next: () => {},
previous: () => {}
},
ready: (cb) => cb(),
setTimeout: (cb, wait) => window.setTimeout(cb, wait),
clearTimeout: (id) => window.clearTimeout(id)
}, props);
player.constructor = videojs.getComponent('Player');
player.playlist.player_ = player;
return player;
};
export default proxy;