@realsee/vreo 1.1.0-dev.2 → 1.2.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/PlayController/createHTMLAudioElement.js +11 -6
- package/lib/PlayController/index.js +80 -15
- package/lib/Player/App.js +26 -1
- package/lib/Player/Controller.js +100 -23
- package/lib/Player/custom/SpatialScenePanel/index.js +68 -42
- package/lib/Player/hooks.js +10 -0
- package/lib/Player/index.js +86 -24
- package/lib/Player/modules/Drawer/index.js +17 -0
- package/lib/Player/modules/PopUp/index.js +10 -0
- package/lib/Player/modules/ResizeObserver/index.js +8 -0
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +108 -17
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +24 -2
- package/lib/Player/modules/VideoAgent/index.js +17 -0
- package/lib/Player/modules/Wave/index.js +32 -7
- package/lib/Player/modules/keyframes/BgMusic/index.js +23 -7
- package/lib/Player/modules/keyframes/CameraMovement/index.js +27 -3
- package/lib/Player/modules/keyframes/InfoPanel/index.d.ts +1 -0
- package/lib/Player/modules/keyframes/InfoPanel/index.js +55 -10
- package/lib/Player/modules/keyframes/ModelVideo/index.js +29 -3
- package/lib/Player/modules/keyframes/PanoEffect/index.js +43 -15
- package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +7 -0
- package/lib/Player/modules/keyframes/PanoTag/index.js +26 -8
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +47 -22
- package/lib/Player/modules/keyframes/Prompter/index.js +32 -10
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +25 -18
- package/lib/Player/modules/keyframes/VideoEffect/index.js +47 -12
- package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +2 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +1 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +1 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/index.js +60 -19
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +5 -2
- package/lib/fivePlugins/CameraMovementPlugin/index.js +76 -28
- package/lib/fivePlugins/CameraMovementPlugin/typings.js +4 -0
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +60 -11
- package/lib/index.js +1 -0
- package/lib/react/index.js +34 -7
- package/lib/shared-utils/Audio.js +69 -15
- package/lib/shared-utils/AudioLike.js +39 -5
- package/lib/shared-utils/Preloader.js +7 -0
- package/lib/shared-utils/addResizeListener.js +5 -0
- package/lib/shared-utils/animationFrame/BetterTween.js +38 -2
- package/lib/shared-utils/animationFrame/index.js +10 -2
- package/lib/shared-utils/animationFrame/tween.js +11 -2
- package/lib/shared-utils/createTransMatrix.js +17 -2
- package/lib/shared-utils/getFileExpandedName.js +1 -0
- package/lib/shared-utils/getMediaInfo.js +9 -0
- package/lib/shared-utils/setElementDataset.js +2 -0
- package/lib/typings/VreoUnit.js +15 -0
- package/package.json +1 -1
|
@@ -1,36 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.createHTMLAudioElement = createHTMLAudioElement;
|
|
8
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
7
|
+
|
|
9
8
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
+
|
|
10
10
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
11
|
+
|
|
11
12
|
var BLANK_AUDIO = '' + 'data:audio/mpeg;base64,' + '//uQxAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAADAAAGhgBVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVWqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr///////////' + '////////////////////////////////8AAAA5TEFNRTMuOThyAc0AAAAAAAAAABSAJAiqQgAAg' + 'AAABobxtI73AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//uQxAACFEII9ACZ/sJZwWEoEb8w/////N//////Jcxj' + 'Hjf+7/v/H2PzCCFAiDtGeyBCIx7bJJ1mmEEMy6g8mm2c8nrGABB4h2Mkmn//4z/73u773R5qHHu' + '/j/w7Kxkzh5lWRWdsifCkNAnY9Zc1HvDAhjhSHdFkHFzLmabt/AQxSg2wwzLhHIJOBnAWwVY4zr' + 'hIYhhc2kvhYDfQ4hDi2Gmh5KyFn8EcGIrHAngNgIwVIEMf5bzbAiTRoAD///8z/KVhkkWEle6IX' + '+d/z4fvH3BShK1e5kmjkCMoxVmXhd4ROlTKo3iipasvTilY21q19ta30/v/0/idPX1v8PNxJL6r' + 'amnOVsdvMv2akO0iSYIzdJFirtzWXCZicS9vHqvSKyqm5XJBdqBwPxyfJdykhWTZ0G0ZyTZGpLK' + 'xsNwwoRhsx3tZfhwmeOBVISm3impAC/IT/8hP/EKEM1KMdVdVKM2rHV4x7HVXZvbVVKN/qq8CiV' + '9VL9jjH/6l6qf7MBCjZmOqsAibjcP+qqqv0oxqpa/NVW286hPo1nz2L/h8+jXt//uSxCmDU2IK/' + 'ECN98KKtE5IYzNoCfbw+u9i5r8PoadUMFPKqWL4LK3T/LCraMSHGkW4bpLXR/E6LlHOVQxmslKV' + 'J8IULktMN06N0FKCpHCoYsjC4F+Z0NVqdNFoGSTjSiyjzLdnZ2fNqTi2eHKONONKLMPMKLONKLM' + 'PQRJGlFxZRoKcJFAYEeIFiRQkUWUeYfef//Ko04soswso40UJAgMw8wosososy0EalnZyjQUGBR' + 'QGIFggOWUacWUeYmuadrZziQKKEgQsQLAhQkUJAgMQDghltLO1onp0cpkNInSFMqlYeSEJ5AHsq' + 'FdOwy1DA2sRmRJKxdKRfLhfLw5BzUxBTUUzLjk4LjJVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVUxBTUUzLjk4LjJVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVf/7ksRRA8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVU=';
|
|
13
|
+
|
|
12
14
|
function createHTMLAudioElement() {
|
|
13
15
|
var ndAudio = document.querySelector('#vreo-playController-audio');
|
|
16
|
+
|
|
14
17
|
if (ndAudio) {
|
|
15
18
|
return ndAudio;
|
|
16
19
|
}
|
|
20
|
+
|
|
17
21
|
var audio = document.createElement('audio');
|
|
18
22
|
audio.style.display = 'none';
|
|
19
23
|
audio.setAttribute('id', 'vreo-playController-audio');
|
|
20
24
|
audio.controls = false;
|
|
21
25
|
document.body.appendChild(audio);
|
|
22
|
-
audio.src = BLANK_AUDIO;
|
|
26
|
+
audio.src = BLANK_AUDIO; // 触发一次播放
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
28
|
+
Promise.resolve( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
29
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
27
30
|
while (1) {
|
|
28
31
|
switch (_context.prev = _context.next) {
|
|
29
32
|
case 0:
|
|
30
33
|
_context.next = 2;
|
|
31
34
|
return audio.play();
|
|
35
|
+
|
|
32
36
|
case 2:
|
|
33
37
|
return _context.abrupt("return", _context.sent);
|
|
38
|
+
|
|
34
39
|
case 3:
|
|
35
40
|
case "end":
|
|
36
41
|
return _context.stop();
|
|
@@ -1,63 +1,98 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.PlayController = void 0;
|
|
9
|
+
|
|
8
10
|
var _five = require("@realsee/five");
|
|
11
|
+
|
|
9
12
|
var _animationFrame = require("../shared-utils/animationFrame");
|
|
13
|
+
|
|
10
14
|
var _createHTMLAudioElement = require("./createHTMLAudioElement");
|
|
11
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
15
|
+
|
|
12
16
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
17
|
+
|
|
13
18
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
19
|
+
|
|
14
20
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21
|
+
|
|
15
22
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
23
|
+
|
|
16
24
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
25
|
+
|
|
17
26
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
18
|
-
|
|
27
|
+
|
|
28
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
29
|
+
|
|
19
30
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
31
|
+
|
|
20
32
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
33
|
+
|
|
21
34
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
35
|
+
|
|
22
36
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
23
|
-
|
|
37
|
+
|
|
38
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
39
|
+
|
|
24
40
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
41
|
+
|
|
25
42
|
var closures = {};
|
|
43
|
+
|
|
26
44
|
var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
27
45
|
_inherits(PlayController, _Subscribe);
|
|
46
|
+
|
|
28
47
|
var _super = _createSuper(PlayController);
|
|
48
|
+
|
|
29
49
|
function PlayController() {
|
|
30
50
|
var _this;
|
|
51
|
+
|
|
31
52
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
53
|
+
|
|
32
54
|
_classCallCheck(this, PlayController);
|
|
55
|
+
|
|
33
56
|
_this = _super.call(this);
|
|
57
|
+
|
|
34
58
|
_defineProperty(_assertThisInitialized(_this), "config", {});
|
|
59
|
+
|
|
35
60
|
if (!config.audio) {
|
|
36
61
|
config.audio = (0, _createHTMLAudioElement.createHTMLAudioElement)();
|
|
37
62
|
}
|
|
63
|
+
|
|
38
64
|
_this.config = Object.assign(_this.config, config);
|
|
65
|
+
|
|
39
66
|
closures.onPlaying = function () {
|
|
40
67
|
return _this.emit('playing');
|
|
41
68
|
};
|
|
69
|
+
|
|
42
70
|
closures.onPaused = function () {
|
|
43
71
|
return _this.emit('paused');
|
|
44
72
|
};
|
|
73
|
+
|
|
45
74
|
closures.onEnded = function () {
|
|
46
75
|
return _this.emit('paused', true);
|
|
47
76
|
};
|
|
77
|
+
|
|
48
78
|
_this.audioInstance.addEventListener('play', closures.onPlaying);
|
|
79
|
+
|
|
49
80
|
_this.audioInstance.addEventListener('pause', closures.onPaused);
|
|
81
|
+
|
|
50
82
|
_this.audioInstance.addEventListener('ended', closures.onEnded);
|
|
83
|
+
|
|
51
84
|
_this.stopInterval = (0, _animationFrame.requestAnimationFrameInterval)(function () {
|
|
52
85
|
if (_this.audioInstance.paused) {
|
|
53
86
|
return;
|
|
54
87
|
}
|
|
88
|
+
|
|
55
89
|
if (!_this.vreoUnit) {
|
|
56
90
|
return;
|
|
57
91
|
}
|
|
92
|
+
|
|
58
93
|
var keyframes = _this.vreoUnit.keyframes;
|
|
59
|
-
var currentTime = _this.currentTime;
|
|
60
|
-
|
|
94
|
+
var currentTime = _this.currentTime; // 没有被解析过且开始时间低于当前时间戳 100ms
|
|
95
|
+
|
|
61
96
|
var currentKeyframes = keyframes.filter(function (keyframe) {
|
|
62
97
|
if (keyframe.parsed) return false;
|
|
63
98
|
var dur = currentTime - keyframe.start;
|
|
@@ -66,15 +101,17 @@ var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
|
66
101
|
currentKeyframes.forEach(function (keyframe) {
|
|
67
102
|
if (keyframe.parsed) return;
|
|
68
103
|
keyframe.parsed = true;
|
|
104
|
+
|
|
69
105
|
_this.emit(keyframe.type, keyframe, _this.currentTime);
|
|
70
106
|
});
|
|
71
107
|
});
|
|
72
108
|
return _this;
|
|
73
109
|
}
|
|
74
|
-
|
|
75
110
|
/**
|
|
76
111
|
* 载入数据
|
|
77
112
|
*/
|
|
113
|
+
|
|
114
|
+
|
|
78
115
|
_createClass(PlayController, [{
|
|
79
116
|
key: "paused",
|
|
80
117
|
get: function get() {
|
|
@@ -94,19 +131,20 @@ var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
|
94
131
|
key: "currentKeyframes",
|
|
95
132
|
get: function get() {
|
|
96
133
|
var _this2 = this;
|
|
134
|
+
|
|
97
135
|
if (!this.vreoUnit) return [];
|
|
98
|
-
var keyframes = this.vreoUnit.keyframes;
|
|
99
|
-
|
|
136
|
+
var keyframes = this.vreoUnit.keyframes; // 没有被解析过且开始时间低于当前时间戳 100ms
|
|
137
|
+
|
|
100
138
|
return keyframes.filter(function (keyframe) {
|
|
101
139
|
if (keyframe.parsed) return false;
|
|
102
140
|
var dur = _this2.currentTime - keyframe.start;
|
|
103
141
|
return dur <= 100 && dur >= 0;
|
|
104
142
|
});
|
|
105
143
|
}
|
|
106
|
-
|
|
107
144
|
/**
|
|
108
145
|
* 音频时长 不一定能获取得到,建议以 VreoUnit 配置的时长为准。
|
|
109
146
|
*/
|
|
147
|
+
|
|
110
148
|
}, {
|
|
111
149
|
key: "duration",
|
|
112
150
|
get: function get() {
|
|
@@ -115,35 +153,46 @@ var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
|
115
153
|
}, {
|
|
116
154
|
key: "load",
|
|
117
155
|
value: function () {
|
|
118
|
-
var _load = _asyncToGenerator( /*#__PURE__*/
|
|
156
|
+
var _load = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(vreoUnit) {
|
|
119
157
|
var _this3 = this;
|
|
120
|
-
|
|
158
|
+
|
|
159
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
121
160
|
while (1) {
|
|
122
161
|
switch (_context.prev = _context.next) {
|
|
123
162
|
case 0:
|
|
124
163
|
this.vreoUnit = vreoUnit;
|
|
125
164
|
_context.next = 3;
|
|
126
165
|
return this.pause();
|
|
166
|
+
|
|
127
167
|
case 3:
|
|
128
168
|
_context.next = 5;
|
|
129
169
|
return new Promise(function (resolve, reject) {
|
|
130
170
|
if (vreoUnit.video.url === _this3.audioInstance.src) {
|
|
131
171
|
return resolve(true);
|
|
132
172
|
}
|
|
173
|
+
|
|
133
174
|
_this3.audioInstance.src = vreoUnit.video.url;
|
|
175
|
+
|
|
134
176
|
var canplaythrough = function canplaythrough() {
|
|
135
177
|
resolve(true);
|
|
178
|
+
|
|
136
179
|
_this3.audioInstance.removeEventListener('canplaythrough', canplaythrough);
|
|
137
180
|
};
|
|
181
|
+
|
|
138
182
|
var error = function error(err) {
|
|
139
183
|
reject(err);
|
|
184
|
+
|
|
140
185
|
_this3.audioInstance.removeEventListener('error', error);
|
|
141
186
|
};
|
|
187
|
+
|
|
142
188
|
_this3.audioInstance.addEventListener('canplaythrough', canplaythrough);
|
|
189
|
+
|
|
143
190
|
_this3.audioInstance.addEventListener('error', error);
|
|
144
191
|
});
|
|
192
|
+
|
|
145
193
|
case 5:
|
|
146
194
|
return _context.abrupt("return", _context.sent);
|
|
195
|
+
|
|
147
196
|
case 6:
|
|
148
197
|
case "end":
|
|
149
198
|
return _context.stop();
|
|
@@ -151,23 +200,27 @@ var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
|
151
200
|
}
|
|
152
201
|
}, _callee, this);
|
|
153
202
|
}));
|
|
203
|
+
|
|
154
204
|
function load(_x) {
|
|
155
205
|
return _load.apply(this, arguments);
|
|
156
206
|
}
|
|
207
|
+
|
|
157
208
|
return load;
|
|
158
209
|
}()
|
|
159
210
|
/**
|
|
160
211
|
* 播放
|
|
161
212
|
*/
|
|
213
|
+
|
|
162
214
|
}, {
|
|
163
215
|
key: "play",
|
|
164
216
|
value: function () {
|
|
165
|
-
var _play = _asyncToGenerator( /*#__PURE__*/
|
|
166
|
-
return
|
|
217
|
+
var _play = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
218
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
167
219
|
while (1) {
|
|
168
220
|
switch (_context2.prev = _context2.next) {
|
|
169
221
|
case 0:
|
|
170
222
|
closures.playPromise = this.audioInstance.play();
|
|
223
|
+
|
|
171
224
|
case 1:
|
|
172
225
|
case "end":
|
|
173
226
|
return _context2.stop();
|
|
@@ -175,19 +228,22 @@ var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
|
175
228
|
}
|
|
176
229
|
}, _callee2, this);
|
|
177
230
|
}));
|
|
231
|
+
|
|
178
232
|
function play() {
|
|
179
233
|
return _play.apply(this, arguments);
|
|
180
234
|
}
|
|
235
|
+
|
|
181
236
|
return play;
|
|
182
237
|
}()
|
|
183
238
|
/**
|
|
184
239
|
* 暂停
|
|
185
240
|
*/
|
|
241
|
+
|
|
186
242
|
}, {
|
|
187
243
|
key: "pause",
|
|
188
244
|
value: function () {
|
|
189
|
-
var _pause = _asyncToGenerator( /*#__PURE__*/
|
|
190
|
-
return
|
|
245
|
+
var _pause = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
|
246
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
191
247
|
while (1) {
|
|
192
248
|
switch (_context3.prev = _context3.next) {
|
|
193
249
|
case 0:
|
|
@@ -195,10 +251,13 @@ var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
|
195
251
|
_context3.next = 3;
|
|
196
252
|
break;
|
|
197
253
|
}
|
|
254
|
+
|
|
198
255
|
_context3.next = 3;
|
|
199
256
|
return closures.playPromise;
|
|
257
|
+
|
|
200
258
|
case 3:
|
|
201
259
|
this.audioInstance.pause();
|
|
260
|
+
|
|
202
261
|
case 4:
|
|
203
262
|
case "end":
|
|
204
263
|
return _context3.stop();
|
|
@@ -206,9 +265,11 @@ var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
|
206
265
|
}
|
|
207
266
|
}, _callee3, this);
|
|
208
267
|
}));
|
|
268
|
+
|
|
209
269
|
function pause() {
|
|
210
270
|
return _pause.apply(this, arguments);
|
|
211
271
|
}
|
|
272
|
+
|
|
212
273
|
return pause;
|
|
213
274
|
}()
|
|
214
275
|
/**
|
|
@@ -217,6 +278,7 @@ var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
|
217
278
|
*
|
|
218
279
|
* @deprecated **慎重执行**
|
|
219
280
|
*/
|
|
281
|
+
|
|
220
282
|
}, {
|
|
221
283
|
key: "dispose",
|
|
222
284
|
value: function dispose() {
|
|
@@ -224,11 +286,14 @@ var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
|
224
286
|
this.audioInstance.removeEventListener('play', closures.onPlaying);
|
|
225
287
|
this.audioInstance.removeEventListener('pasue', closures.onPaused);
|
|
226
288
|
this.audioInstance.removeEventListener('ended', closures.onEnded);
|
|
289
|
+
|
|
227
290
|
if (this.stopInterval) {
|
|
228
291
|
this.stopInterval();
|
|
229
292
|
}
|
|
230
293
|
}
|
|
231
294
|
}]);
|
|
295
|
+
|
|
232
296
|
return PlayController;
|
|
233
297
|
}(_five.Subscribe);
|
|
298
|
+
|
|
234
299
|
exports.PlayController = PlayController;
|
package/lib/Player/App.js
CHANGED
|
@@ -1,32 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.App = App;
|
|
9
|
+
|
|
8
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
9
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
10
14
|
var _mobxReact = require("mobx-react");
|
|
15
|
+
|
|
11
16
|
var _hooks = require("./hooks");
|
|
17
|
+
|
|
12
18
|
var _CameraMovement = require("./modules/keyframes/CameraMovement");
|
|
19
|
+
|
|
13
20
|
var _ResizeObserver = require("./modules/ResizeObserver");
|
|
21
|
+
|
|
14
22
|
var _InfoPanel = require("./modules/keyframes/InfoPanel");
|
|
23
|
+
|
|
15
24
|
var _ModelVideo = require("./modules/keyframes/ModelVideo");
|
|
25
|
+
|
|
16
26
|
var _PanoEffect = require("./modules/keyframes/PanoEffect");
|
|
27
|
+
|
|
17
28
|
var _PanoTag = require("./modules/keyframes/PanoTag");
|
|
29
|
+
|
|
18
30
|
var _PanoTextLabel = require("./modules/keyframes/PanoTextLabel");
|
|
31
|
+
|
|
19
32
|
var _Prompter = require("./modules/keyframes/Prompter");
|
|
33
|
+
|
|
20
34
|
var _UpdateVRPanorama = require("./modules/keyframes/UpdateVRPanorama");
|
|
35
|
+
|
|
21
36
|
var _VideoEffect = require("./modules/keyframes/VideoEffect");
|
|
37
|
+
|
|
22
38
|
var _VideoAgent = require("./modules/VideoAgent");
|
|
39
|
+
|
|
23
40
|
var _BgMusic = require("./modules/keyframes/BgMusic");
|
|
41
|
+
|
|
24
42
|
var _Wave = require("./modules/Wave");
|
|
43
|
+
|
|
25
44
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
45
|
+
|
|
26
46
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
47
|
+
|
|
27
48
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
49
|
+
|
|
28
50
|
var AppView = (0, _mobxReact.observer)(function (_ref) {
|
|
29
51
|
var _controller$configs, _controller$waveAppea, _controller$configs3, _controller$configs4;
|
|
52
|
+
|
|
30
53
|
var controller = _ref.controller;
|
|
31
54
|
return /*#__PURE__*/React.createElement("div", {
|
|
32
55
|
className: (0, _classnames["default"])('vreo-panel', {
|
|
@@ -40,11 +63,12 @@ var AppView = (0, _mobxReact.observer)(function (_ref) {
|
|
|
40
63
|
}), /*#__PURE__*/React.createElement(_VideoAgent.VideoAgent, {
|
|
41
64
|
onClick: function onClick() {
|
|
42
65
|
var _controller$configs2;
|
|
66
|
+
|
|
43
67
|
if ((_controller$configs2 = controller.configs) !== null && _controller$configs2 !== void 0 && _controller$configs2.onAvatarClick) {
|
|
44
68
|
controller.configs.onAvatarClick();
|
|
45
69
|
return;
|
|
46
70
|
}
|
|
47
|
-
|
|
71
|
+
|
|
48
72
|
if (controller.playing) {
|
|
49
73
|
controller.setPlaying(false);
|
|
50
74
|
} else {
|
|
@@ -54,6 +78,7 @@ var AppView = (0, _mobxReact.observer)(function (_ref) {
|
|
|
54
78
|
options: ((_controller$configs3 = controller.configs) === null || _controller$configs3 === void 0 ? void 0 : _controller$configs3.videoAgentMeshOptions) || {}
|
|
55
79
|
}), /*#__PURE__*/React.createElement(_Prompter.Prompter, null), (_controller$configs4 = controller.configs) === null || _controller$configs4 === void 0 ? void 0 : _controller$configs4.customPanelChildren));
|
|
56
80
|
});
|
|
81
|
+
|
|
57
82
|
function App() {
|
|
58
83
|
var controller = (0, _hooks.useController)();
|
|
59
84
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_ResizeObserver.ResizeObserver, null), /*#__PURE__*/React.createElement(_CameraMovement.CameraMovement, null), /*#__PURE__*/React.createElement(_ModelVideo.ModelVideo, null), /*#__PURE__*/React.createElement(_UpdateVRPanorama.UpdateVRPanorama, null), /*#__PURE__*/React.createElement(_VideoEffect.VideoEffect, null), /*#__PURE__*/React.createElement(_PanoTag.PanoTag, null), /*#__PURE__*/React.createElement(_PanoTextLabel.PanoTextLabel, null), /*#__PURE__*/React.createElement(_InfoPanel.InfoPanel, null), /*#__PURE__*/React.createElement(_PanoEffect.PanoEffect, null), /*#__PURE__*/React.createElement(_BgMusic.BgMusic, null)), /*#__PURE__*/React.createElement(AppView, {
|