Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(player, options) {
super(player, options);
this.handleVrDisplayActivate_ = videojs.bind(this, this.handleVrDisplayActivate_);
this.handleVrDisplayDeactivate_ = videojs.bind(this, this.handleVrDisplayDeactivate_);
this.handleVrDisplayPresentChange_ = videojs.bind(this, this.handleVrDisplayPresentChange_);
this.handleOrientationChange_ = videojs.bind(this, this.handleOrientationChange_);
window.addEventListener('orientationchange', this.handleOrientationChange_);
window.addEventListener('vrdisplayactivate', this.handleVrDisplayActivate_);
window.addEventListener('vrdisplaydeactivate', this.handleVrDisplayDeactivate_);
// vrdisplaypresentchange does not fire activate or deactivate
// and happens when hitting the back button during cardboard mode
// so we need to make sure we stay in the correct state by
// listening to it and checking if we are presenting it or not
window.addEventListener('vrdisplaypresentchange', this.handleVrDisplayPresentChange_);
// we cannot show the cardboard button in fullscreen on
// android as it breaks the controls, and makes it impossible
// to exit cardboard mode
if (videojs.browser.IS_ANDROID) {
this.on(player, 'fullscreenchange', () => {
if (player.isFullscreen()) {
this.hide();
if(response) {
// populate input fields with the args that were used for this query.
for(k in response.args)
if(input[k]) input[k].value = response.args[k];
var query = qs.stringify(response.args);
if (!skipHistory && query.length > 0 && query.length < 1e6) {
window.history.pushState(response, '', '/?' + query);
var json;
if(json = $('#json-link')) json.setAttribute('href', '/api?' + query);
}
}
}
window.addEventListener('popstate', function(event) {
update(null, event.state);
});
}); // DOMContentLoaded
const authWindow = window.open(link, '_blank', 'width=1024,height=716');
const handleToken = e => {
// TODO: add security step to validate which domain the message is coming from
authWindow.close();
window.removeEventListener('message', handleToken);
this._dropbox.setAccessToken(e.data.token);
if (window.localStorage) {
window.localStorage.setItem('dropbox', JSON.stringify({
// dropbox token doesn't expire unless revoked by the user
token: e.data.token,
timestamp: new Date()
}));
}
onCloudLoginSuccess(this.name);
};
window.addEventListener('message', handleToken);
}
componentDidMount() {
window.addEventListener('keydown', this._onKeyPressed);
}
player.ready(Fn.bind(this, function() {
if (player.tech_ && player.tech_.featuresNativeTextTracks) {
this.hide();
return;
}
player.on('fullscreenchange', updateDisplayHandler);
player.on('playerresize', updateDisplayHandler);
window.addEventListener('orientationchange', updateDisplayHandler);
player.on('dispose', () => window.removeEventListener('orientationchange', updateDisplayHandler));
const tracks = this.options_.playerOptions.tracks || [];
for (let i = 0; i < tracks.length; i++) {
this.player_.addRemoteTextTrack(tracks[i], true);
}
this.preselectTrack();
}));
}
audiocontext,
this.options_.omnitone, this.getVideoEl_(), this.options_.omnitoneOptions
);
this.omniController.one('audiocontext-suspended', () => {
this.player.pause();
this.player.one('playing', () => {
audiocontext.resume();
});
});
}
this.on(this.player_, 'fullscreenchange', this.handleResize_);
window.addEventListener('vrdisplaypresentchange', this.handleResize_, true);
window.addEventListener('resize', this.handleResize_, true);
window.addEventListener('vrdisplayactivate', this.handleVrDisplayActivate_, true);
window.addEventListener('vrdisplaydeactivate', this.handleVrDisplayDeactivate_, true);
this.initialized_ = true;
this.trigger('initialized');
}
componentDidMount() {
window.addEventListener('resize', this._resize);
}
return source(function broadcaster(broadcast) {
window.addEventListener('popstate', onPopState);
function onPopState() {
broadcast(String(document.location.pathname));
}
});
}
componentDidMount() {
window.addEventListener('resize', this._resize);
window.addEventListener('keydown', this._keydown);
window.fetch(DATA_URL).then(response => {
response.text().then(json => {
const data = processInitialData(JSON.parse(json));
this.setState({ data });
this.calcStats(data);
});
});
}
const updateDom = () => {
const rect = base.getBoundingClientRect();
domState.width = rect.width;
domState.height = rect.height;
if (domState.top !== rect.top) {
calcScroll(Math.abs(domState.top = rect.top));
}
each(updates, exec);
}
const clearButtons = () => mouseState.m = mouseState.r = mouseState.l = false;
window.addEventListener('mouseup',
event => mouseState[mouseKeys[event.which]] = true);
window.addEventListener('mousedown',
event => mouseState[mouseKeys[event.which]] = false);
window.addEventListener('mousemove', event => {
mouseState.x = event.pageX;
mouseState.y = event.pageY;
mouseState.hover = event.target;
if (!event.which) {
clearButtons();
}
});
const fullState = {
scrollTop,
scrollBottom,
mbtn: linker(() => mouseState.m),
rbtn: linker(() => mouseState.r),