stremio-web/src/index.js
2019-09-13 15:52:37 +03:00

45 lines
1.5 KiB
JavaScript
Executable file

const React = require('react');
const ReactDOM = require('react-dom');
const StateContainer = require('stremio-core-web');
const App = require('./App');
const loadShell = () => {
if (!window.qt || window.shell) {
return Promise.resolve();
}
return new Promise((resolve) => {
window.shellOnLoad = () => {
resolve();
};
});
};
const loadStateContainer = () => {
if (window.stateContainer) {
return Promise.resolve();
}
return StateContainer.load();
};
Promise.all([
loadShell(),
loadStateContainer()
]).then(() => {
if (window.shell) {
window.shell.dispatch('mpv', 'setOption', null, 'terminal', 'yes');
window.shell.dispatch('mpv', 'setOption', null, 'msg-level', 'all=v');
window.shell.dispatch('mpv', 'setProp', null, 'vo', 'opengl-cb');
window.shell.dispatch('mpv', 'setProp', null, 'opengl-hwdec-interop', 'auto');
window.shell.dispatch('mpv', 'setProp', null, 'cache-default', 15000);
window.shell.dispatch('mpv', 'setProp', null, 'cache-backbuffer', 15000);
window.shell.dispatch('mpv', 'setProp', null, 'cache-secs', 10);
window.shell.dispatch('mpv', 'setProp', null, 'audio-client-name', 'Stremio');
window.shell.dispatch('mpv', 'setProp', null, 'title', 'Stremio');
window.shell.dispatch('mpv', 'setProp', null, 'audio-fallback-to-null', 'yes');
window.shell.dispatch('mpv', 'setProp', null, 'sid', 'no');
}
ReactDOM.render(<App />, document.getElementById('app'));
});