From 98d68f894480e1527ac9573b6869cbbab2a4d744 Mon Sep 17 00:00:00 2001 From: Vinayak Kulkarni Date: Sat, 20 Apr 2019 02:50:15 +0530 Subject: [PATCH] :dvd: Sauce --- dist/v-clappr.esm.js | 238 +++++++++++++++++++++++++++++++++++++++++ dist/v-clappr.js | 244 +++++++++++++++++++++++++++++++++++++++++++ dist/v-clappr.min.js | 1 + 3 files changed, 483 insertions(+) create mode 100644 dist/v-clappr.esm.js create mode 100644 dist/v-clappr.js create mode 100644 dist/v-clappr.min.js diff --git a/dist/v-clappr.esm.js b/dist/v-clappr.esm.js new file mode 100644 index 00000000..aa02dc53 --- /dev/null +++ b/dist/v-clappr.esm.js @@ -0,0 +1,238 @@ +import { Player, Events } from 'clappr'; + +var script = { + name: 'VClappr', + props: { + el: { + type: String, + required: true, + default: 'player' + }, + source: { + type: String, + required: true, + default: '' + }, + options: { + type: Object, + required: false, + default: () => ({ + poster: '', + mute: false, + autoplay: true, + loop: false, + disable_context_menu: false, + disable_keyboard_shortcuts: false, + mediacontrol: {}, + ga: { + account: '', + tracker_name: '' + }, + watermark: { + image: '', + url: '', + position: 'top-right' + } + }) + } + }, + data: () => ({ + player: null + }), + + mounted() { + const player = this.initClapprPlayer(); + this.player = player; + this.registerEvents(player); + }, + + beforeDestroy() { + this.player.destroy(); + this.player = null; + }, + + methods: { + initClapprPlayer() { + const player = new Player({ + parentId: `#${this.el}`, + source: this.source, + autoPlay: this.options.autoplay, + poster: this.options.poster, + mute: this.options.mute, + loop: this.options.loop, + mediacontrol: this.options.mediacontrol, + disableKeyboardShortcuts: this.options.disable_keyboard_shortcuts, + disableVideoTagContextMenu: this.options.disable_context_menu, + gaAccount: this.options.ga.account, + gaTrackerName: this.options.ga.tracker_name, + watermark: this.options.watermark.image, + watermarkLink: this.options.watermark.url, + position: this.options.watermark.position + }); + this.$emit('init', player); + return player; + }, + + registerEvents(player) { + player.on(Events.PLAYER_READY, () => { + this.$emit('ready', player); + }); + player.on(Events.PLAYER_PLAY, () => { + this.$emit('play', player); + }); + player.on(Events.PLAYER_PAUSE, () => { + this.$emit('pause', player); + }); + player.on(Events.PLAYER_STOP, () => { + this.$emit('stop', player); + }); + player.on(Events.PLAYER_ENDED, () => { + this.$emit('ended', player); + }); + player.on(Events.PLAYER_FULLSCREEN, bool => { + this.$emit('fullscreen', bool); + }); + player.on(Events.PLAYER_RESIZE, resize => { + this.$emit('resize', resize); + }); + player.on(Events.PLAYER_SEEK, time => { + this.$emit('seek', time); + }); + player.on(Events.PLAYER_TIMEUPDATE, progress => { + this.$emit('timeupdate', progress); + }); + player.on(Events.PLAYER_VOLUMEUPDATE, volume => { + this.$emit('volumeupdate', volume); + }); + player.on(Events.PLAYER_ERROR, err => { + this.$emit('error', err); + }); + } + + } +}; + +function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier +/* server only */ +, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) { + if (typeof shadowMode !== 'boolean') { + createInjectorSSR = createInjector; + createInjector = shadowMode; + shadowMode = false; + } // Vue.extend constructor export interop. + + + var options = typeof script === 'function' ? script.options : script; // render functions + + if (template && template.render) { + options.render = template.render; + options.staticRenderFns = template.staticRenderFns; + options._compiled = true; // functional template + + if (isFunctionalTemplate) { + options.functional = true; + } + } // scopedId + + + if (scopeId) { + options._scopeId = scopeId; + } + + var hook; + + if (moduleIdentifier) { + // server build + hook = function hook(context) { + // 2.3 injection + context = context || // cached call + this.$vnode && this.$vnode.ssrContext || // stateful + this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext; // functional + // 2.2 with runInNewContext: true + + if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { + context = __VUE_SSR_CONTEXT__; + } // inject component styles + + + if (style) { + style.call(this, createInjectorSSR(context)); + } // register component module identifier for async chunk inference + + + if (context && context._registeredComponents) { + context._registeredComponents.add(moduleIdentifier); + } + }; // used by ssr in case component is cached and beforeCreate + // never gets called + + + options._ssrRegister = hook; + } else if (style) { + hook = shadowMode ? function () { + style.call(this, createInjectorShadow(this.$root.$options.shadowRoot)); + } : function (context) { + style.call(this, createInjector(context)); + }; + } + + if (hook) { + if (options.functional) { + // register for functional component in vue file + var originalRender = options.render; + + options.render = function renderWithStyleInjection(h, context) { + hook.call(context); + return originalRender(h, context); + }; + } else { + // inject component registration as beforeCreate hook + var existing = options.beforeCreate; + options.beforeCreate = existing ? [].concat(existing, hook) : [hook]; + } + } + + return script; +} + +var normalizeComponent_1 = normalizeComponent; + +/* script */ +const __vue_script__ = script; + +/* template */ +var __vue_render__ = function() { + var _vm = this; + var _h = _vm.$createElement; + var _c = _vm._self._c || _h; + return _c("div", { attrs: { id: _vm.el } }) +}; +var __vue_staticRenderFns__ = []; +__vue_render__._withStripped = true; + + /* style */ + const __vue_inject_styles__ = undefined; + /* scoped */ + const __vue_scope_id__ = undefined; + /* module identifier */ + const __vue_module_identifier__ = undefined; + /* functional template */ + const __vue_is_functional_template__ = false; + /* style inject */ + + /* style inject SSR */ + + + + var VClappr = normalizeComponent_1( + { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ }, + __vue_inject_styles__, + __vue_script__, + __vue_scope_id__, + __vue_is_functional_template__, + __vue_module_identifier__, + undefined, + undefined + ); + +export default VClappr; diff --git a/dist/v-clappr.js b/dist/v-clappr.js new file mode 100644 index 00000000..1d34908d --- /dev/null +++ b/dist/v-clappr.js @@ -0,0 +1,244 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('clappr')) : + typeof define === 'function' && define.amd ? define(['clappr'], factory) : + (global = global || self, global.VClappr = factory(global.clappr)); +}(this, function (clappr) { 'use strict'; + + var script = { + name: 'VClappr', + props: { + el: { + type: String, + required: true, + default: 'player' + }, + source: { + type: String, + required: true, + default: '' + }, + options: { + type: Object, + required: false, + default: () => ({ + poster: '', + mute: false, + autoplay: true, + loop: false, + disable_context_menu: false, + disable_keyboard_shortcuts: false, + mediacontrol: {}, + ga: { + account: '', + tracker_name: '' + }, + watermark: { + image: '', + url: '', + position: 'top-right' + } + }) + } + }, + data: () => ({ + player: null + }), + + mounted() { + const player = this.initClapprPlayer(); + this.player = player; + this.registerEvents(player); + }, + + beforeDestroy() { + this.player.destroy(); + this.player = null; + }, + + methods: { + initClapprPlayer() { + const player = new clappr.Player({ + parentId: `#${this.el}`, + source: this.source, + autoPlay: this.options.autoplay, + poster: this.options.poster, + mute: this.options.mute, + loop: this.options.loop, + mediacontrol: this.options.mediacontrol, + disableKeyboardShortcuts: this.options.disable_keyboard_shortcuts, + disableVideoTagContextMenu: this.options.disable_context_menu, + gaAccount: this.options.ga.account, + gaTrackerName: this.options.ga.tracker_name, + watermark: this.options.watermark.image, + watermarkLink: this.options.watermark.url, + position: this.options.watermark.position + }); + this.$emit('init', player); + return player; + }, + + registerEvents(player) { + player.on(clappr.Events.PLAYER_READY, () => { + this.$emit('ready', player); + }); + player.on(clappr.Events.PLAYER_PLAY, () => { + this.$emit('play', player); + }); + player.on(clappr.Events.PLAYER_PAUSE, () => { + this.$emit('pause', player); + }); + player.on(clappr.Events.PLAYER_STOP, () => { + this.$emit('stop', player); + }); + player.on(clappr.Events.PLAYER_ENDED, () => { + this.$emit('ended', player); + }); + player.on(clappr.Events.PLAYER_FULLSCREEN, bool => { + this.$emit('fullscreen', bool); + }); + player.on(clappr.Events.PLAYER_RESIZE, resize => { + this.$emit('resize', resize); + }); + player.on(clappr.Events.PLAYER_SEEK, time => { + this.$emit('seek', time); + }); + player.on(clappr.Events.PLAYER_TIMEUPDATE, progress => { + this.$emit('timeupdate', progress); + }); + player.on(clappr.Events.PLAYER_VOLUMEUPDATE, volume => { + this.$emit('volumeupdate', volume); + }); + player.on(clappr.Events.PLAYER_ERROR, err => { + this.$emit('error', err); + }); + } + + } + }; + + function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier + /* server only */ + , shadowMode, createInjector, createInjectorSSR, createInjectorShadow) { + if (typeof shadowMode !== 'boolean') { + createInjectorSSR = createInjector; + createInjector = shadowMode; + shadowMode = false; + } // Vue.extend constructor export interop. + + + var options = typeof script === 'function' ? script.options : script; // render functions + + if (template && template.render) { + options.render = template.render; + options.staticRenderFns = template.staticRenderFns; + options._compiled = true; // functional template + + if (isFunctionalTemplate) { + options.functional = true; + } + } // scopedId + + + if (scopeId) { + options._scopeId = scopeId; + } + + var hook; + + if (moduleIdentifier) { + // server build + hook = function hook(context) { + // 2.3 injection + context = context || // cached call + this.$vnode && this.$vnode.ssrContext || // stateful + this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext; // functional + // 2.2 with runInNewContext: true + + if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { + context = __VUE_SSR_CONTEXT__; + } // inject component styles + + + if (style) { + style.call(this, createInjectorSSR(context)); + } // register component module identifier for async chunk inference + + + if (context && context._registeredComponents) { + context._registeredComponents.add(moduleIdentifier); + } + }; // used by ssr in case component is cached and beforeCreate + // never gets called + + + options._ssrRegister = hook; + } else if (style) { + hook = shadowMode ? function () { + style.call(this, createInjectorShadow(this.$root.$options.shadowRoot)); + } : function (context) { + style.call(this, createInjector(context)); + }; + } + + if (hook) { + if (options.functional) { + // register for functional component in vue file + var originalRender = options.render; + + options.render = function renderWithStyleInjection(h, context) { + hook.call(context); + return originalRender(h, context); + }; + } else { + // inject component registration as beforeCreate hook + var existing = options.beforeCreate; + options.beforeCreate = existing ? [].concat(existing, hook) : [hook]; + } + } + + return script; + } + + var normalizeComponent_1 = normalizeComponent; + + /* script */ + const __vue_script__ = script; + + /* template */ + var __vue_render__ = function() { + var _vm = this; + var _h = _vm.$createElement; + var _c = _vm._self._c || _h; + return _c("div", { attrs: { id: _vm.el } }) + }; + var __vue_staticRenderFns__ = []; + __vue_render__._withStripped = true; + + /* style */ + const __vue_inject_styles__ = undefined; + /* scoped */ + const __vue_scope_id__ = undefined; + /* module identifier */ + const __vue_module_identifier__ = undefined; + /* functional template */ + const __vue_is_functional_template__ = false; + /* style inject */ + + /* style inject SSR */ + + + + var VClappr = normalizeComponent_1( + { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ }, + __vue_inject_styles__, + __vue_script__, + __vue_scope_id__, + __vue_is_functional_template__, + __vue_module_identifier__, + undefined, + undefined + ); + + return VClappr; + +})); diff --git a/dist/v-clappr.min.js b/dist/v-clappr.min.js new file mode 100644 index 00000000..c53696a4 --- /dev/null +++ b/dist/v-clappr.min.js @@ -0,0 +1 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("clappr")):"function"==typeof define&&define.amd?define(["clappr"],e):(t=t||self).VClappr=e(t.clappr)}(this,function(t){"use strict";var e=function(t,e,o,i,n,s,r,a,p,d){"boolean"!=typeof r&&(p=a,a=r,r=!1);var l,u="function"==typeof o?o.options:o;if(t&&t.render&&(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,n&&(u.functional=!0)),i&&(u._scopeId=i),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,p(t)),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):e&&(l=r?function(){e.call(this,d(this.$root.$options.shadowRoot))}:function(t){e.call(this,a(t))}),l)if(u.functional){var c=u.render;u.render=function(t,e){return l.call(e),c(t,e)}}else{var h=u.beforeCreate;u.beforeCreate=h?[].concat(h,l):[l]}return o};const o={name:"VClappr",props:{el:{type:String,required:!0,default:"player"},source:{type:String,required:!0,default:""},options:{type:Object,required:!1,default:()=>({poster:"",mute:!1,autoplay:!0,loop:!1,disable_context_menu:!1,disable_keyboard_shortcuts:!1,mediacontrol:{},ga:{account:"",tracker_name:""},watermark:{image:"",url:"",position:"top-right"}})}},data:()=>({player:null}),mounted(){const t=this.initClapprPlayer();this.player=t,this.registerEvents(t)},beforeDestroy(){this.player.destroy(),this.player=null},methods:{initClapprPlayer(){const e=new t.Player({parentId:`#${this.el}`,source:this.source,autoPlay:this.options.autoplay,poster:this.options.poster,mute:this.options.mute,loop:this.options.loop,mediacontrol:this.options.mediacontrol,disableKeyboardShortcuts:this.options.disable_keyboard_shortcuts,disableVideoTagContextMenu:this.options.disable_context_menu,gaAccount:this.options.ga.account,gaTrackerName:this.options.ga.tracker_name,watermark:this.options.watermark.image,watermarkLink:this.options.watermark.url,position:this.options.watermark.position});return this.$emit("init",e),e},registerEvents(e){e.on(t.Events.PLAYER_READY,()=>{this.$emit("ready",e)}),e.on(t.Events.PLAYER_PLAY,()=>{this.$emit("play",e)}),e.on(t.Events.PLAYER_PAUSE,()=>{this.$emit("pause",e)}),e.on(t.Events.PLAYER_STOP,()=>{this.$emit("stop",e)}),e.on(t.Events.PLAYER_ENDED,()=>{this.$emit("ended",e)}),e.on(t.Events.PLAYER_FULLSCREEN,t=>{this.$emit("fullscreen",t)}),e.on(t.Events.PLAYER_RESIZE,t=>{this.$emit("resize",t)}),e.on(t.Events.PLAYER_SEEK,t=>{this.$emit("seek",t)}),e.on(t.Events.PLAYER_TIMEUPDATE,t=>{this.$emit("timeupdate",t)}),e.on(t.Events.PLAYER_VOLUMEUPDATE,t=>{this.$emit("volumeupdate",t)}),e.on(t.Events.PLAYER_ERROR,t=>{this.$emit("error",t)})}}};var i=function(){var t=this.$createElement;return(this._self._c||t)("div",{attrs:{id:this.el}})};i._withStripped=!0;return e({render:i,staticRenderFns:[]},void 0,o,void 0,!1,void 0,void 0,void 0)});