javascript - Observing "ended" media event on Polymer -
javascript - Observing "ended" media event on Polymer -
i'm trying observe "ended" media event video playback. plan trigger action when video.ended == true.
here template code:
<div id="container"> <video id="video" width="{{width}}" autoplay> <source src="shamman.mp4" type='video/mp4;codecs="avc1.42e01e, mp4a.40.2"' /> </video> </div> <content></content>
and here javascript:
polymer({ author: '', ready: function() { console.log(this.$.video.ended); var observer = new pathobserver(this.$, 'video.ended'); observer.open(function(newvalue, oldvalue) { console.log(newvalue); console.log(oldvalue); }); } });
the first console.log returns initial value of ended, "false". sec , 3rd console.log never executed.
i think practical way of doing using html5 api. //..still in ready: var vid = this.$.video; vid.addeventlistener('ended', function (e) { // thing here ... vid.removeeventlistener('ended'); }, false);
javascript polymer
Comments
Post a Comment