Commit 8a3b6490 authored by Nicolas Gonzalez's avatar Nicolas Gonzalez
Browse files

Updated save function README, updated video-caching example to test saving function

parent dd1c6867
Loading
Loading
Loading
Loading
+4 −2
Changes for README.md: 4 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -913,15 +913,17 @@ let path = response.uri;
Notes:
 - Currently only supports highest quality export
 - Currently only supports MP4 export
 - Currently only supports exporting to user's cache directory with the file name "Filter.mp4"
 - Currently only supports exporting to user's cache directory with a generated UUID filename. 
 - User will need to remove the saved video through their Photos app
 - Works with cached videos as well. (Checkout video-caching example)
 - If the video is has not began buffering (e.g. there is no internet connection) then the save function will throw an error.
 - If the video is buffering then the save function promise will return after the video has finished buffering and processing.
 
Future: 
 - Will support multiple qualities through options
 - Will support more formats in the future through options
 - Will support custom directory and file name through options
 

Platforms: iOS

#### seek()
+19 −1
Changes for examples/video-caching/App.ios.js: 19 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
 */

import React, { Component } from "react";
import { StyleSheet, Text, View, Dimensions } from "react-native";
import { StyleSheet, Text, View, Dimensions, TouchableOpacity } from "react-native";
import Video from "react-native-video";

const { height, width } = Dimensions.get("screen");
@@ -28,6 +28,16 @@ export default class App extends Component<Props> {
          }}
          style={{ flex: 1, height, width }}
        />
        <TouchableOpacity
          onPress={async () => {
            let response = await this.player.save();
            let uri = response.uri;
            console.log("Download URI", uri);
          }}
          style={styles.button}
        >
          <Text style={{color: 'white'}}>Save</Text>
        </TouchableOpacity>
      </View>
    );
  }
@@ -40,6 +50,14 @@ const styles = StyleSheet.create({
    alignItems: "center",
    backgroundColor: "#F5FCFF"
  },
  button: {
    position: 'absolute',
    top: 50,
    right: 16,
    padding: 10,
    backgroundColor: '#9B2FAE',
    borderRadius: 8
  },
  welcome: {
    fontSize: 20,
    textAlign: "center",
+1 −1
Changes for ios/Video/RCTVideo.m: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -1390,7 +1390,7 @@ static int const RCTVideoUnset = -1;
        if (exportSession != nil) {
            NSString *path = nil;
            NSArray *array = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
            path = [self generatePathInDirectory:[[self cacheDirectoryPath] stringByAppendingPathComponent:@"Filter"]
            path = [self generatePathInDirectory:[[self cacheDirectoryPath] stringByAppendingPathComponent:@"Videos"]
                                   withExtension:@".mp4"];
            NSURL *url = [NSURL fileURLWithPath:path];
            exportSession.outputFileType = AVFileTypeMPEG4;