diff --git a/package.json b/package.json index 4fa7ff3b..023e8075 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,8 @@ "react-native": "0.73.2", "react-native-windows": "^0.61.0-0", "release-it": "^16.2.1", - "typescript": "5.1.6" + "typescript": "5.1.6", + "patch-package": "^8.0.0" }, "dependencies": { "shaka-player": "^4.11.7" @@ -52,7 +53,8 @@ "check-ios": "scripts/swift-format.sh && scripts/swift-lint.sh && scripts/clang-format.sh", "check-android": "scripts/kotlin-lint.sh", "check-all": "yarn check-android; yarn check-ios; yarn lint", - "codegen": "node ./node_modules/react-native/scripts/generate-codegen-artifacts.js --path ./ ./output" + "codegen": "node ./node_modules/react-native/scripts/generate-codegen-artifacts.js --path ./ ./output", + "postinstall": "patch-package" }, "files": [ "android", diff --git a/src/Video.web.tsx b/src/Video.web.tsx index 2805c4e4..22768074 100644 --- a/src/Video.web.tsx +++ b/src/Video.web.tsx @@ -6,7 +6,7 @@ import React, { useRef, type RefObject, } from 'react'; -import shaka from 'shaka-player/dist/shaka-player.ui'; +import shaka from 'shaka-player'; import type { VideoRef, ReactVideoProps, VideoMetadata } from './types'; const Video = forwardRef( @@ -52,7 +52,6 @@ const Video = forwardRef( 0, Math.min(time, shakaPlayerRef.current.seekRange().end) ); - shakaPlayerRef.current.seek(time); onSeek?.({ seekTime: time, currentTime: nativeRef.current?.currentTime || 0, @@ -224,7 +223,8 @@ const Video = forwardRef( shakaPlayerRef.current = player; // Error handling - player.addEventListener('error', (event: shaka.Event) => { + player.addEventListener('error', (event) => { + //@ts-ignore const shakaError = event.detail; console.error('Shaka Player Error', shakaError); onError?.({ @@ -236,12 +236,14 @@ const Video = forwardRef( }); // Buffering events - player.addEventListener('buffering', (event: shaka.Event) => { + player.addEventListener('buffering', (event) => { + //@ts-ignore onBuffer?.({ isBuffering: event.buffering }); }); // Load the video source player + //@ts-ignore .load(source?.uri) .then(() => { // Media loaded successfully @@ -262,8 +264,11 @@ const Video = forwardRef( duration, //@ts-ignore naturalSize, + //@ts-ignore videoTracks: player.getVariantTracks(), + //@ts-ignore audioTracks: player.getVariantTracks(), + //@ts-ignore textTracks: player.getTextTracks(), });