Hi i ended up doing something like the below which seems to have the 
desired effect.

directive('videoplayer', ['$timeout', '$compile', function(timer, compile) {
  return {
    restrict: 'E',
    link: function(scope, element, attrs) {
      attrs.$observe('turl', function(newv, oldv) {
      var v = document.getElementById('vidPlayer');
      if (v) {
        videojs('vidPlayer').pause();
        videojs('vidPlayer').dispose();
      }
        
      var n =
      '<video id="vidPlayer" class="vid-center video-js vjs-default-skin" 
controls preload="none" width="640" height="360" ng-poster="{{thumb.turl}}" 
data-setup="{}">' +
        '<source ng-src="{{thumb.vurl1}}" type="video/mp4"/>' +
        '<source ng-src="{{thumb.vurl2}}" type="video/webm"/>' +
      '</video>';
       
      var el = compile(n)(scope);
        
      element.empty();
      element.append(el);
        
      timer(function() {
        videojs('vidPlayer').ready(function() {
          this.load();
          this.play();
        });
      }, 0);
    }); 
}
  };
}]);

There is a problem with reloading in videojs hence the recommendation was 
to remove the component completely and then reconstruct it. Hence why i 
needed to destroy/recreate.

thanks

On Saturday, 8 March 2014 04:32:51 UTC, Sander Elias wrote:
>
> Ho Gurpal2000
>
> You are in a directive, DOM manipulation is permitted there. Use 
> javascript to detect, and put back in the node.
> There is nothing angular specific at that.
>
> Regards
> Sander
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to