diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 24a2055d3c..0000000000 --- a/.eslintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "@react-native-community", -} \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index b0312b3044..0000000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,19 +0,0 @@ -### Current behavior -Describe what happens when you encounter this issue. - -### Reproduction steps -A 1, 2, 3, etc. list of what's needed to see the issue happen. - -### Expected behavior -Describe what you wanted to happen - -### Platform -Which player are you experiencing the problem on: -* iOS -* Android ExoPlayer -* Android MediaPlayer -* Windows UWP -* Windows WPF - -### Video sample -If possible, include a link to the video that has the problem that can be streamed or downloaded from. diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index ac2d1e3e29..0000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - ---- - -# Bug - - - -## Platform - -Which player are you experiencing the problem on: -* iOS -* Android ExoPlayer -* Android MediaPlayer -* Windows UWP -* Windows WPF - -## Environment info - - - -React native info output: - -```bash - // paste it here -``` - -Library version: x.x.x - -## Steps To Reproduce - - - -1. -2. -... - -## Expected behaviour - -1. -2. - -## Reproducible sample code - - - -## Video sample -If possible, include a link to the video that has the problem that can be streamed or downloaded from. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index cc62df4e1d..0000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - -# Feature Request - - - -## Why it is needed - - - -## Possible implementation - - - -### Code sample - - diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5ee6f693c9..0000000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,20 +0,0 @@ -Thanks for opening a PR! -Since this is a volunteer project and is very active, anything you can do to reduce the amount of time needed to review and merge your PR is appreciated. -The following steps will help get your PR merged quickly: - -#### Update the documentation -If you've added new functionality, update the README.md with an entry for your prop or event. -The entry should be inserted in alphabetical order. - -#### Update the changelog -After you open the PR, update the CHANGELOG.md file with an entry pointing to your PR. - -#### Provide an example of how to test the change -If the PR requires special testing setup provide all the relevant instructions and files. This may include a sample video file or URL, configuration, or setup steps. - -#### Focus the PR on only one area -Testing multiple features takes longer than isolated changes and if there is a bug in one feature, prevents the other parts of your PR from getting merged until it gets fixed. -If you're touching multiple different areas that aren't related, break the changes up into multiple PRs. - -#### Describe the changes -Add a note describing what your PR does. If there is a change to the behavior of the code, explain why it needs to be updated. diff --git a/.github/actions/setup-bun/action.yml b/.github/actions/setup-bun/action.yml new file mode 100644 index 0000000000..08d9e35792 --- /dev/null +++ b/.github/actions/setup-bun/action.yml @@ -0,0 +1,33 @@ +name: setup bun +description: Setup bun and install dependencies + +inputs: + working-directory: + description: 'working directory for bun install' + default: ./ + required: false + +runs: + using: composite + steps: + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: 1.3.1 + + - name: Cache dependencies + id: bun-cache + uses: actions/cache@v4 + with: + path: | + **/node_modules + key: ${{ runner.os }}-v7-bun-${{ hashFiles('**/bun.lock') }}-${{ hashFiles('**/package.json') }} + restore-keys: | + ${{ runner.os }}-v7-bun-${{ hashFiles('**/bun.lock') }} + ${{ runner.os }}-v7-bun- + + - name: Install dependencies + working-directory: ${{ inputs.working-directory }} + run: bun install + shell: bash + \ No newline at end of file diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 0000000000..f5a6a16d8c --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -0,0 +1,51 @@ +name: Deploy Documentation + +on: + workflow_dispatch: + push: + branches: + - master + paths: + # Update on workflow change + - ".github/workflows/deploy-docs.yml" + # Update on docs change + - "docs/**" + # Update on code change (Api Reference) + - "packages/react-native-video/src/**" + +jobs: + build: + name: Build Documentation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: ./.github/actions/setup-bun + + - name: Build Documentation + run: bun run --cwd docs build + + - name: Upload Build Artifact + uses: actions/upload-pages-artifact@v3 + with: + path: docs/build + + deploy: + name: Deploy Documentation to GitHub Pages + needs: build + + permissions: + pages: write + id-token: write + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/test-docs-build.yml b/.github/workflows/test-docs-build.yml new file mode 100644 index 0000000000..eb1fce59c4 --- /dev/null +++ b/.github/workflows/test-docs-build.yml @@ -0,0 +1,27 @@ +name: Test Documentation Build + +on: + pull_request: + branches: + - master + paths: + # Update on workflow change + - ".github/workflows/test-docs-build.yml" + # Update on docs change + - "docs/**" + # Update on code change (Api Reference) + - "packages/react-native-video/src/**" + +jobs: + test-docs-deploy: + name: Test Documentation Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: ./.github/actions/setup-bun + + - name: Test build website + run: bun run --cwd docs build diff --git a/.gitignore b/.gitignore index d477ec0518..aeb971ae0e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,15 @@ # .DS_Store +**/.xcode.env.local + +# XDE +.expo/ + +# VSCode +.vscode/ +jsconfig.json + # Xcode # build/ @@ -24,25 +33,55 @@ project.xcworkspace # Android/IJ # -*.iml -.idea +.classpath +.cxx .gradle +.idea +.project +.settings local.properties -*.hprof +android.iml + +# Cocoapods +# +example/ios/Pods + +# Ruby +example/vendor/ # node.js # node_modules/ -*.log - -# yarn -yarn.lock +npm-debug.log +yarn-debug.log +yarn-error.log -# editor workspace settings -.vscode +# Bun +package-lock.json +**/*.bun # BUCK buck-out/ \.buckd/ android/app/libs android/keystores/debug.keystore + +# Yarn +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +!.yarn/versions + +# Expo +.expo/ + +# Turborepo +.turbo/ + +# generated by bob +lib/ + +# TypeScript +tsconfig.tsbuildinfo \ No newline at end of file diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 1d4c3eff7a..0000000000 --- a/.prettierrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - "requirePragma": true, - "singleQuote": true, - "trailingComma": "all", - "bracketSpacing": false, - "jsxBracketSameLine": true, - "parser": "flow" -} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 53e2518cf7..0000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,201 +0,0 @@ -## Changelog - -### Version 5.1.0-alpha9 - -- Add ARM64 support for windows [#2137](https://github.com/react-native-community/react-native-video/pull/2137) - -### Version 5.1.0-alpha8 - -- Fixing ID3 Frame Error When Receiving EventMessage in TimedMetadata [#2116](https://github.com/react-native-community/react-native-video/pull/2116) - -### Version 5.1.0-alpha7 - -- Basic support for DRM on iOS and Android [#1445](https://github.com/react-native-community/react-native-video/pull/1445) - -### Version 5.1.0-alpha6 - -- Fix iOS bug which would break size of views when video is displayed with controls on a non full-screen React view. [#1931](https://github.com/react-native-community/react-native-video/pull/1931) -- Fix video dimensions being undefined when playing HLS in ios. [#1992](https://github.com/react-native-community/react-native-video/pull/1992) -- Add support for audio mix with other apps for iOS. [#1978](https://github.com/react-native-community/react-native-video/pull/1978) -- Properly implement pending seek for iOS. [#1994](https://github.com/react-native-community/react-native-video/pull/1994) -- Added `preferredForwardBufferDuration` (iOS) - the duration the player should buffer media from the network ahead of the playhead to guard against playback disruption. (#1944) -- Added `currentPlaybackTime` (Android ExoPlayer, iOS) - when playing an HLS live stream with a `EXT-X-PROGRAM-DATE-TIME` tag configured, then this property will contain the epoch value in msec. (#1944) -- Added `trackId` (Android ExoPlayer) - Configure an identifier for the video stream to link the playback context to the events emitted. (#1944) -- Added preventsDisplaySleepDuringVideoPlayback (#2019) -- Reverted the JS fullscreening for Android. [#2013](https://github.com/react-native-community/react-native-video/pull/2013) -- Set iOS request headers without needing to edit RCTVideo.m. [#2014](https://github.com/react-native-community/react-native-video/pull/2014) -- Fix exoplayer aspect ratio update on source changes [#2053](https://github.com/react-native-community/react-native-video/pull/2053) - -### Version 5.1.0-alpha5 - -- Add support for react-native Windows Cpp/WinRT [#1893]((https://github.com/react-native-community/react-native-video/pull/1893)) - -### Version 5.1.0-alpha4 - -- Fix android play/pause bug related to full-screen mode [#1916](https://github.com/react-native-community/react-native-video/pull/1916) - -### Version 5.1.0-alpha3 - -- Improve Android Audio Focus [#1897](https://github.com/react-native-community/react-native-video/pull/1897) - -### Version 5.1.0-alpha2 - -- Added support for full-screen functionality in Android Exoplayer [#1730](https://github.com/react-native-community/react-native-video/pull/1730) - -### Version 5.1.0-alpha1 - -- Fixed Exoplayer doesn't work with mute=true (Android). [#1696](https://github.com/react-native-community/react-native-video/pull/1696) -- Added support for automaticallyWaitsToMinimizeStalling property (iOS) [#1723](https://github.com/react-native-community/react-native-video/pull/1723) -- Bump Exoplayer to 2.10.4, remove deprecated usages of Exoplayer methods (Android). [#1753](https://github.com/react-native-community/react-native-video/pull/1753) -- Preserve Exoplayer BandwidthMeter instance across video plays, this should noticeably improve streaming bandwidth detection (Android). - -### Version 5.0.2 - -- Fix crash when RCTVideo's superclass doesn't observe the keyPath 'frame' (iOS) [#1720](https://github.com/react-native-community/react-native-video/pull/1720) - -### Version 5.0.1 - -- Fix AndroidX Support bad merge - -### Version 5.0.0 [Deprecated] - -- AndroidX Support - -### Version 4.4.4 - -- Handle racing conditions when props are settled on Exoplayer - -### Version 4.4.3 - -- Fix mute/unmute when controls are present (iOS) [#1654](https://github.com/react-native-community/react-native-video/pull/1654) -- Fix Android videos being able to play with background music/audio from other apps. -- Fixed memory leak on iOS when using `controls` [#1647](https://github.com/react-native-community/react-native-video/pull/1647) -- (Android) Update gradle and target SDK [#1629](https://github.com/react-native-community/react-native-video/pull/1629) -- Fix iOS stressed mount/unmount crash [#1646](https://github.com/react-native-community/react-native-video/pull/1646) - -### Version 4.4.2 - -- Change compileOnly to implementation on gradle (for newer gradle versions and react-native 0.59 support) [#1592](https://github.com/react-native-community/react-native-video/pull/1592) -- Replaced RCTBubblingEventBlock events by RCTDirectEventBlock to avoid event name collisions [#1625](https://github.com/react-native-community/react-native-video/pull/1625) -- Added `onPlaybackRateChange` to README [#1578](https://github.com/react-native-community/react-native-video/pull/1578) -- Added `onReadyForDisplay` to README [#1627](https://github.com/react-native-community/react-native-video/pull/1627) -- Improved handling of poster image. Fixes bug with displaying video and poster simultaneously. [#1627](https://github.com/react-native-community/react-native-video/pull/1627) -- Fix background audio stopping on iOS when using `controls` [#1614](https://github.com/react-native-community/react-native-video/pull/1614) - -### Version 4.4.1 - -- Fix tvOS picture-in-picture compilation regression [#1518](https://github.com/react-native-community/react-native-video/pull/1518) -- fullscreen rotation issues with iOS built-in controls [#1441](https://github.com/react-native-community/react-native-video/pull/1441) -- Fix player freeze when playing audio files on ExoPlayer [#1529](https://github.com/react-native-community/react-native-video/pull/1529) - -### Version 4.4.0 - -- Fix runtime warning by replacing `UIManager.RCTVideo` with `UIManager.getViewManagerConfig('RCTVideo')` (and ensuring backwards compat) [#1487](https://github.com/react-native-community/react-native-video/pull/1487) -- Fix loading package resolved videos when using video-caching [#1438](https://github.com/react-native-community/react-native-video/pull/1438) -- Fix "message sent to deallocated instance" crash on ios [#1482](https://github.com/react-native-community/react-native-video/pull/1482) -- Display a warning when source is empty [#1478](https://github.com/react-native-community/react-native-video/pull/1478) -- Don't crash on iOS for an empty source [#1246](https://github.com/react-native-community/react-native-video/pull/1246) -- Recover from from transient internet failures when loading on ExoPlayer [#1448](https://github.com/react-native-community/react-native-video/pull/1448) -- Add controls support for ExoPlayer [#1414](https://github.com/react-native-community/react-native-video/pull/1414) -- Fix check for text tracks when iOS caching enabled [#1387](https://github.com/react-native-community/react-native-video/pull/1387) -- Add support for Picture in Picture on iOS [#1325](https://github.com/react-native-community/react-native-video/pull/1325) -- Fix UIManager undefined variable [#1488](https://github.com/react-native-community/react-native-video/pull/1488) - -### Version 4.3.0 - -- Fix iOS video not displaying after switching source [#1395](https://github.com/react-native-community/react-native-video/pull/1395) -- Add the filterEnabled flag, fixes iOS video start time regression [#1384](https://github.com/react-native-community/react-native-video/pull/1384) -- Fix text not appearing in release builds of Android apps [#1373](https://github.com/react-native-community/react-native-video/pull/1373) -- Update to ExoPlayer 2.9.3 [#1406](https://github.com/react-native-community/react-native-video/pull/1406) -- Add video track selection & onBandwidthUpdate [#1199](https://github.com/react-native-community/react-native-video/pull/1199) -- Recovery from transient internet failures and props to configure the custom retry count [#1448](https://github.com/react-native-community/react-native-video/pull/1448) - -### Version 4.2.0 - -- Don't initialize filters on iOS unless a filter is set. This was causing a startup performance regression [#1360](https://github.com/react-native-community/react-native-video/pull/1360) -- Support setting the maxBitRate [#1310](https://github.com/react-native-community/react-native-video/pull/1310) -- Fix useTextureView not defaulting to true [#1383](https://github.com/react-native-community/react-native-video/pull/1383) -- Fix crash on MediaPlayer w/ Android 4.4 & avoid memory leak [#1328](https://github.com/react-native-community/react-native-video/pull/1328) - -### Version 4.1.0 - -- Generate onSeek on Android ExoPlayer & MediaPlayer after seek completes [#1351](https://github.com/react-native-community/react-native-video/pull/1351) -- Remove unneeded onVideoSaved event [#1350](https://github.com/react-native-community/react-native-video/pull/1350) -- Disable AirPlay if sidecar text tracks are enabled [#1304](https://github.com/react-native-community/react-native-video/pull/1304) -- Add possibility to remove black screen while video is loading in Exoplayer [#1355](https://github.com/react-native-community/react-native-video/pull/1355) - -### Version 4.0.1 - -- Add missing files to package.json [#1342](https://github.com/react-native-community/react-native-video/pull/1342) - -### Version 4.0.0 - -- Partial support for timed metadata on Android MediaPlayer [#707](https://github.com/react-native-community/react-native-video/pull/707) -- Support video caching for iOS [#955](https://github.com/react-native-community/react-native-video/pull/955) -- Video caching cleanups [#1172](https://github.com/react-native-community/react-native-video/pull/1172) -- Add ipod-library support [#926](https://github.com/react-native-community/react-native-video/pull/926/files) -- Fix crash on ExoPlayer when there are no audio tracks [#1233](https://github.com/react-native-community/react-native-video/pull/1233) -- Reduce package size [#1231](https://github.com/react-native-community/react-native-video/pull/1231) -- Remove unnecessary import in TextTrackType [#1229](https://github.com/react-native-community/react-native-video/pull/1229) -- Prevent flash between poster and video [#1167](https://github.com/react-native-community/react-native-video/pull/1167) -- Support react-native-dom [#1253](https://github.com/react-native-community/react-native-video/pull/1253) -- Update to ExoPlayer 2.8.2. Android SDK 26 now required [#1170](https://github.com/react-native-community/react-native-video/pull/1170) -- Update to ExoPlayer 2.8.4 [#1266](https://github.com/react-native-community/react-native-video/pull/1266) -- Add fullscreenOrientation option for iOS [#1215](https://github.com/react-native-community/react-native-video/pull/1215) -- Update to ExoPlayer 2.9.0 [#1285](https://github.com/react-native-community/react-native-video/pull/1285) -- Switch useTextureView to default to `true` [#1286](https://github.com/react-native-community/react-native-video/pull/1286) -- Re-add fullscreenAutorotate prop [#1303](https://github.com/react-native-community/react-native-video/pull/1303) -- Make seek throw a useful error for NaN values [#1283](https://github.com/react-native-community/react-native-video/pull/1283) -- Video Filters and Save Video [#1306](https://github.com/react-native-community/react-native-video/pull/1306) -- Fix: volume should not change on onAudioFocusChange event [#1327](https://github.com/react-native-community/react-native-video/pull/1327) -- Update ExoPlayer to 2.9.1 and OkHTTP to 3.12.0 [#1338](https://github.com/react-native-community/react-native-video/pull/1338) - -### Version 3.2.0 - -- Basic fullscreen support for Android MediaPlayer [#1138](https://github.com/react-native-community/react-native-video/pull/1138) -- Simplify default Android SDK code [#1145](https://github.com/react-native-community/react-native-video/pull/1145) [#1146](https://github.com/react-native-community/react-native-video/pull/1146) -- Various iOS sideloaded text track fixes [#1157](https://github.com/react-native-community/react-native-video/pull/1157) -- Fix #1150 where assets with bundled assets don't work on iOS in release mode [#1162](https://github.com/react-native-community/react-native-video/pull/1162) -- Support configuring the buffer on Android ExoPlayer [#1160](https://github.com/react-native-community/react-native-video/pull/1160) -- Prevent sleep from sleeping while videos are playing on Android MediaPlayer [#1117](https://github.com/react-native-community/react-native-video/pull/1117) -- Update NewtonSoft JSON to match react-native-windows version [#1169](https://github.com/react-native-community/react-native-video/pull/1169) - -### Version 3.1.0 - -- Support sidecar text tracks on iOS [#1109](https://github.com/react-native-community/react-native-video/pull/1109) -- Support onAudioBecomingNoisy on iOS [#1131](https://github.com/react-native-community/react-native-video/pull/1131) - -### Version 3.0 - -- Inherit Android buildtools and SDK version from the root project [#1081](https://github.com/react-native-community/react-native-video/pull/1081) -- Automatically play on ExoPlayer when the paused prop is not set [#1083](https://github.com/react-native-community/react-native-video/pull/1083) -- Preserve Android MediaPlayer paused prop when backgrounding [#1082](https://github.com/react-native-community/react-native-video/pull/1082) -- Support specifying headers on ExoPlayer as part of the source [#805](https://github.com/react-native-community/react-native-video/pull/805) -- Prevent iOS onLoad event during seeking [#1088](https://github.com/react-native-community/react-native-video/pull/1088) -- ExoPlayer playableDuration incorrect [#1089](https://github.com/react-native-community/react-native-video/pull/1089) - -### Version 2.3.1 - -- Revert PR to inherit Android SDK versions from root project. Re-add in 3.0 [#1080](https://github.com/react-native-community/react-native-video/pull/1080) - -### Version 2.3.0 - -- Support allowsExternalPlayback on iOS [#1057](https://github.com/react-native-community/react-native-video/pull/1057) -- Inherit Android buildtools and SDK version from the root project [#999](https://github.com/react-native-community/react-native-video/pull/999) -- Fix bug that caused ExoPlayer to start paused if playInBackground was set [#833](https://github.com/react-native-community/react-native-video/pull/833) -- Fix crash if clearing an observer on iOS that was already cleared [#1075](https://github.com/react-native-community/react-native-video/pull/1075) -- Add audioOnly prop for music files [#1039](https://github.com/react-native-community/react-native-video/pull/1039) -- Support seeking with more exact tolerance on iOS [#1076](https://github.com/react-native-community/react-native-video/pull/1076) - -### Version 2.2.0 - -- Text track selection support for iOS & ExoPlayer [#1049](https://github.com/react-native-community/react-native-video/pull/1049) -- Support outputting to a TextureView on Android ExoPlayer [#1058](https://github.com/react-native-community/react-native-video/pull/1058) -- Support changing the left/right balance on Android MediaPlayer [#1051](https://github.com/react-native-community/react-native-video/pull/1051) -- Prevent multiple onEnd notifications on iOS [#832](https://github.com/react-native-community/react-native-video/pull/832) -- Fix doing a partial swipe on iOS causing a black screen [#1048](https://github.com/react-native-community/react-native-video/pull/1048) -- Fix crash when switching to a new source on iOS [#974](https://github.com/react-native-community/react-native-video/pull/974) -- Add cookie support for ExoPlayer [#922](https://github.com/react-native-community/react-native-video/pull/922) -- Remove ExoPlayer onMetadata that wasn't being used [#1040](https://github.com/react-native-community/react-native-video/pull/1040) -- Fix bug where setting the progress interval on iOS didn't work [#800](https://github.com/react-native-community/react-native-video/pull/800) -- Support setting the poster resize mode [#595](https://github.com/react-native-community/react-native-video/pull/595) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000..45d257b29a --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,133 @@ + +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or advances of + any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email address, + without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +[INSERT CONTACT METHOD]. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at +[https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..015cc1b098 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,119 @@ +# Contributing + +Contributions are always welcome, no matter how large or small! + +We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. Before contributing, please read the [code of conduct](./CODE_OF_CONDUCT.md). + +## Development workflow + +This project is a monorepo managed using [Bun workspaces](https://bun.sh/docs/install/workspaces). It contains the following packages: + +- An Library package in the `packages/react-native-video` directory. +- An example app in the `example/` directory. + +To get started with the project, run `bun install` in the root directory to install the required dependencies for each package: + +```sh +bun install +``` + +> Since the project relies on Bun workspaces, you cannot use [`npm`](https://github.com/npm/cli) or [`yarn`](https://yarnpkg.com/) for development. + +The [example app](/example/) demonstrates usage of the library. You need to run it to test any changes you make. + +It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app. + +If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/VideoExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-video`. + +To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `react-native-video` under `Android`. + +You can use various commands from the root directory to work with the project. + +To start the packager: + +```sh +bun example start +``` + +To run the example app on Android: + +```sh +bun example android +``` + +To run the example app on iOS: + +```sh +bun example ios +``` + +Make sure your code passes TypeScript and ESLint. Run the following to verify: + +```sh +bun typecheck +bun lint +``` + +To fix formatting errors, run the following: + +```sh +bun lint --fix +``` + +### Commit message convention + +We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages: + +- `fix`: bug fixes, e.g. fix crash due to deprecated method. +- `feat`: new features, e.g. add new method to the module. +- `refactor`: code refactor, e.g. migrate from class components to hooks. +- `docs`: changes into documentation, e.g. add usage example for the module.. +- `test`: adding or updating tests, e.g. add integration tests using detox. +- `chore`: tooling changes, e.g. change CI config. + +Our pre-commit hooks verify that your commit message matches this format when committing. + +### Linting and tests + +[ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/) + +We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing. + +Our pre-commit hooks verify that the linter and tests pass when committing. + +### Publishing to npm + +We use [release-it](https://github.com/release-it/release-it) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc. + +To publish new versions, run the following: + +```sh +bun release +``` + +### Scripts + +The `package.json` file contains various scripts for common tasks: + +- `bun install`: setup project by installing dependencies. +- `bun typecheck`: type-check files with TypeScript. +- `bun lint`: lint files with ESLint. +- `bun example start`: start the Metro server for the example app. +- `bun example android`: run the example app on Android. +- `bun example ios`: run the example app on iOS. + +### Sending a pull request + +> **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github). + +When you're sending a pull request: + +- Prefer small pull requests focused on one change. +- Verify that linters and tests are passing. +- Review the documentation to make sure it looks good. +- Follow the pull request template when opening a pull request. +- For pull requests that change the API or implementation, discuss with maintainers first by opening an issue. + +### License + +By contributing to this project, you agree that your contributions will be licensed under the [MIT License](LICENSE). diff --git a/DRM.md b/DRM.md deleted file mode 100644 index d0ce88bf22..0000000000 --- a/DRM.md +++ /dev/null @@ -1,139 +0,0 @@ -# DRM - -## Provide DRM data (only tested with http/https assets) - -You can provide some configuration to allow DRM playback. -This feature will disable the use of `TextureView` on Android. - -DRM object allows this members: - -| Property | Type | Default | Platform | Description | -| --- | --- | --- | --- | --- | -| [`type`](#type) | DRMType | undefined | iOS/Android | Specifies which type of DRM you are going to use, DRMType is an enum exposed on the JS module ('fairplay', 'playready', ...) | -| [`licenseServer`](#licenseserver) | string | undefined | iOS/Android | Specifies the license server URL | -| [`headers`](#headers) | Object | undefined | iOS/Android | Specifies the headers send to the license server URL on license acquisition | -| [`contentId`](#contentid) | string | undefined | iOS | Specify the content id of the stream, otherwise it will take the host value from `loadingRequest.request.URL.host` (f.e: `skd://testAsset` -> will take `testAsset`) | -| [`certificateUrl`](#certificateurl) | string | undefined | iOS | Specifies the url to obtain your ios certificate for fairplay, Url to the .cer file | -| [`base64Certificate`](#base64certificate) | bool | false | iOS | Specifies whether or not the certificate returned by the `certificateUrl` is on base64 | -| [`getLicense`](#getlicense)| function | undefined | iOS | Rather than setting the `licenseServer` url to get the license, you can manually get the license on the JS part, and send the result to the native part to configure FairplayDRM for the stream | - -### `base64Certificate` - -Whether or not the certificate url returns it on base64. - -Platforms: iOS - -### `certificateUrl` - -URL to fetch a valid certificate for FairPlay. - -Platforms: iOS - -### `getLicense` - -`licenseServer` and `headers` will be ignored. You will obtain as argument the `SPC` (as ASCII string, you will probably need to convert it to base 64) obtained from your `contentId` + the provided certificate via `[loadingRequest streamingContentKeyRequestDataForApp:certificateData contentIdentifier:contentIdData options:nil error:&spcError];`. - You should return on this method a `CKC` in Base64, either by just returning it or returning a `Promise` that resolves with the `CKC`. - -With this prop you can override the license acquisition flow, as an example: - -```js -getLicense: (spcString) => { - const base64spc = Base64.encode(spcString); - const formData = new FormData(); - formData.append('spc', base64spc); - return fetch(`https://license.pallycon.com/ri/licenseManager.do`, { - method: 'POST', - headers: { - 'pallycon-customdata-v2': 'd2VpcmRiYXNlNjRzdHJpbmcgOlAgRGFuaWVsIE1hcmnxbyB3YXMgaGVyZQ==', - 'Content-Type': 'application/x-www-form-urlencoded', - }, - body: formData - }).then(response => response.text()).then((response) => { - return response; - }).catch((error) => { - console.error('Error', error); - }); -} -``` - -Platforms: iOS - -### `headers` - -You can customize headers send to the licenseServer. - -Example: - -```js -source={{ - uri: 'https://media.axprod.net/TestVectors/v7-MultiDRM-SingleKey/Manifest_1080p.mpd', -}} -drm={{ - type: DRMType.WIDEVINE, - licenseServer: 'https://drm-widevine-licensing.axtest.net/AcquireLicense', - headers: { - 'X-AxDRM-Message': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uIjoxLCJjb21fa2V5X2lkIjoiYjMzNjRlYjUtNTFmNi00YWUzLThjOTgtMzNjZWQ1ZTMxYzc4IiwibWVzc2FnZSI6eyJ0eXBlIjoiZW50aXRsZW1lbnRfbWVzc2FnZSIsImZpcnN0X3BsYXlfZXhwaXJhdGlvbiI6NjAsInBsYXlyZWFkeSI6eyJyZWFsX3RpbWVfZXhwaXJhdGlvbiI6dHJ1ZX0sImtleXMiOlt7ImlkIjoiOWViNDA1MGQtZTQ0Yi00ODAyLTkzMmUtMjdkNzUwODNlMjY2IiwiZW5jcnlwdGVkX2tleSI6ImxLM09qSExZVzI0Y3Iya3RSNzRmbnc9PSJ9XX19.FAbIiPxX8BHi9RwfzD7Yn-wugU19ghrkBFKsaCPrZmU' - }, -}} -``` - -### `licenseServer` - -The URL pointing to the licenseServer that will provide the authorization to play the protected stream. - -### `type` - -You can specify the DRM type, either by string or using the exported DRMType enum. -Valid values are, for Android: DRMType.WIDEVINE / DRMType.PLAYREADY / DRMType.CLEARKEY. -for iOS: DRMType.FAIRPLAY - -## Common Usage Scenarios - -### Send cookies to license server - -You can send Cookies to the license server via `headers` prop. Example: - -```js -drm: { - type: DRMType.WIDEVINE - licenseServer: 'https://drm-widevine-licensing.axtest.net/AcquireLicense', - headers: { - 'Cookie': 'PHPSESSID=etcetc; csrftoken=mytoken; _gat=1; foo=bar' - }, -} -``` - -### Custom License Acquisition (only iOS for now) - -```js -drm: { - type: DRMType.FAIRPLAY, - getLicense: (spcString) => { - const base64spc = Base64.encode(spcString); - return fetch('YOUR LICENSE SERVER HERE', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - }, - body: JSON.stringify({ - getFairplayLicense: { - foo: 'bar', - spcMessage: base64spc, - } - }) - }) - .then(response => response.json()) - .then((response) => { - if (response && response.getFairplayLicenseResponse - && response.getFairplayLicenseResponse.ckcResponse) { - return response.getFairplayLicenseResponse.ckcResponse; - } - throw new Error('No correct response'); - }) - .catch((error) => { - console.error('CKC error', error); - }); - } -} -``` diff --git a/DRMType.js b/DRMType.js deleted file mode 100644 index 473536b249..0000000000 --- a/DRMType.js +++ /dev/null @@ -1,6 +0,0 @@ -export default { - WIDEVINE: 'widevine', - PLAYREADY: 'playready', - CLEARKEY: 'clearkey', - FAIRPLAY: 'fairplay' -}; diff --git a/FilterType.js b/FilterType.js deleted file mode 100644 index 3d8d9cb40c..0000000000 --- a/FilterType.js +++ /dev/null @@ -1,18 +0,0 @@ -export default { - NONE: '', - INVERT: 'CIColorInvert', - MONOCHROME: 'CIColorMonochrome', - POSTERIZE: 'CIColorPosterize', - FALSE: 'CIFalseColor', - MAXIMUMCOMPONENT: 'CIMaximumComponent', - MINIMUMCOMPONENT: 'CIMinimumComponent', - CHROME: 'CIPhotoEffectChrome', - FADE: 'CIPhotoEffectFade', - INSTANT: 'CIPhotoEffectInstant', - MONO: 'CIPhotoEffectMono', - NOIR: 'CIPhotoEffectNoir', - PROCESS: 'CIPhotoEffectProcess', - TONAL: 'CIPhotoEffectTonal', - TRANSFER: 'CIPhotoEffectTransfer', - SEPIA: 'CISepiaTone', -}; diff --git a/LICENSE b/LICENSE index dc7f43c835..329884bbfc 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,6 @@ MIT License -Copyright (c) 2016 Brent Vatne, Baris Sencan - +Copyright (c) 2024-2025 TheWidlarzGroup Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights diff --git a/README.md b/README.md index 1b6a913ec3..a5a95882a3 100644 --- a/README.md +++ b/README.md @@ -1,1468 +1,162 @@ -## react-native-video +[![React Native Video Component](./docs/static/baners/rnv-banner.png)](https://thewidlarzgroup.com/?utm_source=rnv&utm_medium=readme&utm_id=banner) -A `