{"id":21401420,"url":"https://github.com/spoonx/rn-video","last_synced_at":"2026-07-23T01:31:56.947Z","repository":{"id":143906763,"uuid":"98512271","full_name":"SpoonX/rn-video","owner":"SpoonX","description":"A \u003cVideo /\u003e component for react-native","archived":false,"fork":false,"pushed_at":"2017-07-27T08:43:21.000Z","size":9964,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-06T04:38:34.465Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SpoonX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-07-27T08:26:42.000Z","updated_at":"2018-05-11T12:20:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"ed367058-5e2a-4834-90a5-3ef652286d77","html_url":"https://github.com/SpoonX/rn-video","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SpoonX/rn-video","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Frn-video","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Frn-video/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Frn-video/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Frn-video/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SpoonX","download_url":"https://codeload.github.com/SpoonX/rn-video/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Frn-video/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35784494,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-22T02:00:06.236Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T15:27:41.187Z","updated_at":"2026-07-23T01:31:56.939Z","avatar_url":"https://github.com/SpoonX.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## rn-video\n\n\u003e This is a fork from https://github.com/react-native-community/react-native-video\n\nA `\u003cVideo\u003e` component for react-native, as seen in\n[react-native-login](https://github.com/brentvatne/react-native-login)!\n\nRequires react-native \u003e= 0.40.0.\n\n### Add it to your project\n\nRun `npm i -S rn-video`\n\n#### iOS\n\nRun `react-native link` to link the rn-video library.\n\nIf you would like to allow other apps to play music over your video component, add:\n\n**AppDelegate.m**\n\n```objective-c\n#import \u003cAVFoundation/AVFoundation.h\u003e  // import\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n{\n  ...\n  [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil];  // allow\n  ...\n}\n```\nNote: you can also use the `ignoreSilentSwitch` prop, shown below.\n\n#### tvOS\n\nRun `react-native link` to link the rn-video library.\n\n`react-native link` don’t works properly with the tvOS target so we need to add the library manually.\n\nFirst select your project in Xcode.\n\n\u003cimg src=\"./docs/tvOS-step-1.jpg\" width=\"40%\"\u003e\n\nAfter that, select the tvOS target of your application and select « General » tab\n\n\u003cimg src=\"./docs/tvOS-step-2.jpg\" width=\"40%\"\u003e\n\nScroll to « Linked Frameworks and Libraries » and tap on the + button\n\n\u003cimg src=\"./docs/tvOS-step-3.jpg\" width=\"40%\"\u003e\n\nSelect RCTVideo-tvOS\n\n\u003cimg src=\"./docs/tvOS-step-4.jpg\" width=\"40%\"\u003e\n\nThat’s all, you can use rn-video for your tvOS application\n\n#### Android\n\nRun `react-native link` to link the rn-video library.\n\nOr if you have trouble, make the following additions to the given files manually:\n\n**android/settings.gradle**\n\n```gradle\ninclude ':rn-video'\nproject(':rn-video').projectDir = new File(rootProject.projectDir, '../node_modules/rn-video/android')\n```\n\n**android/app/build.gradle**\n\n```gradle\ndependencies {\n   ...\n   compile project(':rn-video')\n}\n```\n\n**MainApplication.java**\n\nOn top, where imports are:\n\n```java\nimport com.brentvatne.react.ReactVideoPackage;\n```\n\nAdd the `ReactVideoPackage` class to your list of exported packages.\n\n```java\n@Override\nprotected List\u003cReactPackage\u003e getPackages() {\n    return Arrays.asList(\n            new MainReactPackage(),\n            new ReactVideoPackage()\n    );\n}\n```\n\n#### Windows\n\nMake the following additions to the given files manually:\n\n**windows/myapp.sln**\n\nAdd the `ReactNativeVideo` project to your solution.\n\n1. Open the solution in Visual Studio 2015\n2. Right-click Solution icon in Solution Explorer \u003e Add \u003e Existing Project...\n3.\n  UWP: Select `node_modules\\rn-video\\windows\\ReactNativeVideo\\ReactNativeVideo.csproj`\n  WPF: Select `node_modules\\rn-video\\windows\\ReactNativeVideo.Net46\\ReactNativeVideo.Net46.csproj`\n\n**windows/myapp/myapp.csproj**\n\nAdd a reference to `ReactNativeVideo` to your main application project. From Visual Studio 2015:\n\n1. Right-click main application project \u003e Add \u003e Reference...\n2.\n  UWP: Check `ReactNativeVideo` from Solution Projects.\n  WPF: Check `ReactNativeVideo.Net46` from Solution Projects.\n\n**MainPage.cs**\n\nAdd the `ReactVideoPackage` class to your list of exported packages.\n```cs\nusing ReactNative;\nusing ReactNative.Modules.Core;\nusing ReactNative.Shell;\nusing ReactNativeVideo; // \u003c-- Add this\nusing System.Collections.Generic;\n...\n\n        public override List\u003cIReactPackage\u003e Packages\n        {\n            get\n            {\n                return new List\u003cIReactPackage\u003e\n                {\n                    new MainReactPackage(),\n                    new ReactVideoPackage(), // \u003c-- Add this\n                };\n            }\n        }\n\n...\n```\n\n## Usage\n\n```javascript\n// Within your render function, assuming you have a file called\n// \"background.mp4\" in your project. You can include multiple videos\n// on a single screen if you like.\n\n\u003cVideo source={{uri: \"background\"}}   // Can be a URL or a local file.\n       ref={(ref) =\u003e {\n         this.player = ref\n       }}                                      // Store reference\n       rate={1.0}                              // 0 is paused, 1 is normal.\n       volume={1.0}                            // 0 is muted, 1 is normal.\n       muted={false}                           // Mutes the audio entirely.\n       paused={false}                          // Pauses playback entirely.\n       resizeMode=\"cover\"                      // Fill the whole screen at aspect ratio.*\n       repeat={true}                           // Repeat forever.\n       playInBackground={false}                // Audio continues to play when app entering background.\n       playWhenInactive={false}                // [iOS] Video continues to play when control or notification center are shown.\n       ignoreSilentSwitch={\"ignore\"}           // [iOS] ignore | obey - When 'ignore', audio will still play with the iOS hard silent switch set to silent. When 'obey', audio will toggle with the switch. When not specified, will inherit audio settings as usual.\n       progressUpdateInterval={250.0}          // [iOS] Interval to fire onProgress (default to ~250ms)\n       onLoadStart={this.loadStart}            // Callback when video starts to load\n       onLoad={this.setDuration}               // Callback when video loads\n       onProgress={this.setTime}               // Callback every ~250ms with currentTime\n       onEnd={this.onEnd}                      // Callback when playback finishes\n       onError={this.videoError}               // Callback when video cannot be loaded\n       onBuffer={this.onBuffer}                // Callback when remote video is buffering\n       onTimedMetadata={this.onTimedMetadata}  // Callback when the stream receive some metadata\n       style={styles.backgroundVideo} /\u003e\n\n// Later to trigger fullscreen\nthis.player.presentFullscreenPlayer()\n\n// To set video position in seconds (seek)\nthis.player.seek(0)\n\n// Later on in your styles..\nvar styles = StyleSheet.create({\n  backgroundVideo: {\n    position: 'absolute',\n    top: 0,\n    left: 0,\n    bottom: 0,\n    right: 0,\n  },\n});\n```\n\n- * *For iOS you also need to specify muted for this to work*\n\n## Android Expansion File Usage\n\n```javascript\n// Within your render function, assuming you have a file called\n// \"background.mp4\" in your expansion file. Just add your main and (if applicable) patch version\n\u003cVideo source={{uri: \"background\", mainVer: 1, patchVer: 0}} // Looks for .mp4 file (background.mp4) in the given expansion version.\n       rate={1.0}                   // 0 is paused, 1 is normal.\n       volume={1.0}                 // 0 is muted, 1 is normal.\n       muted={false}                // Mutes the audio entirely.\n       paused={false}               // Pauses playback entirely.\n       resizeMode=\"cover\"           // Fill the whole screen at aspect ratio.\n       repeat={true}                // Repeat forever.\n       onLoadStart={this.loadStart} // Callback when video starts to load\n       onLoad={this.setDuration}    // Callback when video loads\n       onProgress={this.setTime}    // Callback every ~250ms with currentTime\n       onEnd={this.onEnd}           // Callback when playback finishes\n       onError={this.videoError}    // Callback when video cannot be loaded\n       style={styles.backgroundVideo} /\u003e\n\n// Later on in your styles..\nvar styles = Stylesheet.create({\n  backgroundVideo: {\n    position: 'absolute',\n    top: 0,\n    left: 0,\n    bottom: 0,\n    right: 0,\n  },\n});\n```\n\n### Load files with the RN Asset System\n\nThe asset system [introduced in RN `0.14`](http://www.reactnative.com/react-native-v0-14-0-released/) allows loading image resources shared across iOS and Android without touching native code. As of RN `0.31` [the same is true](https://github.com/facebook/react-native/commit/91ff6868a554c4930fd5fda6ba8044dbd56c8374) of mp4 video assets for Android. As of [RN `0.33`](https://github.com/facebook/react-native/releases/tag/v0.33.0) iOS is also supported.\n\n```\n\u003cVideo\n  repeat\n  resizeMode='cover'\n  source={require('../assets/video/turntable.mp4')}\n  style={styles.backgroundVideo}\n/\u003e\n```\n\n## Static Methods\n\n`seek(seconds)`\n\nSeeks the video to the specified time (in seconds). Access using a ref to the component\n\n`presentFullscreenPlayer()`\n\nToggles a fullscreen player. Access using a ref to the component.\n\n## Examples\n\n- See an [Example integration][1] in `react-native-login` *note that this example uses an older version of this library, before we used `export default` -- if you use `require` you will need to do `require('rn-video').default` as per instructions above.*\n- Try the included [VideoPlayer example][2] yourself:\n\n   ```sh\n   git clone git@github.com:spoonx/rn-video.git\n   cd rn-video/example\n   npm install\n   open ios/VideoPlayer.xcodeproj\n\n   ```\n\n   Then `Cmd+R` to start the React Packager, build and run the project in the simulator.\n\n- [Lumpen Radio](https://github.com/jhabdas/lumpen-radio) contains another example integration using local files and full screen background video.\n\n## TODOS\n\n- [ ] Add support for captions\n- [ ] Add support for playing multiple videos in a sequence (will interfere with current `repeat` implementation)\n- [x] Callback to get buffering progress for remote videos\n- [ ] Bring API closer to HTML5 `\u003cVideo\u003e` [reference](http://devdocs.io/html/element/video)\n\n[1]: https://github.com/brentvatne/react-native-login/blob/56c47a5d1e23781e86e19b27e10427fd6391f666/App/Screens/UserInfoScreen.js#L32-L35\n[2]: https://github.com/spoonx/rn-video/tree/master/example\n[3]: https://developer.apple.com/library/ios/qa/qa1668/_index.html\n\n---\n\n**MIT Licensed**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspoonx%2Frn-video","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspoonx%2Frn-video","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspoonx%2Frn-video/lists"}