fix: ensure player receive uri update event if the uri is empty
This commit is contained in:
		
							
								
								
									
										14
									
								
								Video.js
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								Video.js
									
									
									
									
									
								
							| @@ -276,16 +276,20 @@ export default class Video extends Component { | |||||||
|     let uri = source.uri || ''; |     let uri = source.uri || ''; | ||||||
|     if (uri && uri.match(/^\//)) { |     if (uri && uri.match(/^\//)) { | ||||||
|       uri = `file://${uri}`; |       uri = `file://${uri}`; | ||||||
|     } else if (uri === '') { |  | ||||||
|       return null; |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (!uri) { |     if (!uri) { | ||||||
|       console.warn('Trying to load empty source.'); |       console.log('Trying to load empty source.'); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     const isNetwork = !!(uri && uri.match(/^https?:/)); |     const isNetwork = !!(uri && uri.match(/^https?:/i)); | ||||||
|     const isAsset = !!(uri && uri.match(/^(assets-library|ph|ipod-library|file|content|ms-appx|ms-appdata):/)); |     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; |     let nativeResizeMode; | ||||||
|     const RCTVideoInstance = this.getViewManagerConfig('RCTVideo'); |     const RCTVideoInstance = this.getViewManagerConfig('RCTVideo'); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user