123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- module.exports =
- (function(modules) {
-
- var installedModules = {};
-
- function __webpack_require__(moduleId) {
-
- if(installedModules[moduleId]) {
- return installedModules[moduleId].exports;
- }
-
- var module = installedModules[moduleId] = {
- i: moduleId,
- l: false,
- exports: {}
- };
-
- modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-
- module.l = true;
-
- return module.exports;
- }
-
- __webpack_require__.m = modules;
-
- __webpack_require__.c = installedModules;
-
- __webpack_require__.d = function(exports, name, getter) {
- if(!__webpack_require__.o(exports, name)) {
- Object.defineProperty(exports, name, { enumerable: true, get: getter });
- }
- };
-
- __webpack_require__.r = function(exports) {
- if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
- }
- Object.defineProperty(exports, '__esModule', { value: true });
- };
-
-
-
-
-
- __webpack_require__.t = function(value, mode) {
- if(mode & 1) value = __webpack_require__(value);
- if(mode & 8) return value;
- if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
- var ns = Object.create(null);
- __webpack_require__.r(ns);
- Object.defineProperty(ns, 'default', { enumerable: true, value: value });
- if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
- return ns;
- };
-
- __webpack_require__.n = function(module) {
- var getter = module && module.__esModule ?
- function getDefault() { return module['default']; } :
- function getModuleExports() { return module; };
- __webpack_require__.d(getter, 'a', getter);
- return getter;
- };
-
- __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
-
- __webpack_require__.p = "";
-
- return __webpack_require__(__webpack_require__.s = 0);
- })
- ([
- (function(module, exports, __webpack_require__) {
- "use strict";
- Component({
- options: {
- addGlobalClass: true,
- pureDataPattern: /^_/
- },
- properties: {
- duration: {
- type: Number,
- value: 500
- },
- easingFunction: {
- type: String,
- value: 'default'
- },
- loop: {
- type: Boolean,
- value: true
- },
- videoList: {
- type: Array,
- value: [],
- observer: function observer() {
- var newVal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
- this._videoListChanged(newVal);
- }
- }
- },
- data: {
- nextQueue: [],
- prevQueue: [],
- curQueue: [],
- circular: false,
- _last: 1,
- _change: -1,
- _invalidUp: 0,
- _invalidDown: 0,
- _videoContexts: []
- },
- lifetimes: {
- attached: function attached() {
- this.data._videoContexts = [wx.createVideoContext('video_0', this), wx.createVideoContext('video_1', this), wx.createVideoContext('video_2', this)];
- }
- },
- methods: {
- _videoListChanged: function _videoListChanged(newVal) {
- var _this = this;
- var data = this.data;
- newVal.forEach(function (item) {
- data.nextQueue.push(item);
- });
- if (data.curQueue.length === 0) {
- this.setData({
- curQueue: data.nextQueue.splice(0, 3)
- }, function () {
- _this.playCurrent(1);
- });
- }
- },
- animationfinish: function animationfinish(e) {
- var _data = this.data,
- _last = _data._last,
- _change = _data._change,
- curQueue = _data.curQueue,
- prevQueue = _data.prevQueue,
- nextQueue = _data.nextQueue;
- var current = e.detail.current;
- var diff = current - _last;
- if (diff === 0) return;
- this.data._last = current;
- this.playCurrent(current);
- this.triggerEvent('change', { activeId: curQueue[current].id });
- var direction = diff === 1 || diff === -2 ? 'up' : 'down';
- if (direction === 'up') {
- if (this.data._invalidDown === 0) {
- var change = (_change + 1) % 3;
- var add = nextQueue.shift();
- var remove = curQueue[change];
- if (add) {
- prevQueue.push(remove);
- curQueue[change] = add;
- this.data._change = change;
- } else {
- this.data._invalidUp += 1;
- }
- } else {
- this.data._invalidDown -= 1;
- }
- }
- if (direction === 'down') {
- if (this.data._invalidUp === 0) {
- var _change2 = _change;
- var _remove = curQueue[_change2];
- var _add = prevQueue.pop();
- if (_add) {
- curQueue[_change2] = _add;
- nextQueue.unshift(_remove);
- this.data._change = (_change2 - 1 + 3) % 3;
- } else {
- this.data._invalidDown += 1;
- }
- } else {
- this.data._invalidUp -= 1;
- }
- }
- var circular = true;
- if (nextQueue.length === 0 && current !== 0) {
- circular = false;
- }
- if (prevQueue.length === 0 && current !== 2) {
- circular = false;
- }
- this.setData({
- curQueue: curQueue,
- circular: circular
- });
- },
- playCurrent: function playCurrent(current) {
- this.data._videoContexts.forEach(function (ctx, index) {
- index !== current ? ctx.pause() : ctx.play();
- });
- },
- onPlay: function onPlay(e) {
- this.trigger(e, 'play');
- },
- onPause: function onPause(e) {
- this.trigger(e, 'pause');
- },
- onEnded: function onEnded(e) {
- this.trigger(e, 'ended');
- },
- onError: function onError(e) {
- this.trigger(e, 'error');
- },
- onTimeUpdate: function onTimeUpdate(e) {
- this.trigger(e, 'timeupdate');
- },
- onWaiting: function onWaiting(e) {
- this.trigger(e, 'wait');
- },
- onProgress: function onProgress(e) {
- this.trigger(e, 'progress');
- },
- onLoadedMetaData: function onLoadedMetaData(e) {
- this.trigger(e, 'loadedmetadata');
- },
- trigger: function trigger(e, type) {
- var ext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var detail = e.detail;
- var activeId = e.target.dataset.id;
- this.triggerEvent(type, Object.assign(Object.assign(Object.assign({}, detail), { activeId: activeId }), ext));
- }
- }
- });
- })
- ]);
|