ngSrc doesn't work properly with HTML5 Video Source tag
In firefox, ngSrc directive on video elements'
<video controls>
<source ng-src="{{src}}">
</video>
doesn't work in Firefox at all, and in chrome it only works on first loading.
However,
<video ng-src="{{src}} controls></video>
works in both browsers, and it can be updated dynamically with no problems.
This is a problem, when having multiple video formats in order to support all browsers.
Related: #339
Im having an issue as well, however I feel that the issue resides in Angulars ng-repeat. If i remove the video from that scope it plays fine, otherwise none of the controls will even load.
me too! http://stackoverflow.com/questions/15728424/html5-video-is-not-working-with-angularjs-ng-src-tag
me too.
me too! help me
+1
I'm using ng-repeat to set ng-src sources and they load correctly on page load, but if the video gets hidden via ng-show and then shown again the sources don't reload (in Chrome).
I can confirm sourcec0de's observation - if I remove the ng-repeat and use a single ng-src source (or multiple ng-src sources) the video reloads correctly upon re-showing.
I'm having the same problem. Is anyone currently looking into this?
With or without ng-src, with or without ng-repeat, chrome repeatedly fails to reload an HTML5 video after navigating away then coming back to the page.
From a clean cache, I see 2 requests (first one Pending), second with 206 Partial Content. If I refresh, I see one request with 304 Not Modified. When I navigate away from the video view then return (either through a link or using back button), I get two requests for the video with just a Pending status. One of these will have a mime-type video/mp4 (correct), the other just says Pending.
Is anyone even looking at this issue???
Can you provide a running example of this issue?
Does it work on some browsers at all?
Have you checked whether browsers support changing the src attribute on HTML5 video elements after rendering?
Sorry, the example app is not published yet. Works fine in Safari. As indicated above, I used both ng-src directive and a hard-coded src attribute with the same results.
What happens if you change the src with straight jQuery? I wonder if this is actually a bug in the browser rather than AngularJS?
On 16 July 2013 22:31, Paul Grenier [email protected] wrote:
Sorry, the example app is not published yet. Works fine in Safari. As indicated above, I used both ng-src directive and a hard-coded src attribute with the same results.
— Reply to this email directly or view it on GitHubhttps://github.com/angular/angular.js/issues/1352#issuecomment-21075654 .
Even if I'm not changing the src (e.g., hard-code the video src attribute), the issue occurs. I don't have a way to simulate the problem away from Angular since Angular controls the content. I agree, it may be simply a problem in Chrome but I'm not sure how to test that.
What do you mean that Angular controls the content?
The problem occurs when, using Angular's controller, the content changes, loading another view. Using the back button or a link to the previous route displays the former content but the video fails to load--every time. If it's an Angular issue, it's probably only in Chrome. My guess is that Chrome's aggressive caching and Angular's method for changing views can't agree on what should be loaded.
@AutoSponge my test case was: page 1 with a button to go to page 2 page 2 with a videojs player and a button to go back to page 1
navigate to page 1, then to page 2, video is loaded correctly. click on button to go back to page 1, then go to page 2, google chrome stops using videojs. this happens because the videojs object was not removed when angular removed the element from the DOM, as expected. this isn't an angularjs (yay!)
Remove it before initializing the videojs player. I do this because I have a directive that adds a player. For example, if used in a directive:
... directive('mydir', ... {
var vp;
return {
link: ..{
if (vp) vp.dispose();
vp = videojs("mp4video");
}
};`
Just like the OP, I'm not using a wrapper object. The video is loaded through an HTML5 video tag. Are you suggesting that should be removed separately?
well, videoJS keeps track of players added to the DOM but it looks like it is not watching changes. If you remove the element from the DOM (e.g. because you navigate to another route), videoJS won't know and it won't initialize it again. see line 17: https://github.com/videojs/video.js/blob/master/src/js/core.js if you remove it outside of videoJS, I guess you should call the dispose() method of the player. I guess this works like when you wrap a jquery plugin (?). This is what makes me think that it isn't an angular issue.
having this problems as well. loading AV files to src or ng-src doesn`t do the job. need to write directives or factories for it to work. http://stackoverflow.com/questions/15485768/changing-html5s-source-src-attribute-takes-no-effect-wtih-angularjs
I'm having this problem as well.
Video fails to load in Chrome, Firefox and Safari. It works, however, in IE.
Here's a work around:http://stackoverflow.com/questions/15728424/html5-video-is-not-working-with-angularjs-ng-src-tag
It creates a messy flicker on page load, but it works.
+1