Reputation: 32331
I have a HTML5 video tag for which user can add a video through input type file component .
My question is that on click of the remove link , is it possibe to remove the video ??
I have tried as
$(document).on("click", ".removepic", function(event)
{
$("#somevideo").val('');
var player = document.getElementById("video");
var currentVID = document.getElementById('currentVID');
// currentVID.setAttribute('src', '');
currentVID.setAttribute('src', '');
player.load();
player.play();
});
By doing so i am getting
Uncaught (in promise) DOMException: The play() request was interrupted by a new load request.playlocalVID @ VM79:56onchange @ VM716:91
Steps to reproduce the issue in below fiddle
In server console i am getting
VM79:56Uncaught (in promise) DOMException: The play() request was interrupted by a new load request.
This is my fiddle
https://jsfiddle.net/q3hhk17e/30/
Could you please tell me how to fix this issue ??
Upvotes: 3
Views: 12839
Reputation:
Try this and its working. I have updated your fiddle also.
$(document).on("click", ".removepic", function(event)
{
$("#somevideo").val('');
var player = document.getElementById("video");
player.pause();
var currentVID = document.getElementById('currentVID');
currentVID.setAttribute('src', '');
player.load();
// player.play();
});
Upvotes: 5