eligius 1.0.5 → 1.0.7
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/README.md +2 -0
- package/dist/diagnostics/diagnostics.d.ts +1 -0
- package/dist/diagnostics/types.d.ts +1 -1
- package/dist/eligius.cjs.development.js +212 -108
- 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 +211 -107
- 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
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@ A Javascript engine that allows arbitrary functionality to be triggered accordin
|
|
|
4
4
|
|
|
5
5
|
The engine can be the basis for video annotations, presentation software or interactive infographics, for example.
|
|
6
6
|
|
|
7
|
+
Eligius is NOT a game or animation engine.
|
|
8
|
+
|
|
7
9
|
## description
|
|
8
10
|
|
|
9
11
|
The main concepts in Eligius are timelines, actions and operations. A timeline can be played, paused, stopped and scrubbed through.
|
|
@@ -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,73 @@ 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 (value instanceof jQuery) {
|
|
25
|
+
return 'jQuery object';
|
|
26
|
+
} else if (typeof value === 'object') {
|
|
27
|
+
return Object.fromEntries(Object.entries(value).map(function (_ref) {
|
|
28
|
+
var name = _ref[0],
|
|
29
|
+
value = _ref[1];
|
|
30
|
+
return [name, prepareValueForSerialization(value)];
|
|
31
|
+
}));
|
|
32
|
+
} else if (typeof value === 'function') {
|
|
33
|
+
var funcString = value.toString();
|
|
34
|
+
return funcString.substring(0, funcString.indexOf('{') + 1);
|
|
35
|
+
}
|
|
20
36
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var DevToolEventListener = /*#__PURE__*/function () {
|
|
41
|
+
function DevToolEventListener(agent) {
|
|
42
|
+
this.agent = void 0;
|
|
43
|
+
this.agent = agent;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
var _proto = DevToolEventListener.prototype;
|
|
47
|
+
|
|
48
|
+
_proto.handleEvent = function handleEvent(eventName, eventTopic, args) {
|
|
49
|
+
var message = {
|
|
50
|
+
eventName: eventName,
|
|
51
|
+
eventTopic: eventTopic,
|
|
52
|
+
args: prepareValueForSerialization(args)
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
try {
|
|
56
|
+
this.agent.postMessage('eligius-diagnostics-event', message);
|
|
57
|
+
} catch (e) {
|
|
58
|
+
console.error('postmessage failed');
|
|
59
|
+
console.error(e);
|
|
60
|
+
console.log('message', message);
|
|
25
61
|
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return DevToolEventListener;
|
|
65
|
+
}();
|
|
66
|
+
|
|
67
|
+
var Diagnostics = /*#__PURE__*/function () {
|
|
68
|
+
function Diagnostics() {}
|
|
26
69
|
|
|
27
|
-
|
|
70
|
+
Diagnostics.send = function send(_name, _data) {
|
|
71
|
+
console.log(_name, _data);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return Diagnostics;
|
|
75
|
+
}();
|
|
76
|
+
Diagnostics.active = void 0;
|
|
77
|
+
|
|
78
|
+
var DEV_TOOLS_KEY = '__ELIGIUS_DEV_TOOLS__';
|
|
79
|
+
|
|
80
|
+
var copyFunction = typeof structuredClone !== 'undefined' ? structuredClone : function (original) {
|
|
81
|
+
return JSON.parse(JSON.stringify(original));
|
|
82
|
+
};
|
|
83
|
+
function deepCopy(original) {
|
|
84
|
+
if (tsIsPresent.isDefined(original)) {
|
|
85
|
+
return copyFunction(original);
|
|
28
86
|
}
|
|
29
87
|
|
|
30
88
|
return original;
|
|
@@ -48,8 +106,10 @@ var Action = /*#__PURE__*/function () {
|
|
|
48
106
|
var _proto = Action.prototype;
|
|
49
107
|
|
|
50
108
|
_proto.start = function start(initOperationData) {
|
|
51
|
-
var _this
|
|
109
|
+
var _this$name,
|
|
110
|
+
_this = this;
|
|
52
111
|
|
|
112
|
+
Diagnostics.active && Diagnostics.send('eligius-diagnostics-action', ((_this$name = this.name) != null ? _this$name : 'Action') + " begins executing start operations");
|
|
53
113
|
var context = {
|
|
54
114
|
currentIndex: -1,
|
|
55
115
|
eventbus: this.eventbus
|
|
@@ -57,11 +117,20 @@ var Action = /*#__PURE__*/function () {
|
|
|
57
117
|
var result = new Promise(function (resolve, reject) {
|
|
58
118
|
_this.executeOperation(_this.startOperations, 0, resolve, reject, initOperationData, context);
|
|
59
119
|
})["catch"](function (e) {
|
|
120
|
+
Diagnostics.active && Diagnostics.send('eligius-diagnostics-action-error', {
|
|
121
|
+
name: name,
|
|
122
|
+
error: e
|
|
123
|
+
});
|
|
60
124
|
console.error("Error in action start '" + _this.name + "'");
|
|
61
125
|
console.error(e);
|
|
62
126
|
throw e;
|
|
63
127
|
});
|
|
64
|
-
return result
|
|
128
|
+
return !Diagnostics.active ? result : result.then(function (operationsResult) {
|
|
129
|
+
var _this$name2;
|
|
130
|
+
|
|
131
|
+
Diagnostics.send('eligius-diagnostics-action', ((_this$name2 = _this.name) != null ? _this$name2 : 'Action') + " finished executing start operations");
|
|
132
|
+
return operationsResult;
|
|
133
|
+
});
|
|
65
134
|
};
|
|
66
135
|
|
|
67
136
|
_proto.executeOperation = function executeOperation(operations, idx, resolve, reject, previousOperationData, context) {
|
|
@@ -90,6 +159,11 @@ var Action = /*#__PURE__*/function () {
|
|
|
90
159
|
var operationInfo = operations[idx];
|
|
91
160
|
var copy = operationInfo.operationData ? deepCopy(operationInfo.operationData) : {};
|
|
92
161
|
var mergedOperationData = Object.assign(previousOperationData, copy);
|
|
162
|
+
Diagnostics.active && Diagnostics.send('eligius-diagnostics-operation', {
|
|
163
|
+
systemName: operationInfo.systemName,
|
|
164
|
+
operationData: operationInfo.operationData,
|
|
165
|
+
context: context
|
|
166
|
+
});
|
|
93
167
|
var operationResult = operationInfo.instance.call(context, mergedOperationData);
|
|
94
168
|
|
|
95
169
|
if (isPromise(operationResult)) {
|
|
@@ -537,24 +611,30 @@ var EndableAction = /*#__PURE__*/function (_Action) {
|
|
|
537
611
|
var _proto = EndableAction.prototype;
|
|
538
612
|
|
|
539
613
|
_proto.end = function end(initOperationData) {
|
|
540
|
-
var
|
|
614
|
+
var _this$name,
|
|
615
|
+
_this2 = this;
|
|
541
616
|
|
|
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;
|
|
617
|
+
Diagnostics.active && Diagnostics.send('eligius-diagnostics-action', ((_this$name = this.name) != null ? _this$name : 'Action') + " begins executing end operations");
|
|
618
|
+
|
|
619
|
+
if (!this.endOperations.length) {
|
|
620
|
+
return Promise.resolve(initOperationData);
|
|
554
621
|
}
|
|
555
622
|
|
|
556
|
-
|
|
557
|
-
|
|
623
|
+
var context = {
|
|
624
|
+
currentIndex: -1,
|
|
625
|
+
eventbus: this.eventbus
|
|
626
|
+
};
|
|
627
|
+
var result = new Promise(function (resolve, reject) {
|
|
628
|
+
_this2.executeOperation(_this2.endOperations, 0, resolve, reject, initOperationData, context);
|
|
629
|
+
})["catch"](function (e) {
|
|
630
|
+
console.error("Error in action end '" + _this2.name + "'");
|
|
631
|
+
throw e;
|
|
632
|
+
});
|
|
633
|
+
return !Diagnostics.active ? result : result.then(function (operationsResult) {
|
|
634
|
+
var _this2$name;
|
|
635
|
+
|
|
636
|
+
Diagnostics.send('eligius-diagnostics-action', ((_this2$name = _this2.name) != null ? _this2$name : 'Action') + " finished executing start operations");
|
|
637
|
+
return operationsResult;
|
|
558
638
|
});
|
|
559
639
|
};
|
|
560
640
|
|
|
@@ -1006,6 +1086,7 @@ TimelineEventNames.DURATION = 'timeline-duration';
|
|
|
1006
1086
|
TimelineEventNames.TIME = 'timeline-time';
|
|
1007
1087
|
TimelineEventNames.SEEKED = 'timeline-seeked';
|
|
1008
1088
|
TimelineEventNames.COMPLETE = 'timeline-complete';
|
|
1089
|
+
TimelineEventNames.RESTART = 'timeline-restart';
|
|
1009
1090
|
TimelineEventNames.PLAY = 'timeline-play';
|
|
1010
1091
|
TimelineEventNames.STOP = 'timeline-stop';
|
|
1011
1092
|
TimelineEventNames.PAUSE = 'timeline-pause';
|
|
@@ -1964,34 +2045,6 @@ var ctrls = {
|
|
|
1964
2045
|
SubtitlesController: SubtitlesController
|
|
1965
2046
|
};
|
|
1966
2047
|
|
|
1967
|
-
var DevToolEventListener = /*#__PURE__*/function () {
|
|
1968
|
-
function DevToolEventListener(agent) {
|
|
1969
|
-
this.agent = void 0;
|
|
1970
|
-
this.agent = agent;
|
|
1971
|
-
}
|
|
1972
|
-
|
|
1973
|
-
var _proto = DevToolEventListener.prototype;
|
|
1974
|
-
|
|
1975
|
-
_proto.handleEvent = function handleEvent(eventName, eventTopic, args) {
|
|
1976
|
-
this.agent.postMessage('eligius-diagnostics-event', {
|
|
1977
|
-
eventName: eventName,
|
|
1978
|
-
eventTopic: eventTopic
|
|
1979
|
-
});
|
|
1980
|
-
};
|
|
1981
|
-
|
|
1982
|
-
return DevToolEventListener;
|
|
1983
|
-
}();
|
|
1984
|
-
|
|
1985
|
-
var Diagnostics = /*#__PURE__*/function () {
|
|
1986
|
-
function Diagnostics() {}
|
|
1987
|
-
|
|
1988
|
-
Diagnostics.send = function send(_name, _data) {};
|
|
1989
|
-
|
|
1990
|
-
return Diagnostics;
|
|
1991
|
-
}();
|
|
1992
|
-
|
|
1993
|
-
var DEV_TOOLS_KEY = '__ELIGIUS_DEV_TOOLS__';
|
|
1994
|
-
|
|
1995
2048
|
/**
|
|
1996
2049
|
* EligiusEngine, this is where the magic happens. The engine is responsible for starting and stopping
|
|
1997
2050
|
* the given timeline provider and triggering the actions associated with it.
|
|
@@ -2841,24 +2894,38 @@ var LanguageManager = /*#__PURE__*/function () {
|
|
|
2841
2894
|
}();
|
|
2842
2895
|
|
|
2843
2896
|
var EngineFactory = /*#__PURE__*/function () {
|
|
2844
|
-
function EngineFactory(importer, windowRef,
|
|
2897
|
+
function EngineFactory(importer, windowRef, options) {
|
|
2898
|
+
var _options$devtools;
|
|
2899
|
+
|
|
2845
2900
|
this.resizeTimeout = -1;
|
|
2846
2901
|
this.actionsLookup = {};
|
|
2847
2902
|
this.importer = void 0;
|
|
2848
2903
|
this.eventbus = void 0;
|
|
2904
|
+
this._handleSpaceBound = void 0;
|
|
2849
2905
|
this.importer = importer;
|
|
2850
|
-
this.eventbus = eventbus || new Eventbus();
|
|
2906
|
+
this.eventbus = (options == null ? void 0 : options.eventbus) || new Eventbus();
|
|
2907
|
+
Diagnostics.active = (_options$devtools = options == null ? void 0 : options.devtools) != null ? _options$devtools : false;
|
|
2851
2908
|
|
|
2852
|
-
|
|
2909
|
+
if (Diagnostics.active) {
|
|
2910
|
+
this._initializeDevtools(this.eventbus);
|
|
2911
|
+
}
|
|
2853
2912
|
|
|
2854
2913
|
this.eventbus.on(TimelineEventNames.REQUEST_INSTANCE, this._requestInstanceHandler.bind(this));
|
|
2855
2914
|
this.eventbus.on(TimelineEventNames.REQUEST_ACTION, this._requestActionHandler.bind(this));
|
|
2856
2915
|
this.eventbus.on(TimelineEventNames.REQUEST_FUNCTION, this._requestFunctionHandler.bind(this));
|
|
2916
|
+
this._handleSpaceBound = this._handleSpacePress.bind(this);
|
|
2917
|
+
hotkeys__default["default"]('space', this._handleSpaceBound);
|
|
2857
2918
|
$__default["default"](windowRef).resize(this._resizeHandler.bind(this));
|
|
2858
2919
|
}
|
|
2859
2920
|
|
|
2860
2921
|
var _proto = EngineFactory.prototype;
|
|
2861
2922
|
|
|
2923
|
+
_proto._handleSpacePress = function _handleSpacePress(keyboardEvent, _hotkeysEvent) {
|
|
2924
|
+
keyboardEvent.preventDefault();
|
|
2925
|
+
this.eventbus.broadcast(TimelineEventNames.PLAY_TOGGLE_REQUEST);
|
|
2926
|
+
return false;
|
|
2927
|
+
};
|
|
2928
|
+
|
|
2862
2929
|
_proto._initializeDevtools = function _initializeDevtools(eventbus) {
|
|
2863
2930
|
var diagnosticInfo = window[DEV_TOOLS_KEY];
|
|
2864
2931
|
|
|
@@ -2868,13 +2935,26 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
2868
2935
|
eventbus.registerEventlistener(eventbusListener);
|
|
2869
2936
|
|
|
2870
2937
|
Diagnostics.send = function (name, data) {
|
|
2871
|
-
|
|
2938
|
+
var message = prepareValueForSerialization(data);
|
|
2939
|
+
|
|
2940
|
+
try {
|
|
2941
|
+
agent.postMessage(name, message);
|
|
2942
|
+
} catch (e) {
|
|
2943
|
+
console.error('postmessage failed');
|
|
2944
|
+
console.error(e);
|
|
2945
|
+
console.log('message', message);
|
|
2946
|
+
}
|
|
2872
2947
|
};
|
|
2948
|
+
|
|
2949
|
+
Diagnostics.send('eligius-diagnostics-factory', 'Diagnostics initialized');
|
|
2950
|
+
} else {
|
|
2951
|
+
console.warn(DEV_TOOLS_KEY + " property not found on window, please install the extension.");
|
|
2873
2952
|
}
|
|
2874
2953
|
};
|
|
2875
2954
|
|
|
2876
2955
|
_proto.destroy = function destroy() {
|
|
2877
2956
|
this.eventbus.clear();
|
|
2957
|
+
hotkeys__default["default"].unbind('space', this._handleSpaceBound);
|
|
2878
2958
|
};
|
|
2879
2959
|
|
|
2880
2960
|
_proto._resizeHandler = function _resizeHandler() {
|
|
@@ -2919,8 +2999,7 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
2919
2999
|
};
|
|
2920
3000
|
|
|
2921
3001
|
_proto.createEngine = function createEngine(configuration, resolver) {
|
|
2922
|
-
var _configuration$eventA
|
|
2923
|
-
_this2 = this;
|
|
3002
|
+
var _configuration$eventA;
|
|
2924
3003
|
|
|
2925
3004
|
var systemName = configuration.engine.systemName;
|
|
2926
3005
|
|
|
@@ -2948,18 +3027,11 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
2948
3027
|
labels = configuration.labels;
|
|
2949
3028
|
var languageManager = new LanguageManager(language, labels, this.eventbus);
|
|
2950
3029
|
var engineInstance = new EngineClass(resolvedConfiguration, this.eventbus, timelineProviders, languageManager);
|
|
2951
|
-
Mousetrap__default["default"].bind('space', function (event) {
|
|
2952
|
-
event.preventDefault();
|
|
2953
|
-
|
|
2954
|
-
_this2.eventbus.broadcast(TimelineEventNames.PLAY_TOGGLE_REQUEST);
|
|
2955
|
-
|
|
2956
|
-
return false;
|
|
2957
|
-
});
|
|
2958
3030
|
return engineInstance;
|
|
2959
3031
|
};
|
|
2960
3032
|
|
|
2961
3033
|
_proto._createTimelineProviders = function _createTimelineProviders(configuration, eventbus) {
|
|
2962
|
-
var
|
|
3034
|
+
var _this2 = this;
|
|
2963
3035
|
|
|
2964
3036
|
var timelineProviderSettings = configuration.timelineProviderSettings;
|
|
2965
3037
|
var result = Object.entries(timelineProviderSettings).reduce(function (acc, _ref) {
|
|
@@ -2970,7 +3042,7 @@ var EngineFactory = /*#__PURE__*/function () {
|
|
|
2970
3042
|
return acc;
|
|
2971
3043
|
}
|
|
2972
3044
|
|
|
2973
|
-
var timelineProviderClass =
|
|
3045
|
+
var timelineProviderClass = _this2._importSystemEntry(settings.systemName);
|
|
2974
3046
|
|
|
2975
3047
|
acc[timelineType] = {
|
|
2976
3048
|
id: settings.id,
|
|
@@ -4467,20 +4539,46 @@ var JwPlayerTimelineProvider = /*#__PURE__*/function () {
|
|
|
4467
4539
|
return JwPlayerTimelineProvider;
|
|
4468
4540
|
}();
|
|
4469
4541
|
|
|
4542
|
+
// https://gist.github.com/jakearchibald/cb03f15670817001b1157e62a076fe95
|
|
4543
|
+
function animationInterval(ms, signal, callback) {
|
|
4544
|
+
var _document$timeline$cu, _document, _document$timeline;
|
|
4545
|
+
|
|
4546
|
+
// Prefer currentTime, as it'll better sync animations queued in the
|
|
4547
|
+
// same frame, but if it isn't supported, performance.now() is fine.
|
|
4548
|
+
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();
|
|
4549
|
+
|
|
4550
|
+
function frame(time) {
|
|
4551
|
+
if (signal.aborted) return;
|
|
4552
|
+
callback(time);
|
|
4553
|
+
scheduleFrame(time);
|
|
4554
|
+
}
|
|
4555
|
+
|
|
4556
|
+
function scheduleFrame(time) {
|
|
4557
|
+
var elapsed = time - start;
|
|
4558
|
+
var roundedElapsed = Math.round(elapsed / ms) * ms;
|
|
4559
|
+
var targetNext = start + roundedElapsed + ms;
|
|
4560
|
+
var delay = targetNext - performance.now();
|
|
4561
|
+
setTimeout(function () {
|
|
4562
|
+
return requestAnimationFrame(frame);
|
|
4563
|
+
}, delay);
|
|
4564
|
+
}
|
|
4565
|
+
|
|
4566
|
+
scheduleFrame(start);
|
|
4567
|
+
}
|
|
4568
|
+
|
|
4470
4569
|
var RequestAnimationFrameTimelineProvider = /*#__PURE__*/function () {
|
|
4471
4570
|
function RequestAnimationFrameTimelineProvider(eventbus, config) {
|
|
4472
4571
|
this.eventbus = void 0;
|
|
4473
4572
|
this.config = void 0;
|
|
4474
|
-
this._requestID = -1;
|
|
4475
|
-
this._last = 0;
|
|
4476
4573
|
this._currentPosition = 0;
|
|
4477
4574
|
this._updateBound = this._update.bind(this);
|
|
4478
4575
|
this._eventbusListeners = [];
|
|
4479
4576
|
this._firstFrame = true;
|
|
4480
4577
|
this._currentPlaylistItem = void 0;
|
|
4481
|
-
this.
|
|
4578
|
+
this._tickInterval = 1000;
|
|
4482
4579
|
this._playlist = void 0;
|
|
4483
4580
|
this._containerElement = void 0;
|
|
4581
|
+
this._abortController = void 0;
|
|
4484
4582
|
this.playState = 'stopped';
|
|
4485
4583
|
this.loop = false;
|
|
4486
4584
|
this.eventbus = eventbus;
|
|
@@ -4535,55 +4633,53 @@ var RequestAnimationFrameTimelineProvider = /*#__PURE__*/function () {
|
|
|
4535
4633
|
this._eventbusListeners.push(this.eventbus.on(TimelineEventNames.DURATION_REQUEST, this.requestDurationHandler.bind(this)));
|
|
4536
4634
|
};
|
|
4537
4635
|
|
|
4538
|
-
_proto._update = function _update(
|
|
4636
|
+
_proto._update = function _update(_now) {
|
|
4539
4637
|
if (this.playState !== 'running') {
|
|
4540
4638
|
return;
|
|
4541
4639
|
}
|
|
4542
4640
|
|
|
4543
|
-
if (
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
}
|
|
4641
|
+
if (this._firstFrame) {
|
|
4642
|
+
this._firstFrame = false;
|
|
4643
|
+
this.eventbus.broadcast(TimelineEventNames.FIRST_FRAME);
|
|
4644
|
+
}
|
|
4548
4645
|
|
|
4549
|
-
|
|
4550
|
-
this._currentPosition++;
|
|
4646
|
+
this._currentPosition++;
|
|
4551
4647
|
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
} else {
|
|
4556
|
-
this.stop();
|
|
4557
|
-
this.eventbus.broadcast(TimelineEventNames.COMPLETE);
|
|
4558
|
-
return;
|
|
4559
|
-
}
|
|
4560
|
-
}
|
|
4648
|
+
if (this._currentPosition > this._currentPlaylistItem.duration) {
|
|
4649
|
+
if (this.loop) {
|
|
4650
|
+
this._resetToStartPosition();
|
|
4561
4651
|
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
}]);
|
|
4652
|
+
this.eventbus.broadcast(TimelineEventNames.RESTART);
|
|
4653
|
+
} else {
|
|
4654
|
+
this.stop();
|
|
4655
|
+
this.eventbus.broadcast(TimelineEventNames.COMPLETE);
|
|
4656
|
+
return;
|
|
4657
|
+
}
|
|
4569
4658
|
}
|
|
4570
4659
|
|
|
4571
|
-
this.
|
|
4660
|
+
this.eventbus.broadcast(TimelineEventNames.TIME, [{
|
|
4661
|
+
position: this._currentPosition
|
|
4662
|
+
}]);
|
|
4663
|
+
this.eventbus.broadcast(TimelineEventNames.POSITION_UPDATE, [{
|
|
4664
|
+
position: this._currentPosition,
|
|
4665
|
+
duration: this._currentPlaylistItem.duration
|
|
4666
|
+
}]);
|
|
4572
4667
|
};
|
|
4573
4668
|
|
|
4574
4669
|
_proto._start = function _start() {
|
|
4575
|
-
|
|
4670
|
+
var _this$_abortControlle;
|
|
4671
|
+
|
|
4672
|
+
if (this.playState === 'running') {
|
|
4576
4673
|
return;
|
|
4577
4674
|
}
|
|
4578
4675
|
|
|
4579
4676
|
this.playState = 'running';
|
|
4580
|
-
|
|
4677
|
+
(_this$_abortControlle = this._abortController) == null ? void 0 : _this$_abortControlle.abort();
|
|
4678
|
+
this._abortController = new AbortController();
|
|
4679
|
+
animationInterval(this._tickInterval, this._abortController.signal, this._updateBound);
|
|
4581
4680
|
};
|
|
4582
4681
|
|
|
4583
|
-
_proto.
|
|
4584
|
-
this._cancelAnimationFrame();
|
|
4585
|
-
|
|
4586
|
-
this._last = 0;
|
|
4682
|
+
_proto._resetToStartPosition = function _resetToStartPosition() {
|
|
4587
4683
|
this._currentPosition = 0;
|
|
4588
4684
|
};
|
|
4589
4685
|
|
|
@@ -4595,12 +4691,18 @@ var RequestAnimationFrameTimelineProvider = /*#__PURE__*/function () {
|
|
|
4595
4691
|
callBack(this._containerElement);
|
|
4596
4692
|
};
|
|
4597
4693
|
|
|
4598
|
-
_proto.
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4694
|
+
_proto._stopAnimationInterval = function _stopAnimationInterval(resetPosition) {
|
|
4695
|
+
var _this$_abortControlle2;
|
|
4696
|
+
|
|
4697
|
+
if (resetPosition === void 0) {
|
|
4698
|
+
resetPosition = true;
|
|
4699
|
+
}
|
|
4700
|
+
|
|
4701
|
+
(_this$_abortControlle2 = this._abortController) == null ? void 0 : _this$_abortControlle2.abort();
|
|
4702
|
+
this._abortController = undefined;
|
|
4703
|
+
|
|
4704
|
+
if (resetPosition) {
|
|
4705
|
+
this._resetToStartPosition();
|
|
4604
4706
|
}
|
|
4605
4707
|
};
|
|
4606
4708
|
|
|
@@ -4645,13 +4747,15 @@ var RequestAnimationFrameTimelineProvider = /*#__PURE__*/function () {
|
|
|
4645
4747
|
};
|
|
4646
4748
|
|
|
4647
4749
|
_proto.stop = function stop() {
|
|
4648
|
-
this.
|
|
4750
|
+
this._stopAnimationInterval();
|
|
4649
4751
|
|
|
4650
4752
|
this.playState = 'stopped';
|
|
4651
4753
|
this.eventbus.broadcast(TimelineEventNames.STOP);
|
|
4652
4754
|
};
|
|
4653
4755
|
|
|
4654
4756
|
_proto.pause = function pause() {
|
|
4757
|
+
this._stopAnimationInterval(false);
|
|
4758
|
+
|
|
4655
4759
|
this.playState = 'paused';
|
|
4656
4760
|
this.eventbus.broadcast(TimelineEventNames.PAUSE);
|
|
4657
4761
|
};
|