Uncaught (in promise) DOMException: Failed to load because no supported source was found.
the above error occurs on the one hand, the number of bytes of the video obtained from the background is 0, is an empty video
was used to determine whether the video could be downloaded. In the project, there was a problem that the video from the mobile phone to the database could not be played at all for the 0 byte video. The console reported an error: Uncaught (in promise) DOMException: Failed to load because no supported source was found
solution:
determines the networkState of the video, if the value is equal to 3, it will not play, skip
- Media.networkState; //0. This element is not initialized 1. Normal but not using network 2. Downloading data 3. No resource
found
determines the resource length of the video. If it is NAN, it cannot be played. However, this may be limited by the network state, and it takes a certain amount of time to obtain the length of the video when the network is not good.
- Media.duration; // the current resource length stream returns an infinite
I use the item written by vue: ev.target is used to get the status of the video
videoChanging: function (ev) {
if (! $refs.video) {return}
// replace the SRC of video
if(this.videosrctwo){
var status = this.$refs. video-ended
if(status){
if(this.$refs. video-src == this.videosrcone){
this.$refs.video.src = this.videosrcTwo
console.log('ev.target.networkState', ev.target.networkState)
console.log('ev.target.duration', ev.target.duration)
this.$refs.video.play()
}else{
this.$refs.video.src = this.videosrcOne
}
}
if(ev.target.ended){
this.playing = false
// this.replay =true
}
} else {
this. IsLoop = true
}
solution:
determines the networkState of the video, if the value is equal to 3, it will not play, skip
- Media.networkState; //0. This element is not initialized 1. Normal but not using network 2. Downloading data 3. No resource
found
determines the resource length of the video. If it is NAN, it cannot be played. However, this may be limited by the network state, and it takes a certain amount of time to obtain the length of the video when the network is not good.
- Media.duration; // the current resource length stream returns an infinite
I use the item written by vue: ev.target is used to get the status of the video
videoChanging: function (ev) {
if (! $refs.video) {return}
// replace the SRC of video
if(this.videosrctwo){
var status = this.$refs. video-ended
if(status){
if(this.$refs. video-src == this.videosrcone){
this.$refs.video.src = this.videosrcTwo
console.log('ev.target.networkState', ev.target.networkState)
console.log('ev.target.duration', ev.target.duration)
this.$refs.video.play()
}else{
this.$refs.video.src = this.videosrcOne
}
}
if(ev.target.ended){
this.playing = false
// this.replay =true
}
} else {
this. IsLoop = true
}
if(ev.target.networkState == 3) return this.$refs.video-src = this.videosrcone
This result will not play '
ev.target.networkState 3
ev.target.duration NaN
Read More:
- Easywasmlayer reports an error uncaught (in promise) domexception when playing a video
- Video JS can’t play the prompt( CODE:4 MEDIA_ ERR_ SRC_ NOT_ SUPPORTED) No compatible source was found for this video.
- WebView load webpage, HTTP call error
- Tainted canvases may not be exported
- VUEJS Failed to execute ‘removeChild’ on ‘Node’: The node to be removed is not a child of
- If JavaScript exceeds the length of the array, no error will be reported
- Deep understanding of async await asynchronous programming synchronization
- Android Development notes — mediaplayer error (1, – 2147483648)
- Failed to load resource: the server responded with a status of 503 (Service Unavailable)
- App: Cleartext traffic not permitted
- Ionic1 compiling IOS encountered * * archive failed * * cordovaerror: promise rejected with non error: ‘error code 65 f
- The video cannot be played because you have disabled the cookie
- The browser console reports failed to load resource: net :: ERR_CONNECTION_RESET, which results in unable to log in
- Error in v-on handler (Promise/async): “[object Object]“
- Cesium uses mediastreamrecorder or mediarecorder to record and download videos, and turn on the camera for recording.
- Leetcode 34 finds the first and last position of an element in the sorted array (medium)
- Linux virtual machine network “job for” network.service failed because the control process exited with error code”
- Failed to push some refs to
- Solve the audio control and report domexception: the play() request was interrupted by a call to pause in the chrome console
- JavaScript realizes the longest substring of non repeated characters