* fix(ts): onPlaybackRateChangeData was not correctly typed * fix: ensure tracks are well displayed in the sample * chore: reorder drm props * chore: reorder events * docs: move onAudioTracks to events * docs: reorder and clean <PlatformsList from methods * docs: fix props case naming * docs: fix ordering * docs: fix ordering & remove trackId * chore: remove sample build from installation page * docs: remove outdated information * docs: remove beta information from doc landing page
2.8 KiB
Miscellaneous
iOS App Transport Security
- By default, iOS will only load encrypted (https) urls. If you want to load content from an unencrypted (http) source, you will need to modify your Info.plist file and add the following entry:
For more detailed info check this article
Audio Mixing
At some point in the future, react-native-video will include an Audio Manager for configuring how videos mix with other apps playing sounds on the device.
On iOS, if you would like to allow other apps to play music over your video component, make the following change:
AppDelegate.m
#import <AVFoundation/AVFoundation.h> // import
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil]; // allow
...
}
You can also use the ignoreSilentSwitch prop.
Android Expansion File Usage
Expansions files allow you to ship assets that exceed the 100MB apk size limit and don't need to be updated each time you push an app update.
This only supports mp4 files and they must not be compressed. Example command line for preventing compression:
zip -r -n .mp4 *.mp4 player.video.example.com
// Within your render function, assuming you have a file called
// "background.mp4" in your expansion file. Just add your main and (if applicable) patch version
<Video source={{uri: "background", mainVer: 1, patchVer: 0}} // Looks for .mp4 file (background.mp4) in the given expansion version.
resizeMode="cover" // Fill the whole screen at aspect ratio.
style={styles.backgroundVideo} />
Load files with the RN Asset System
The asset system introduced in RN 0.14
allows loading image resources shared across iOS and Android without touching native code. As of RN 0.31
the same is true of mp4 video assets for Android. As of RN 0.33
iOS is also supported. Requires react-native-video@0.9.0
.
<Video
source={require('../assets/video/turntable.mp4')}
/>
Play in background on iOS
To enable audio to play in background on iOS the audio session needs to be set to AVAudioSessionCategoryPlayback
. See [Apple documentation][3] for additional details. (NOTE: there is now a ticket to expose this as a prop )