fix: ensure player receive uri update event if the uri is empty

This commit is contained in:
olivier bouillet 2022-09-14 21:57:37 +02:00
parent 2349fad25f
commit 3f44d6ee25

View File

@ -276,16 +276,20 @@ export default class Video extends Component {
let uri = source.uri || '';
if (uri && uri.match(/^\//)) {
uri = `file://${uri}`;
} else if (uri === '') {
return null;
}
if (!uri) {
console.warn('Trying to load empty source.');
console.log('Trying to load empty source.');
}
const isNetwork = !!(uri && uri.match(/^https?:/));
const isAsset = !!(uri && uri.match(/^(assets-library|ph|ipod-library|file|content|ms-appx|ms-appdata):/));
const isNetwork = !!(uri && uri.match(/^https?:/i));
const isAsset = !!(uri && uri.match(/^(assets-library|ph|ipod-library|file|content|ms-appx|ms-appdata):/i));
if (uri && !isNetwork && !isAsset) {
if (this.props.onError) {
this.props.onError({error: {errorString: 'invalid url, player will stop', errorCode: 'INVALID_URL'}});
}
}
let nativeResizeMode;
const RCTVideoInstance = this.getViewManagerConfig('RCTVideo');