From 047d74de38346fe252f27a0f6ca8037039f62435 Mon Sep 17 00:00:00 2001 From: Krzysztof Moch Date: Wed, 16 Apr 2025 22:28:25 +0200 Subject: [PATCH] feat: add more basic functionality (#5) --- .../VideoExample.xcodeproj/project.pbxproj | 18 ++-- example/src/App.tsx | 10 +- .../hybrids/videoplayer/HybridVideoPlayer.kt | 49 +++++++++- .../ios/core/VideoPlayerObserver.swift | 91 ++++++++++++++++++ .../VideoPlayer/HybridVideoPlayer.swift | 94 +++++++++++++++++-- .../android/c++/JHybridVideoPlayerSpec.cpp | 35 +++++++ .../android/c++/JHybridVideoPlayerSpec.hpp | 8 ++ .../nitro/video/HybridVideoPlayerSpec.kt | 26 +++++ .../ios/c++/HybridVideoPlayerSpecSwift.hpp | 30 ++++++ .../ios/swift/HybridVideoPlayerSpec.swift | 5 + .../ios/swift/HybridVideoPlayerSpec_cxx.swift | 55 +++++++++++ .../shared/c++/HybridVideoPlayerSpec.cpp | 9 ++ .../shared/c++/HybridVideoPlayerSpec.hpp | 8 ++ .../src/core/VideoPlayer.ts | 64 ++++++++++++- .../src/core/types/VideoPlayerBase.ts | 33 +++++++ 15 files changed, 506 insertions(+), 29 deletions(-) create mode 100644 packages/react-native-video/ios/core/VideoPlayerObserver.swift diff --git a/example/ios/VideoExample.xcodeproj/project.pbxproj b/example/ios/VideoExample.xcodeproj/project.pbxproj index 7f82a841..2011cd26 100644 --- a/example/ios/VideoExample.xcodeproj/project.pbxproj +++ b/example/ios/VideoExample.xcodeproj/project.pbxproj @@ -263,14 +263,10 @@ inputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-VideoExample/Pods-VideoExample-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); - inputPaths = ( - ); name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-VideoExample/Pods-VideoExample-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); - outputPaths = ( - ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-VideoExample/Pods-VideoExample-frameworks.sh\"\n"; @@ -306,14 +302,10 @@ inputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-VideoExample/Pods-VideoExample-resources-${CONFIGURATION}-input-files.xcfilelist", ); - inputPaths = ( - ); name = "[CP] Copy Pods Resources"; outputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-VideoExample/Pods-VideoExample-resources-${CONFIGURATION}-output-files.xcfilelist", ); - outputPaths = ( - ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-VideoExample/Pods-VideoExample-resources.sh\"\n"; @@ -523,7 +515,10 @@ "-DFOLLY_CFG_NO_COROUTINES=1", "-DFOLLY_HAVE_CLOCK_GETTIME=1", ); - OTHER_LDFLAGS = "$(inherited) "; + OTHER_LDFLAGS = ( + "$(inherited)", + " ", + ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../../node_modules/react-native"; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG"; @@ -592,7 +587,10 @@ "-DFOLLY_CFG_NO_COROUTINES=1", "-DFOLLY_HAVE_CLOCK_GETTIME=1", ); - OTHER_LDFLAGS = "$(inherited) "; + OTHER_LDFLAGS = ( + "$(inherited)", + " ", + ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../../node_modules/react-native"; SDKROOT = iphoneos; USE_HERMES = true; diff --git a/example/src/App.tsx b/example/src/App.tsx index 54e33752..9c878691 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -12,7 +12,12 @@ import { VideoView, createSource, useVideoPlayer } from 'react-native-video'; const VideoDemo = () => { const [show, setShow] = React.useState(false); - const player = useVideoPlayer('https://www.w3schools.com/html/mov_bbb.mp4'); + const player = useVideoPlayer( + 'https://www.w3schools.com/html/mov_bbb.mp4', + (_player) => { + _player.loop = true; + } + ); return ( @@ -27,7 +32,8 @@ const VideoDemo = () => {