{"version":3,"sources":["components/video.js"],"names":["dmx","Component","initialData","position","duration","ended","muted","paused","playbackRate","volume","inView","attributes","src","type","String","default","autopause","Boolean","playinview","methods","pos","this","$node","currentTime","rate","load","play","pause","init","node","_updateState","throttle","bind","ondurationchange","onended","onpause","onplay","onplaying","onratechange","onseeked","ontimeupdate","onvolumechange","_observer","IntersectionObserver","entries","forEach","entry","isIntersecting","data","props","set","observe","hasAttribute","performUpdate","updatedProps","has","destroy","disconnect","NaN"],"mappings":";;;;;;AAAAA,IAAAC,UAAA,QAAA,CAEAC,YAAA,CACAC,SAAA,EACAC,SAAA,EACAC,OAAA,EACAC,OAAA,EACAC,QAAA,EACAC,aAAA,EACAC,OAAA,EACAC,QAAA,GAGAC,WAAA,CACAC,IAAA,CACAC,KAAAC,OACAC,QAAA,IAGAC,UAAA,CACAH,KAAAI,QACAF,SAAA,GAGAG,WAAA,CACAL,KAAAI,QACAF,SAAA,IAIAI,QAAA,CACAhB,SAAAiB,GACAC,KAAAC,MAAAC,YAAAH,CACA,EAEAZ,aAAAgB,GACAH,KAAAC,MAAAd,aAAAgB,CACA,EAEAf,OAAAA,GACAY,KAAAC,MAAAb,OAAAA,CACA,EAEAgB,KAAAb,GACAS,KAAAC,MAAAV,IAAAA,EACAS,KAAAC,MAAAG,MACA,EAEAC,OACAL,KAAAC,MAAAI,MACA,EAEAC,QACAN,KAAAC,MAAAK,OACA,GAGAC,KAAAC,GACAR,KAAAS,aAAA9B,IAAA+B,SAAAV,KAAAS,aAAAE,KAAAX,OAEAQ,EAAAI,iBAAAZ,KAAAS,aACAD,EAAAK,QAAAb,KAAAS,aACAD,EAAAM,QAAAd,KAAAS,aACAD,EAAAO,OAAAf,KAAAS,aACAD,EAAAQ,UAAAhB,KAAAS,aACAD,EAAAS,aAAAjB,KAAAS,aACAD,EAAAU,SAAAlB,KAAAS,aACAD,EAAAW,aAAAnB,KAAAS,aACAD,EAAAY,eAAApB,KAAAS,aAEAT,KAAAqB,UAAA,IAAAC,sBAAAC,IACAA,EAAAC,SAAAC,IACA,MAAApC,EAAAoC,EAAAC,gBAEArC,GAAAW,KAAA2B,KAAAtC,QAAAW,KAAA4B,MAAAjC,WACAa,EAAAF,QAGAjB,IAAAW,KAAA2B,KAAAtC,QAAAW,KAAA4B,MAAA/B,YACAW,EAAAH,OAGAL,KAAA6B,IAAA,SAAAxC,EAAA,GACA,IAGAW,KAAAqB,UAAAS,QAAAtB,GAEAA,EAAAuB,aAAA,kBACAvB,EAAAjB,IAAAS,KAAA4B,MAAArC,IAEA,EAEAyC,cAAAC,GACAA,EAAAC,IAAA,SACAlC,KAAAC,MAAAV,IAAAS,KAAA4B,MAAArC,IACAS,KAAAC,MAAAG,OAEA,EAEA+B,UACAnC,KAAAqB,UAAAe,aACApC,KAAAqB,UAAA,IACA,EAEAZ,aAAA,WACAT,KAAA6B,IAAA,WAAA7B,KAAAC,MAAAC,aACAF,KAAA6B,IAAA,WAAAQ,KAAArC,KAAAC,MAAAlB,SAAA,EAAAiB,KAAAC,MAAAlB,UACAiB,KAAA6B,IAAA,QAAA7B,KAAAC,MAAAjB,OACAgB,KAAA6B,IAAA,QAAA7B,KAAAC,MAAAhB,OACAe,KAAA6B,IAAA,SAAA7B,KAAAC,MAAAf,QACAc,KAAA6B,IAAA,eAAA7B,KAAAC,MAAAd,cACAa,KAAA6B,IAAA,SAAA7B,KAAAC,MAAAb,OACA","file":"dmxVideo.js","sourcesContent":["dmx.Component('video', {\r\n\r\n initialData: {\r\n position: 0,\r\n duration: 0,\r\n ended: false,\r\n muted: false,\r\n paused: false,\r\n playbackRate: 1,\r\n volume: 1,\r\n inView: false,\r\n },\r\n\r\n attributes: {\r\n src: {\r\n type: String,\r\n default: '',\r\n },\r\n\r\n autopause: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n\r\n playinview: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n },\r\n\r\n methods: {\r\n position (pos) {\r\n this.$node.currentTime = pos;\r\n },\r\n\r\n playbackRate (rate) {\r\n this.$node.playbackRate = rate;\r\n },\r\n\r\n volume (volume) {\r\n this.$node.volume = volume;\r\n },\r\n\r\n load (src) {\r\n this.$node.src = src;\r\n this.$node.load();\r\n },\r\n\r\n play () {\r\n this.$node.play();\r\n },\r\n\r\n pause () {\r\n this.$node.pause();\r\n }\r\n },\r\n\r\n init (node) {\r\n this._updateState = dmx.throttle(this._updateState.bind(this));\r\n\r\n node.ondurationchange = this._updateState;\r\n node.onended = this._updateState;\r\n node.onpause = this._updateState;\r\n node.onplay = this._updateState;\r\n node.onplaying = this._updateState;\r\n node.onratechange = this._updateState;\r\n node.onseeked = this._updateState;\r\n node.ontimeupdate = this._updateState;\r\n node.onvolumechange = this._updateState;\r\n\r\n this._observer = new IntersectionObserver(entries => {\r\n entries.forEach(entry => {\r\n const inView = entry.isIntersecting;\r\n\r\n if (!inView && this.data.inView && this.props.autopause) {\r\n node.pause();\r\n }\r\n \r\n if (inView && !this.data.inView && this.props.playinview) {\r\n node.play();\r\n }\r\n \r\n this.set('inView', inView);\r\n });\r\n });\r\n\r\n this._observer.observe(node);\r\n\r\n if (node.hasAttribute('dmx-bind:src')) {\r\n node.src = this.props.src;\r\n }\r\n },\r\n\r\n performUpdate (updatedProps) {\r\n if (updatedProps.has('src')) {\r\n this.$node.src = this.props.src;\r\n this.$node.load();\r\n }\r\n },\r\n\r\n destroy () {\r\n this._observer.disconnect();\r\n this._observer = null;\r\n },\r\n\r\n _updateState: function() {\r\n this.set('position', this.$node.currentTime);\r\n this.set('duration', this.$node.duration == NaN ? 0 : this.$node.duration);\r\n this.set('ended', this.$node.ended);\r\n this.set('muted', this.$node.muted);\r\n this.set('paused', this.$node.paused);\r\n this.set('playbackRate', this.$node.playbackRate);\r\n this.set('volume', this.$node.volume);\r\n },\r\n\r\n});\r\n"]}