Added check for asset url
This commit is contained in:
parent
3b34df57ad
commit
00455ba1fb
@ -14,6 +14,8 @@ var deepDiffer = require('deepDiffer');
|
|||||||
|
|
||||||
var Video = React.createClass({
|
var Video = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
// should probably be a shape
|
||||||
|
source: PropTypes.object,
|
||||||
style: StyleSheetPropType(VideoStylePropTypes),
|
style: StyleSheetPropType(VideoStylePropTypes),
|
||||||
source: PropTypes.object,
|
source: PropTypes.object,
|
||||||
resizeMode: PropTypes.string,
|
resizeMode: PropTypes.string,
|
||||||
@ -55,13 +57,14 @@ var Video = React.createClass({
|
|||||||
var style = flattenStyle([styles.base, this.props.style]);
|
var style = flattenStyle([styles.base, this.props.style]);
|
||||||
var source = this.props.source;
|
var source = this.props.source;
|
||||||
var isNetwork = !!(source.uri && source.uri.match(/^https?:/));
|
var isNetwork = !!(source.uri && source.uri.match(/^https?:/));
|
||||||
|
var isAsset = !!(source.uri && source.uri.match(/^assets-library:/));
|
||||||
|
|
||||||
var resizeMode;
|
var resizeMode;
|
||||||
if (this.props.resizeMode === VideoResizeMode.stretch) {
|
if (this.props.resizeMode === VideoResizeMode.stretch) {
|
||||||
resizeMode = NativeModules.VideoManager.ScaleToFill;
|
resizeMode = NativeModules.VideoManager.ScaleToFill;
|
||||||
} else if (this.props.resizeMode === VideoResizeMode.contain) {
|
} else if (this.props.resizeMode === VideoResizeMode.contain) {
|
||||||
resizeMode = NativeModules.VideoManager.ScaleAspectFit;
|
resizeMode = NativeModules.VideoManager.ScaleAspectFit;
|
||||||
} else if (this.props.resizeMode == VideoResizeMode.cover) {
|
} else if (this.props.resizeMode === VideoResizeMode.cover) {
|
||||||
resizeMode = NativeModules.VideoManager.ScaleAspectFill;
|
resizeMode = NativeModules.VideoManager.ScaleAspectFill;
|
||||||
} else {
|
} else {
|
||||||
resizeMode = NativeModules.VideoManager.ScaleNone;
|
resizeMode = NativeModules.VideoManager.ScaleNone;
|
||||||
@ -73,6 +76,7 @@ var Video = React.createClass({
|
|||||||
src: {
|
src: {
|
||||||
uri: source.uri,
|
uri: source.uri,
|
||||||
isNetwork,
|
isNetwork,
|
||||||
|
isAsset,
|
||||||
type: source.type || 'mp4'
|
type: source.type || 'mp4'
|
||||||
},
|
},
|
||||||
onLoad: this._onLoad,
|
onLoad: this._onLoad,
|
||||||
|
Loading…
Reference in New Issue
Block a user