From 95d67b011e276168e1acb2206199f273b2300ca1 Mon Sep 17 00:00:00 2001 From: Matthieu Achard Date: Sun, 14 Jun 2015 19:31:39 +0200 Subject: [PATCH] support for absolute path and file:// paths --- Video.ios.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Video.ios.js b/Video.ios.js index 21f4644f..4e59385f 100644 --- a/Video.ios.js +++ b/Video.ios.js @@ -67,8 +67,12 @@ var Video = React.createClass({ render() { var style = flattenStyle([styles.base, this.props.style]); var source = this.props.source; - var isNetwork = !!(source.uri && source.uri.match(/^https?:/)); - var isAsset = !!(source.uri && source.uri.match(/^assets-library:/)); + var uri = source.uri; + if (uri && uri.match(/^\//)) { + uri = 'file://' + uri; + } + var isNetwork = !!(uri && uri.match(/^https?:/)); + var isAsset = !!(uri && uri.match(/^(assets-library|file):/)); var resizeMode; if (this.props.resizeMode === VideoResizeMode.stretch) { @@ -85,7 +89,7 @@ var Video = React.createClass({ style, resizeMode: resizeMode, src: { - uri: source.uri, + uri: uri, isNetwork, isAsset, type: source.type || 'mp4'