update stremio-video

This commit is contained in:
nklhrstv 2022-05-10 17:16:16 +03:00
parent fbb88c759f
commit b808e3909f
4 changed files with 14 additions and 10 deletions

6
package-lock.json generated
View file

@ -1856,9 +1856,9 @@
"integrity": "sha512-knlcBibqJW2mbEgid6YEeQN9FPkIGAEtozYWqzKWeHd2DPY2nl8kYX2pMQpa2Db/RVSqbVstu/gdey5TtSgGYw==" "integrity": "sha512-knlcBibqJW2mbEgid6YEeQN9FPkIGAEtozYWqzKWeHd2DPY2nl8kYX2pMQpa2Db/RVSqbVstu/gdey5TtSgGYw=="
}, },
"@stremio/stremio-video": { "@stremio/stremio-video": {
"version": "0.0.17-rc.7", "version": "0.0.17-rc.8",
"resolved": "https://registry.npmjs.org/@stremio/stremio-video/-/stremio-video-0.0.17-rc.7.tgz", "resolved": "https://registry.npmjs.org/@stremio/stremio-video/-/stremio-video-0.0.17-rc.8.tgz",
"integrity": "sha512-FTn503YkyeIP5VoyNCu2nlepCV5E5BmaoH9l1yz1COsuvy9Yb7mMlNOlVA4/96fczPGcvuK+o1Stv0xxP0QBMg==", "integrity": "sha512-rDohMYGyto2RI6RRU4KHEpfW90C7C/gM/XK0uBynC47tp/bKgcQcxHMaBNyF5K2c9nOzNcsTD58/V1uIHk8DlA==",
"requires": { "requires": {
"color": "4.2.3", "color": "4.2.3",
"deep-freeze": "0.0.1", "deep-freeze": "0.0.1",

View file

@ -17,7 +17,7 @@
"@stremio/stremio-colors": "4.0.1", "@stremio/stremio-colors": "4.0.1",
"@stremio/stremio-core-web": "0.34.0", "@stremio/stremio-core-web": "0.34.0",
"@stremio/stremio-icons": "3.0.5", "@stremio/stremio-icons": "3.0.5",
"@stremio/stremio-video": "0.0.17-rc.7", "@stremio/stremio-video": "0.0.17-rc.8",
"a-color-picker": "1.2.1", "a-color-picker": "1.2.1",
"buffer": "6.0.3", "buffer": "6.0.3",
"classnames": "2.3.1", "classnames": "2.3.1",

View file

@ -69,9 +69,9 @@ const Player = ({ urlParams, queryParams }) => {
} }
); );
const videoRef = React.useRef(null); const videoRef = React.useRef(null);
const dispatch = React.useCallback((args) => { const dispatch = React.useCallback((action, options) => {
if (videoRef.current !== null) { if (videoRef.current !== null) {
videoRef.current.dispatch(args); videoRef.current.dispatch(action, options);
} }
}, []); }, []);
const onImplementationChanged = React.useCallback((manifest) => { const onImplementationChanged = React.useCallback((manifest) => {
@ -259,9 +259,10 @@ const Player = ({ urlParams, queryParams }) => {
streamingServer.selected.transportUrl streamingServer.selected.transportUrl
: :
null, null,
chromecastTransport: chromecast.active ? chromecast.transport : null,
seriesInfo: player.seriesInfo seriesInfo: player.seriesInfo
} }
}, {
chromecastTransport: chromecast.active ? chromecast.transport : null,
}); });
} }
}, [streamingServer.baseUrl, player.selected, player.metaItem, forceTranscoding, maxAudioChannels, casting]); }, [streamingServer.baseUrl, player.selected, player.metaItem, forceTranscoding, maxAudioChannels, casting]);

View file

@ -17,10 +17,13 @@ const Video = React.forwardRef(({ className, ...props }, ref) => {
const onImplementationChangedRef = useLiveRef(props.onImplementationChanged); const onImplementationChangedRef = useLiveRef(props.onImplementationChanged);
const videoElementRef = React.useRef(null); const videoElementRef = React.useRef(null);
const videoRef = React.useRef(null); const videoRef = React.useRef(null);
const dispatch = React.useCallback((action) => { const dispatch = React.useCallback((action, options = {}) => {
if (videoRef.current !== null) { if (videoRef.current !== null) {
try { try {
videoRef.current.dispatch(action); videoRef.current.dispatch(action, {
...options,
containerElement: videoElementRef.current
});
} catch (error) { } catch (error) {
console.error('Video', error); console.error('Video', error);
} }
@ -29,7 +32,7 @@ const Video = React.forwardRef(({ className, ...props }, ref) => {
React.useImperativeHandle(ref, () => ({ dispatch }), []); React.useImperativeHandle(ref, () => ({ dispatch }), []);
React.useEffect(() => { React.useEffect(() => {
if (videoElementRef.current !== null) { if (videoElementRef.current !== null) {
videoRef.current = new StremioVideo({ containerElement: videoElementRef.current }); videoRef.current = new StremioVideo();
videoRef.current.on('ended', () => { videoRef.current.on('ended', () => {
if (typeof onEndedRef.current === 'function') { if (typeof onEndedRef.current === 'function') {
onEndedRef.current(); onEndedRef.current();