Hacks
This commit is contained in:
parent
3fc002f3fd
commit
6b5831dc1c
@ -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",
|
||||
|
@ -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<VideoRef, ReactVideoProps>(
|
||||
@ -52,7 +52,6 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
||||
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<VideoRef, ReactVideoProps>(
|
||||
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<VideoRef, ReactVideoProps>(
|
||||
});
|
||||
|
||||
// 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<VideoRef, ReactVideoProps>(
|
||||
duration,
|
||||
//@ts-ignore
|
||||
naturalSize,
|
||||
//@ts-ignore
|
||||
videoTracks: player.getVariantTracks(),
|
||||
//@ts-ignore
|
||||
audioTracks: player.getVariantTracks(),
|
||||
//@ts-ignore
|
||||
textTracks: player.getTextTracks(),
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user