eligius 1.0.4 → 1.0.6
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/dist/diagnostics/diagnostics.d.ts +1 -0
- package/dist/diagnostics/types.d.ts +1 -1
- package/dist/eligius.cjs.development.js +196 -107
- package/dist/eligius.cjs.development.js.map +1 -1
- package/dist/eligius.cjs.production.min.js +1 -1
- package/dist/eligius.cjs.production.min.js.map +1 -1
- package/dist/eligius.esm.js +195 -106
- package/dist/eligius.esm.js.map +1 -1
- package/dist/engine-factory.d.ts +4 -3
- package/dist/timeline-event-names.d.ts +1 -0
- package/dist/timelineproviders/request-animation-frame-timeline-provider.d.ts +4 -5
- package/dist/types.d.ts +5 -1
- package/dist/util/animation-interval.d.ts +1 -0
- package/dist/util/prepare-value-for-serialization.d.ts +1 -0
- package/package.json +11 -10
|
@@ -4,5 +4,5 @@ export interface IDiagnosticsAgent {
|
|
|
4
4
|
export interface IDiagnosticsInfo {
|
|
5
5
|
get agent(): IDiagnosticsAgent;
|
|
6
6
|
}
|
|
7
|
-
export declare type TDiagnosticType = 'eligius-diagnostics-event' | 'eligius-diagnostics-action';
|
|
7
|
+
export declare type TDiagnosticType = 'eligius-diagnostics-factory' | 'eligius-diagnostics-engine' | 'eligius-diagnostics-event' | 'eligius-diagnostics-action' | 'eligius-diagnostics-action-error' | 'eligius-diagnostics-operation';
|
|
8
8
|
export declare const DEV_TOOLS_KEY = "__ELIGIUS_DEV_TOOLS__";
|
|
@@ -7,7 +7,7 @@ var fs = require('fs');
|
|
|
7
7
|
var path = require('path');
|
|
8
8
|
var lottie = require('lottie-web');
|
|
9
9
|
var $ = require('jquery');
|
|
10
|
-
var
|
|
10
|
+
var hotkeys = require('hotkeys-js');
|
|
11
11
|
var uuid = require('uuid');
|
|
12
12
|
|
|
13
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -16,15 +16,62 @@ var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
|
|
16
16
|
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
17
17
|
var lottie__default = /*#__PURE__*/_interopDefaultLegacy(lottie);
|
|
18
18
|
var $__default = /*#__PURE__*/_interopDefaultLegacy($);
|
|
19
|
-
var
|
|
19
|
+
var hotkeys__default = /*#__PURE__*/_interopDefaultLegacy(hotkeys);
|
|
20
|
+
|
|
21
|
+
function prepareValueForSerialization(value) {
|
|
22
|
+
if (Array.isArray(value)) {
|
|
23
|
+
return value.map(prepareValueForSerialization);
|
|
24
|
+
} else if (typeof value === 'object') {
|
|
25
|
+
return Object.fromEntries(Object.entries(value).map(function (_ref) {
|
|
26
|
+
var name = _ref[0],
|
|
27
|
+
value = _ref[1];
|
|
28
|
+
return [name, prepareValueForSerialization(value)];
|
|
29
|
+
}));
|
|
30
|
+
} else if (typeof value === 'function') {
|
|
31
|
+
return value.toString();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var DevToolEventListener = /*#__PURE__*/function () {
|
|
38
|
+
function DevToolEventListener(agent) {
|
|
39
|
+
this.agent = void 0;
|
|
40
|
+
this.agent = agent;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
var _proto = DevToolEventListener.prototype;
|
|
44
|
+
|
|
45
|
+
_proto.handleEvent = function handleEvent(eventName, eventTopic, args) {
|
|
46
|
+
this.agent.postMessage('eligius-diagnostics-event', {
|
|
47
|
+
eventName: eventName,
|
|
48
|
+
eventTopic: eventTopic,
|
|
49
|
+
args: prepareValueForSerialization(args)
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return DevToolEventListener;
|
|
54
|
+
}();
|
|
55
|
+
|
|
56
|
+
var Diagnostics = /*#__PURE__*/function () {
|
|
57
|
+
function Diagnostics() {}
|
|
58
|
+
|
|
59
|
+
Diagnostics.send = function send(_name, _data) {
|
|
60
|
+
console.log(_name, _data);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
return Diagnostics;
|
|
64
|
+
}();
|
|
65
|
+
Diagnostics.active = void 0;
|
|
66
|
+
|
|
67
|
+
var DEV_TOOLS_KEY = '__ELIGIUS_DEV_TOOLS__';
|
|
20
68
|
|
|
69
|
+
var copyFunction = typeof structuredClone !== 'undefined' ? structuredClone : function (original) {
|
|
70
|
+
return JSON.parse(JSON.stringify(original));
|
|
71
|
+
};
|
|
21
72
|
function deepCopy(original) {
|
|
22
73
|
if (tsIsPresent.isDefined(original)) {
|
|
23
|
-
|
|
24
|
-
return structuredClone(original);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return JSON.parse(JSON.stringify(original));
|
|
74
|
+
return copyFunction(original);
|
|
28
75
|
}
|
|
29
76
|
|
|
30
77
|
return original;
|
|
@@ -48,8 +95,10 @@ var Action = /*#__PURE__*/function () {
|
|
|
48
95
|
var _proto = Action.prototype;
|
|
49
96
|
|
|
50
97
|
_proto.start = function start(initOperationData) {
|
|
51
|
-
var _this
|
|
98
|
+
var _this$name,
|
|
99
|
+
_this = this;
|
|
52
100
|
|
|
101
|
+
Diagnostics.active && Diagnostics.send('eligius-diagnostics-action', ((_this$name = this.name) != null ? _this$name : 'Action') + " begins executing start operations");
|
|
53
102
|
var context = {
|
|
54
103
|
currentIndex: -1,
|
|
55
104
|
eventbus: this.eventbus
|
|
@@ -57,11 +106,20 @@ var Action = /*#__PURE__*/function () {
|
|
|
57
106
|
var result = new Promise(function (resolve, reject) {
|
|
58
107
|
_this.executeOperation(_this.startOperations, 0, resolve, reject, initOperationData, context);
|
|
59
108
|
})["catch"](function (e) {
|
|
109
|
+
Diagnostics.active && Diagnostics.send('eligius-diagnostics-action-error', {
|
|
110
|
+
name: name,
|
|
111
|
+
error: e
|
|
112
|
+
});
|
|
60
113
|
console.error("Error in action start '" + _this.name + "'");
|
|
61
114
|
console.error(e);
|
|
62
115
|
throw e;
|
|
63
116
|
});
|
|
64
|
-
return result
|
|
117
|
+
return !Diagnostics.active ? result : result.then(function (operationsResult) {
|
|
118
|
+
var _this$name2;
|
|
119
|
+
|
|
120
|
+
Diagnostics.send('eligius-diagnostics-action', ((_this$name2 = _this.name) != null ? _this$name2 : 'Action') + " finished executing start operations");
|
|
121
|
+
return operationsResult;
|
|
122
|
+
});
|
|
65
123
|
};
|
|
66
124
|
|
|
67
125
|
_proto.executeOperation = function executeOperation(operations, idx, resolve, reject, previousOperationData, context) {
|
|
@@ -90,6 +148,11 @@ var Action = /*#__PURE__*/function () {
|
|
|
90
148
|
var operationInfo = operations[idx];
|
|
91
149
|
var copy = operationInfo.operationData ? deepCopy(operationInfo.operationData) : {};
|
|
92
150
|
var mergedOperationData = Object.assign(previousOperationData, copy);
|
|
151
|
+
Diagnostics.active && Diagnostics.send('eligius-diagnostics-operation', {
|
|
152
|
+
systemName: operationInfo.systemName,
|
|
153
|
+
operationData: operationInfo.operationData,
|
|
154
|
+
context: context
|
|
155
|
+
});
|
|
93
156
|
var operationResult = operationInfo.instance.call(context, mergedOperationData);
|
|
94
157
|
|
|
95
158
|
if (isPromise(operationResult)) {
|
|
@@ -537,24 +600,30 @@ var EndableAction = /*#__PURE__*/function (_Action) {
|
|
|
537
600
|
var _proto = EndableAction.prototype;
|
|
538
601
|
|
|
539
602
|
_proto.end = function end(initOperationData) {
|
|
540
|
-
var
|
|
603
|
+
var _this$name,
|
|
604
|
+
_this2 = this;
|
|
541
605
|
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
};
|
|
547
|
-
var result = new Promise(function (resolve, reject) {
|
|
548
|
-
_this2.executeOperation(_this2.endOperations, 0, resolve, reject, initOperationData, context);
|
|
549
|
-
})["catch"](function (e) {
|
|
550
|
-
console.error("Error in action end '" + _this2.name + "'");
|
|
551
|
-
throw e;
|
|
552
|
-
});
|
|
553
|
-
return result;
|
|
606
|
+
Diagnostics.active && Diagnostics.send('eligius-diagnostics-action', ((_this$name = this.name) != null ? _this$name : 'Action') + " begins executing end operations");
|
|
607
|
+
|
|
608
|
+
if (!this.endOperations.length) {
|
|
609
|
+
return Promise.resolve(initOperationData);
|
|
554
610
|
}
|
|
555
611
|
|
|
556
|
-
|
|
557
|
-
|
|
612
|
+
var context = {
|
|
613
|
+
currentIndex: -1,
|
|
614
|
+
eventbus: this.eventbus
|
|
615
|
+
};
|
|
616
|
+
var result = new Promise(function (resolve, reject) {
|
|
617
|
+
_this2.executeOperation(_this2.endOperations, 0, resolve, reject, initOperationData, context);
|
|
618
|
+
})["catch"](function (e) {
|
|
619
|
+
console.error("Error in action end '" + _this2.name + "'");
|
|
620
|
+
throw e;
|
|
621
|
+
});
|
|
622
|
+
return !Diagnostics.active ? result : result.then(function (operationsResult) {
|
|
623
|
+
var _this2$name;
|
|
624
|
+
|
|
625
|
+
Diagnostics.send('eligius-diagnostics-action', ((_this2$name = _this2.name) != null ? _this2$name : 'Action') + " finished executing start operations");
|
|
626
|
+
return operationsResult;
|
|
558
627
|
});
|
|
559
628
|
};
|
|
560
629
|
|
|
@@ -631,16 +700,20 @@ function _generateSourceCode(importPaths) {
|
|
|
631
700
|
|
|
632
701
|
return "import {" + imp.systemName + "} from '" + ((_imp$path = imp.path) != null ? _imp$path : 'eligius') + "';";
|
|
633
702
|
}));
|
|
703
|
+
result.push("import { ISimpleResourceImporter } from 'eligius';");
|
|
704
|
+
result.push('');
|
|
634
705
|
result.push('const imports: Record<string, any> = {');
|
|
635
706
|
result.push.apply(result, importPaths.map(function (imp) {
|
|
636
707
|
return imp.systemName + ": { '" + imp.systemName + "': " + imp.systemName + " },";
|
|
637
708
|
}));
|
|
638
709
|
result.push('};');
|
|
710
|
+
result.push('');
|
|
639
711
|
result.push('class EligiusResourceImporter implements ISimpleResourceImporter {');
|
|
640
712
|
result.push('import(name: string): Record<string, any> {');
|
|
641
713
|
result.push('if (imports.hasOwnProperty(name)) { return imports[name]; }');
|
|
642
714
|
result.push('throw Error(`Unknown systemName: ${name}`);');
|
|
643
715
|
result.push('}}');
|
|
716
|
+
result.push('');
|
|
644
717
|
result.push('export default EligiusResourceImporter;');
|
|
645
718
|
return result.join('\n');
|
|
646
719
|
}
|
|
@@ -1002,6 +1075,7 @@ TimelineEventNames.DURATION = 'timeline-duration';
|
|
|
1002
1075
|
TimelineEventNames.TIME = 'timeline-time';
|
|
1003
1076
|
TimelineEventNames.SEEKED = 'timeline-seeked';
|
|
1004
1077
|
TimelineEventNames.COMPLETE = 'timeline-complete';
|
|
1078
|
+
TimelineEventNames.RESTART = 'timeline-restart';
|
|
1005
1079
|
TimelineEventNames.PLAY = 'timeline-play';
|
|
1006
1080
|
TimelineEventNames.STOP = 'timeline-stop';
|
|
1007
1081
|
TimelineEventNames.PAUSE = 'timeline-pause';
|
|
@@ -1960,34 +2034,6 @@ var ctrls = {
|
|
|
1960
2034
|
SubtitlesController: SubtitlesController
|
|
1961
2035
|
};
|
|
1962
2036
|
|
|
1963
|
-
var DevToolEventListener = /*#__PURE__*/function () {
|
|
1964
|
-
function DevToolEventListener(agent) {
|
|
1965
|
-
this.agent = void 0;
|
|
1966
|
-
this.agent = agent;
|
|
1967
|
-
}
|
|
1968
|
-
|
|
1969
|
-
var _proto = DevToolEventListener.prototype;
|
|
1970
|
-
|
|
1971
|
-
_proto.handleEvent = function handleEvent(eventName, eventTopic, args) {
|
|
1972
|
-
this.agent.postMessage('eligius-diagnostics-event', {
|
|
1973
|
-
eventName: eventName,
|
|
1974
|
-
eventTopic: eventTopic
|
|
1975
|
-
});
|
|
1976
|
-
};
|
|
1977
|
-
|
|
1978
|
-
return DevToolEventListener;
|
|
1979
|
-
}();
|
|
1980
|
-
|
|
1981
|
-
var Diagnostics = /*#__PURE__*/function () {
|
|
1982
|
-
function Diagnostics() {}
|
|
1983
|
-
|
|
1984
|
-
Diagnostics.send = function send(_name, _data) {};
|
|
1985
|
-
|
|
1986
|
-
return Diagnostics;
|
|
1987
|
-
}();
|
|
1988
|
-
|
|
1989
|
-
var DEV_TOOLS_KEY = '__ELIGIUS_DEV_TOOLS__';
|
|
1990
|
-
|
|
1991
2037
|
/**
|
|
1992
2038
|
* EligiusEngine, this is where the magic happens. The engine is responsible for starting and stopping
|
|
1993
2039
|
* the given timeline provider and triggering the actions associated with it.
|
|
@@ -2837,24 +2883,38 @@ var LanguageManager = /*#__PURE__*/function () {
|
|
|
2837
2883
|
}();
|
|
2838
2884
|
|
|
2839
2885
|
var EngineFactory = /*#__PURE__*/function () {
|
|
2840
|
-
function EngineFactory(importer, windowRef,
|
|
2886
|
+
function EngineFactory(importer, windowRef, options) {
|
|
2887
|
+
var _options$devtools;
|
|
2888
|
+
|
|
2841
2889
|
this.resizeTimeout = -1;
|
|
2842
2890
|
this.actionsLookup = {};
|
|
2843
2891
|
this.importer = void 0;
|
|
2844
2892
|
this.eventbus = void 0;
|
|
2893
|
+
this._handleSpaceBound = void 0;
|
|
2845
2894
|
this.importer = importer;
|
|
2846
|
-
this.eventbus = eventbus || new Eventbus();
|
|
2895
|
+
this.eventbus = (options == null ? void 0 : options.eventbus) || new Eventbus();
|
|
2896
|
+
Diagnostics.active = (_options$devtools = options == null ? void 0 : options.devtools) != null ? _options$devtools : false;
|
|
2847
2897
|
|
|
2848
|
-
|
|
2898
|
+
if (Diagnostics.active) {
|
|
2899
|
+
this._initializeDevtools(this.eventbus);
|
|
2900
|
+
}
|
|
2849
2901
|
|
|
2850
2902
|
this.eventbus.on(TimelineEventNames.REQUEST_INSTANCE, this._requestInstanceHandler.bind(this));
|
|
2851
2903
|
this.eventbus.on(TimelineEventNames.REQUEST_ACTION, this._requestActionHandler.bind(this));
|
|
2852
2904
|
this.eventbus.on(TimelineEventNames.REQUEST_FUNCTION, this._requestFunctionHandler.bind(this));
|
|
2905
|
+
this._handleSpaceBound = this._handleSpacePress.bind(this);
|
|
2906
|
+
hotkeys__default["default"]('space', this._handleSpaceBound);
|
|
2853
2907
|
$__default["default"](windowRef).resize(this._resizeHandler.bind(this));
|
|
2854
2908
|
}
|
|
2855
2909
|
|
|
2856
2910
|
var _proto = EngineFactory.prototype;
|
|
2857
2911
|
|
|
2912
|
+
_proto._handleSpacePress = function _handleSpacePress(keyboardEvent, _hotkeysEvent) {
|
|
2913
|
+
keyboardEvent.preventDefault();
|
|
2914
|
+
this.eventbus.broadcast(TimelineEventNames.PLAY_TOGGLE_REQUEST);
|
|
2915
|
+
return false;
|
|
2916
|
+
};
|
|
2917
|
+
|
|
2858
2918
|
_proto._initializeDevtools = function _initializeDevtools(eventbus) {
|
|
2859
2919
|
var diagnosticInfo = window[DEV_TOOLS_KEY];
|
|
2860
2920
|
|
|
@@ -2866,11 +2926,16 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
2866
2926
|
Diagnostics.send = function (name, data) {
|
|
2867
2927
|
agent.postMessage(name, data);
|
|
2868
2928
|
};
|
|
2929
|
+
|
|
2930
|
+
Diagnostics.send('eligius-diagnostics-factory', 'Diagnostics initialized');
|
|
2931
|
+
} else {
|
|
2932
|
+
console.warn(DEV_TOOLS_KEY + " property not found on window, please install the extension.");
|
|
2869
2933
|
}
|
|
2870
2934
|
};
|
|
2871
2935
|
|
|
2872
2936
|
_proto.destroy = function destroy() {
|
|
2873
2937
|
this.eventbus.clear();
|
|
2938
|
+
hotkeys__default["default"].unbind('space', this._handleSpaceBound);
|
|
2874
2939
|
};
|
|
2875
2940
|
|
|
2876
2941
|
_proto._resizeHandler = function _resizeHandler() {
|
|
@@ -2915,8 +2980,7 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
2915
2980
|
};
|
|
2916
2981
|
|
|
2917
2982
|
_proto.createEngine = function createEngine(configuration, resolver) {
|
|
2918
|
-
var _configuration$eventA
|
|
2919
|
-
_this2 = this;
|
|
2983
|
+
var _configuration$eventA;
|
|
2920
2984
|
|
|
2921
2985
|
var systemName = configuration.engine.systemName;
|
|
2922
2986
|
|
|
@@ -2944,18 +3008,11 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
2944
3008
|
labels = configuration.labels;
|
|
2945
3009
|
var languageManager = new LanguageManager(language, labels, this.eventbus);
|
|
2946
3010
|
var engineInstance = new EngineClass(resolvedConfiguration, this.eventbus, timelineProviders, languageManager);
|
|
2947
|
-
Mousetrap__default["default"].bind('space', function (event) {
|
|
2948
|
-
event.preventDefault();
|
|
2949
|
-
|
|
2950
|
-
_this2.eventbus.broadcast(TimelineEventNames.PLAY_TOGGLE_REQUEST);
|
|
2951
|
-
|
|
2952
|
-
return false;
|
|
2953
|
-
});
|
|
2954
3011
|
return engineInstance;
|
|
2955
3012
|
};
|
|
2956
3013
|
|
|
2957
3014
|
_proto._createTimelineProviders = function _createTimelineProviders(configuration, eventbus) {
|
|
2958
|
-
var
|
|
3015
|
+
var _this2 = this;
|
|
2959
3016
|
|
|
2960
3017
|
var timelineProviderSettings = configuration.timelineProviderSettings;
|
|
2961
3018
|
var result = Object.entries(timelineProviderSettings).reduce(function (acc, _ref) {
|
|
@@ -2966,7 +3023,7 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
2966
3023
|
return acc;
|
|
2967
3024
|
}
|
|
2968
3025
|
|
|
2969
|
-
var timelineProviderClass =
|
|
3026
|
+
var timelineProviderClass = _this2._importSystemEntry(settings.systemName);
|
|
2970
3027
|
|
|
2971
3028
|
acc[timelineType] = {
|
|
2972
3029
|
id: settings.id,
|
|
@@ -4463,20 +4520,46 @@ var JwPlayerTimelineProvider = /*#__PURE__*/function () {
|
|
|
4463
4520
|
return JwPlayerTimelineProvider;
|
|
4464
4521
|
}();
|
|
4465
4522
|
|
|
4523
|
+
// https://gist.github.com/jakearchibald/cb03f15670817001b1157e62a076fe95
|
|
4524
|
+
function animationInterval(ms, signal, callback) {
|
|
4525
|
+
var _document$timeline$cu, _document, _document$timeline;
|
|
4526
|
+
|
|
4527
|
+
// Prefer currentTime, as it'll better sync animations queued in the
|
|
4528
|
+
// same frame, but if it isn't supported, performance.now() is fine.
|
|
4529
|
+
var start = (_document$timeline$cu = (_document = document) == null ? void 0 : (_document$timeline = _document.timeline) == null ? void 0 : _document$timeline.currentTime) != null ? _document$timeline$cu : performance.now();
|
|
4530
|
+
|
|
4531
|
+
function frame(time) {
|
|
4532
|
+
if (signal.aborted) return;
|
|
4533
|
+
callback(time);
|
|
4534
|
+
scheduleFrame(time);
|
|
4535
|
+
}
|
|
4536
|
+
|
|
4537
|
+
function scheduleFrame(time) {
|
|
4538
|
+
var elapsed = time - start;
|
|
4539
|
+
var roundedElapsed = Math.round(elapsed / ms) * ms;
|
|
4540
|
+
var targetNext = start + roundedElapsed + ms;
|
|
4541
|
+
var delay = targetNext - performance.now();
|
|
4542
|
+
setTimeout(function () {
|
|
4543
|
+
return requestAnimationFrame(frame);
|
|
4544
|
+
}, delay);
|
|
4545
|
+
}
|
|
4546
|
+
|
|
4547
|
+
scheduleFrame(start);
|
|
4548
|
+
}
|
|
4549
|
+
|
|
4466
4550
|
var RequestAnimationFrameTimelineProvider = /*#__PURE__*/function () {
|
|
4467
4551
|
function RequestAnimationFrameTimelineProvider(eventbus, config) {
|
|
4468
4552
|
this.eventbus = void 0;
|
|
4469
4553
|
this.config = void 0;
|
|
4470
|
-
this._requestID = -1;
|
|
4471
|
-
this._last = 0;
|
|
4472
4554
|
this._currentPosition = 0;
|
|
4473
4555
|
this._updateBound = this._update.bind(this);
|
|
4474
4556
|
this._eventbusListeners = [];
|
|
4475
4557
|
this._firstFrame = true;
|
|
4476
4558
|
this._currentPlaylistItem = void 0;
|
|
4477
|
-
this.
|
|
4559
|
+
this._tickInterval = 1000;
|
|
4478
4560
|
this._playlist = void 0;
|
|
4479
4561
|
this._containerElement = void 0;
|
|
4562
|
+
this._abortController = void 0;
|
|
4480
4563
|
this.playState = 'stopped';
|
|
4481
4564
|
this.loop = false;
|
|
4482
4565
|
this.eventbus = eventbus;
|
|
@@ -4531,55 +4614,53 @@ var RequestAnimationFrameTimelineProvider = /*#__PURE__*/function () {
|
|
|
4531
4614
|
this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.DURATION_REQUEST, this.requestDurationHandler.bind(this)));
|
|
4532
4615
|
};
|
|
4533
4616
|
|
|
4534
|
-
_proto._update = function _update(
|
|
4617
|
+
_proto._update = function _update(_now) {
|
|
4535
4618
|
if (this.playState !== 'running') {
|
|
4536
4619
|
return;
|
|
4537
4620
|
}
|
|
4538
4621
|
|
|
4539
|
-
if (
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
}
|
|
4622
|
+
if (this._firstFrame) {
|
|
4623
|
+
this._firstFrame = false;
|
|
4624
|
+
this.eventbus.broadcast(TimelineEventNames.FIRST_FRAME);
|
|
4625
|
+
}
|
|
4544
4626
|
|
|
4545
|
-
|
|
4546
|
-
this._currentPosition++;
|
|
4627
|
+
this._currentPosition++;
|
|
4547
4628
|
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
} else {
|
|
4552
|
-
this.stop();
|
|
4553
|
-
this.eventbus.broadcast(TimelineEventNames.COMPLETE);
|
|
4554
|
-
return;
|
|
4555
|
-
}
|
|
4556
|
-
}
|
|
4629
|
+
if (this._currentPosition > this._currentPlaylistItem.duration) {
|
|
4630
|
+
if (this.loop) {
|
|
4631
|
+
this._resetToStartPosition();
|
|
4557
4632
|
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
}]);
|
|
4633
|
+
this.eventbus.broadcast(TimelineEventNames.RESTART);
|
|
4634
|
+
} else {
|
|
4635
|
+
this.stop();
|
|
4636
|
+
this.eventbus.broadcast(TimelineEventNames.COMPLETE);
|
|
4637
|
+
return;
|
|
4638
|
+
}
|
|
4565
4639
|
}
|
|
4566
4640
|
|
|
4567
|
-
this.
|
|
4641
|
+
this.eventbus.broadcast(TimelineEventNames.TIME, [{
|
|
4642
|
+
position: this._currentPosition
|
|
4643
|
+
}]);
|
|
4644
|
+
this.eventbus.broadcast(TimelineEventNames.POSITION_UPDATE, [{
|
|
4645
|
+
position: this._currentPosition,
|
|
4646
|
+
duration: this._currentPlaylistItem.duration
|
|
4647
|
+
}]);
|
|
4568
4648
|
};
|
|
4569
4649
|
|
|
4570
4650
|
_proto._start = function _start() {
|
|
4571
|
-
|
|
4651
|
+
var _this$_abortControlle;
|
|
4652
|
+
|
|
4653
|
+
if (this.playState === 'running') {
|
|
4572
4654
|
return;
|
|
4573
4655
|
}
|
|
4574
4656
|
|
|
4575
4657
|
this.playState = 'running';
|
|
4576
|
-
|
|
4658
|
+
(_this$_abortControlle = this._abortController) == null ? void 0 : _this$_abortControlle.abort();
|
|
4659
|
+
this._abortController = new AbortController();
|
|
4660
|
+
animationInterval(this._tickInterval, this._abortController.signal, this._updateBound);
|
|
4577
4661
|
};
|
|
4578
4662
|
|
|
4579
|
-
_proto.
|
|
4580
|
-
this._cancelAnimationFrame();
|
|
4581
|
-
|
|
4582
|
-
this._last = 0;
|
|
4663
|
+
_proto._resetToStartPosition = function _resetToStartPosition() {
|
|
4583
4664
|
this._currentPosition = 0;
|
|
4584
4665
|
};
|
|
4585
4666
|
|
|
@@ -4591,12 +4672,18 @@ var RequestAnimationFrameTimelineProvider = /*#__PURE__*/function () {
|
|
|
4591
4672
|
callBack(this._containerElement);
|
|
4592
4673
|
};
|
|
4593
4674
|
|
|
4594
|
-
_proto.
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4675
|
+
_proto._stopAnimationInterval = function _stopAnimationInterval(resetPosition) {
|
|
4676
|
+
var _this$_abortControlle2;
|
|
4677
|
+
|
|
4678
|
+
if (resetPosition === void 0) {
|
|
4679
|
+
resetPosition = true;
|
|
4680
|
+
}
|
|
4681
|
+
|
|
4682
|
+
(_this$_abortControlle2 = this._abortController) == null ? void 0 : _this$_abortControlle2.abort();
|
|
4683
|
+
this._abortController = undefined;
|
|
4684
|
+
|
|
4685
|
+
if (resetPosition) {
|
|
4686
|
+
this._resetToStartPosition();
|
|
4600
4687
|
}
|
|
4601
4688
|
};
|
|
4602
4689
|
|
|
@@ -4641,13 +4728,15 @@ var RequestAnimationFrameTimelineProvider = /*#__PURE__*/function () {
|
|
|
4641
4728
|
};
|
|
4642
4729
|
|
|
4643
4730
|
_proto.stop = function stop() {
|
|
4644
|
-
this.
|
|
4731
|
+
this._stopAnimationInterval();
|
|
4645
4732
|
|
|
4646
4733
|
this.playState = 'stopped';
|
|
4647
4734
|
this.eventbus.broadcast(TimelineEventNames.STOP);
|
|
4648
4735
|
};
|
|
4649
4736
|
|
|
4650
4737
|
_proto.pause = function pause() {
|
|
4738
|
+
this._stopAnimationInterval(false);
|
|
4739
|
+
|
|
4651
4740
|
this.playState = 'paused';
|
|
4652
4741
|
this.eventbus.broadcast(TimelineEventNames.PAUSE);
|
|
4653
4742
|
};
|