Video doesn't start muted inside an ng-repeat only in Firefox
I have a video tag in an ng-repeat loop, and I want to start the video muted; however, it does't in Firefox v29.0.1. It works well in Chrome.
The code is very simple:
<div ng-app="myApp" ng-controller="myController">
<div ng-repeat="number in numbers">
<video src="http://techslides.com/demos/sample-videos/small.mp4" autoplay controls loop muted>
</video>
{{number}} Video</div>
</div>
I have put up a fiddle here: http://jsfiddle.net/YW6hP/7/
Reproducable: always Browsers: Firefox 29.0.1 Steps to reproduce: just open the Fiddle in Firefox and the video is not muted; and then in Chrome and the video is muted.
Hi,
Thanks for reporting this issue. It looks like this is not an issue with Angular, but an issue with Firefox on how it handles dynamically added <video> elements
https://groups.google.com/forum/#!topic/discuss-webrtc/sTtGlsX8-0M http://stackoverflow.com/questions/14111917/html5-video-muted-but-stilly-playing
I would recommend that you write a polyfill directive that does the right thing for Firefox. I do not see this polyfill being part of angular core, so I will leave it open for a few more days in case a core member wants to jump in
Hi, thank you for the attention! :-) At last I resolved with this directive I put in my video tags (I think is something like what you also suggested):
.directive('myVideo', function () {
return {
restrict: 'A',
scope: {},
link: function(scope, element, attrs) {
element[0].muted = true;
}
};
})
Hope this may help others!
Glad you've sorted this one out @sirio13 !
This now happens on the latest chrome.
Which version of Chrome do you mean? I can't reproduce it via the given Fiddle (http://jsfiddle.net/YW6hP/7/) on Chrome 64.0.3282.167 (Official Build) (64-bit)
Chrome 64.0.3282.167 Official Build OS X 10.12 64 Bit
I am on OS X 10.13 but it seems strange that the behaviour would change for the same version of Chrome.
I'm afraid as per the previous report, the best option for you would be to use the workaround here https://github.com/angular/angular.js/issues/7474#issuecomment-43242316
Will use workaround for now