timingsrc 1.1.17
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/LICENSE +21 -0
- package/README.md +47 -0
- package/build/es2019/factories/default-set-timingsrc.d.ts +3 -0
- package/build/es2019/factories/default-set-timingsrc.d.ts.map +1 -0
- package/build/es2019/factories/default-set-timingsrc.js +7 -0
- package/build/es2019/factories/default-set-timingsrc.js.map +1 -0
- package/build/es2019/factories/set-current-time.d.ts +3 -0
- package/build/es2019/factories/set-current-time.d.ts.map +1 -0
- package/build/es2019/factories/set-current-time.js +10 -0
- package/build/es2019/factories/set-current-time.js.map +1 -0
- package/build/es2019/factories/set-playback-rate.d.ts +3 -0
- package/build/es2019/factories/set-playback-rate.d.ts.map +1 -0
- package/build/es2019/factories/set-playback-rate.js +13 -0
- package/build/es2019/factories/set-playback-rate.js.map +1 -0
- package/build/es2019/factories/set-timingsrc-with-custom-update-function.d.ts +3 -0
- package/build/es2019/factories/set-timingsrc-with-custom-update-function.d.ts.map +1 -0
- package/build/es2019/factories/set-timingsrc-with-custom-update-function.js +10 -0
- package/build/es2019/factories/set-timingsrc-with-custom-update-function.js.map +1 -0
- package/build/es2019/factories/set-timingsrc.d.ts +3 -0
- package/build/es2019/factories/set-timingsrc.d.ts.map +1 -0
- package/build/es2019/factories/set-timingsrc.js +4 -0
- package/build/es2019/factories/set-timingsrc.js.map +1 -0
- package/build/es2019/factories/update-gradually.d.ts +3 -0
- package/build/es2019/factories/update-gradually.d.ts.map +1 -0
- package/build/es2019/factories/update-gradually.js +17 -0
- package/build/es2019/factories/update-gradually.js.map +1 -0
- package/build/es2019/factories/update-media-element.d.ts +3 -0
- package/build/es2019/factories/update-media-element.d.ts.map +1 -0
- package/build/es2019/factories/update-media-element.js +38 -0
- package/build/es2019/factories/update-media-element.js.map +1 -0
- package/build/es2019/factories/update-stepwise-factory.d.ts +3 -0
- package/build/es2019/factories/update-stepwise-factory.d.ts.map +1 -0
- package/build/es2019/factories/update-stepwise-factory.js +37 -0
- package/build/es2019/factories/update-stepwise-factory.js.map +1 -0
- package/build/es2019/factories/window.d.ts +3 -0
- package/build/es2019/factories/window.d.ts.map +1 -0
- package/build/es2019/factories/window.js +2 -0
- package/build/es2019/factories/window.js.map +1 -0
- package/build/es2019/functions/pause.d.ts +2 -0
- package/build/es2019/functions/pause.d.ts.map +1 -0
- package/build/es2019/functions/pause.js +6 -0
- package/build/es2019/functions/pause.js.map +1 -0
- package/build/es2019/functions/play.d.ts +2 -0
- package/build/es2019/functions/play.d.ts.map +1 -0
- package/build/es2019/functions/play.js +6 -0
- package/build/es2019/functions/play.js.map +1 -0
- package/build/es2019/interfaces/index.d.ts +2 -0
- package/build/es2019/interfaces/index.d.ts.map +1 -0
- package/build/es2019/interfaces/index.js +2 -0
- package/build/es2019/interfaces/index.js.map +1 -0
- package/build/es2019/interfaces/update-vector.d.ts +5 -0
- package/build/es2019/interfaces/update-vector.d.ts.map +1 -0
- package/build/es2019/interfaces/update-vector.js +2 -0
- package/build/es2019/interfaces/update-vector.js.map +1 -0
- package/build/es2019/module.d.ts +8 -0
- package/build/es2019/module.d.ts.map +1 -0
- package/build/es2019/module.js +20 -0
- package/build/es2019/module.js.map +1 -0
- package/build/es2019/types/default-timingsrc-factory.d.ts +7 -0
- package/build/es2019/types/default-timingsrc-factory.d.ts.map +1 -0
- package/build/es2019/types/default-timingsrc-factory.js +2 -0
- package/build/es2019/types/default-timingsrc-factory.js.map +1 -0
- package/build/es2019/types/index.d.ts +19 -0
- package/build/es2019/types/index.d.ts.map +1 -0
- package/build/es2019/types/index.js +19 -0
- package/build/es2019/types/index.js.map +1 -0
- package/build/es2019/types/pause-function.d.ts +2 -0
- package/build/es2019/types/pause-function.d.ts.map +1 -0
- package/build/es2019/types/pause-function.js +2 -0
- package/build/es2019/types/pause-function.js.map +1 -0
- package/build/es2019/types/play-function.d.ts +2 -0
- package/build/es2019/types/play-function.d.ts.map +1 -0
- package/build/es2019/types/play-function.js +2 -0
- package/build/es2019/types/play-function.js.map +1 -0
- package/build/es2019/types/prepare-timing-state-vector-function.d.ts +3 -0
- package/build/es2019/types/prepare-timing-state-vector-function.d.ts.map +1 -0
- package/build/es2019/types/prepare-timing-state-vector-function.js +2 -0
- package/build/es2019/types/prepare-timing-state-vector-function.js.map +1 -0
- package/build/es2019/types/set-current-time-factory.d.ts +3 -0
- package/build/es2019/types/set-current-time-factory.d.ts.map +1 -0
- package/build/es2019/types/set-current-time-factory.js +2 -0
- package/build/es2019/types/set-current-time-factory.js.map +1 -0
- package/build/es2019/types/set-current-time-function.d.ts +2 -0
- package/build/es2019/types/set-current-time-function.d.ts.map +1 -0
- package/build/es2019/types/set-current-time-function.js +2 -0
- package/build/es2019/types/set-current-time-function.js.map +1 -0
- package/build/es2019/types/set-playback-rate-factory.d.ts +3 -0
- package/build/es2019/types/set-playback-rate-factory.d.ts.map +1 -0
- package/build/es2019/types/set-playback-rate-factory.js +2 -0
- package/build/es2019/types/set-playback-rate-factory.js.map +1 -0
- package/build/es2019/types/set-playback-rate-function.d.ts +2 -0
- package/build/es2019/types/set-playback-rate-function.d.ts.map +1 -0
- package/build/es2019/types/set-playback-rate-function.js +2 -0
- package/build/es2019/types/set-playback-rate-function.js.map +1 -0
- package/build/es2019/types/set-timingsrc-factory.d.ts +5 -0
- package/build/es2019/types/set-timingsrc-factory.d.ts.map +1 -0
- package/build/es2019/types/set-timingsrc-factory.js +2 -0
- package/build/es2019/types/set-timingsrc-factory.js.map +1 -0
- package/build/es2019/types/set-timingsrc-function.d.ts +4 -0
- package/build/es2019/types/set-timingsrc-function.d.ts.map +1 -0
- package/build/es2019/types/set-timingsrc-function.js +2 -0
- package/build/es2019/types/set-timingsrc-function.js.map +1 -0
- package/build/es2019/types/set-timingsrc-with-custom-update-function-factory.d.ts +5 -0
- package/build/es2019/types/set-timingsrc-with-custom-update-function-factory.d.ts.map +1 -0
- package/build/es2019/types/set-timingsrc-with-custom-update-function-factory.js +2 -0
- package/build/es2019/types/set-timingsrc-with-custom-update-function-factory.js.map +1 -0
- package/build/es2019/types/set-timingsrc-with-custom-update-function-function.d.ts +5 -0
- package/build/es2019/types/set-timingsrc-with-custom-update-function-function.d.ts.map +1 -0
- package/build/es2019/types/set-timingsrc-with-custom-update-function-function.js +2 -0
- package/build/es2019/types/set-timingsrc-with-custom-update-function-function.js.map +1 -0
- package/build/es2019/types/update-function.d.ts +4 -0
- package/build/es2019/types/update-function.d.ts.map +1 -0
- package/build/es2019/types/update-function.js +2 -0
- package/build/es2019/types/update-function.js.map +1 -0
- package/build/es2019/types/update-gradually-factory.d.ts +3 -0
- package/build/es2019/types/update-gradually-factory.d.ts.map +1 -0
- package/build/es2019/types/update-gradually-factory.js +2 -0
- package/build/es2019/types/update-gradually-factory.js.map +1 -0
- package/build/es2019/types/update-media-element-factory.d.ts +7 -0
- package/build/es2019/types/update-media-element-factory.d.ts.map +1 -0
- package/build/es2019/types/update-media-element-factory.js +2 -0
- package/build/es2019/types/update-media-element-factory.js.map +1 -0
- package/build/es2019/types/update-media-element-function.d.ts +2 -0
- package/build/es2019/types/update-media-element-function.d.ts.map +1 -0
- package/build/es2019/types/update-media-element-function.js +2 -0
- package/build/es2019/types/update-media-element-function.js.map +1 -0
- package/build/es2019/types/update-stepwise-factory-factory.d.ts +4 -0
- package/build/es2019/types/update-stepwise-factory-factory.d.ts.map +1 -0
- package/build/es2019/types/update-stepwise-factory-factory.js +2 -0
- package/build/es2019/types/update-stepwise-factory-factory.js.map +1 -0
- package/build/es2019/types/update-stepwise-factory.d.ts +3 -0
- package/build/es2019/types/update-stepwise-factory.d.ts.map +1 -0
- package/build/es2019/types/update-stepwise-factory.js +2 -0
- package/build/es2019/types/update-stepwise-factory.js.map +1 -0
- package/build/es2019/types/window-factory.d.ts +2 -0
- package/build/es2019/types/window-factory.d.ts.map +1 -0
- package/build/es2019/types/window-factory.js +2 -0
- package/build/es2019/types/window-factory.js.map +1 -0
- package/build/es5/bundle.js +236 -0
- package/package.json +79 -0
- package/src/factories/default-set-timingsrc.ts +20 -0
- package/src/factories/set-current-time.ts +13 -0
- package/src/factories/set-playback-rate.ts +18 -0
- package/src/factories/set-timingsrc-with-custom-update-function.ts +19 -0
- package/src/factories/set-timingsrc.ts +6 -0
- package/src/factories/update-gradually.ts +22 -0
- package/src/factories/update-media-element.ts +38 -0
- package/src/factories/update-stepwise-factory.ts +51 -0
- package/src/factories/window.ts +3 -0
- package/src/functions/pause.ts +5 -0
- package/src/functions/play.ts +5 -0
- package/src/interfaces/index.ts +1 -0
- package/src/interfaces/update-vector.ts +5 -0
- package/src/module.ts +31 -0
- package/src/tsconfig.json +6 -0
- package/src/types/default-timingsrc-factory.ts +13 -0
- package/src/types/index.ts +18 -0
- package/src/types/pause-function.ts +1 -0
- package/src/types/play-function.ts +1 -0
- package/src/types/prepare-timing-state-vector-function.ts +3 -0
- package/src/types/set-current-time-factory.ts +3 -0
- package/src/types/set-current-time-function.ts +1 -0
- package/src/types/set-playback-rate-factory.ts +3 -0
- package/src/types/set-playback-rate-function.ts +1 -0
- package/src/types/set-timingsrc-factory.ts +8 -0
- package/src/types/set-timingsrc-function.ts +8 -0
- package/src/types/set-timingsrc-with-custom-update-function-factory.ts +8 -0
- package/src/types/set-timingsrc-with-custom-update-function-function.ts +10 -0
- package/src/types/update-function.ts +4 -0
- package/src/types/update-gradually-factory.ts +3 -0
- package/src/types/update-media-element-factory.ts +12 -0
- package/src/types/update-media-element-function.ts +8 -0
- package/src/types/update-stepwise-factory-factory.ts +4 -0
- package/src/types/update-stepwise-factory.ts +3 -0
- package/src/types/window-factory.ts +1 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TSetPlaybackRateFactory } from '../types';
|
|
2
|
+
|
|
3
|
+
export const createSetPlaybackRate: TSetPlaybackRateFactory = (playbackRateAssignments) => {
|
|
4
|
+
return (mediaElement, previousValue, nextValue) => {
|
|
5
|
+
const playbackRateAssignment = playbackRateAssignments.get(mediaElement);
|
|
6
|
+
|
|
7
|
+
if (
|
|
8
|
+
playbackRateAssignment === undefined ||
|
|
9
|
+
playbackRateAssignment[0] !== previousValue ||
|
|
10
|
+
playbackRateAssignment[1] !== nextValue
|
|
11
|
+
) {
|
|
12
|
+
// There is currently a bug in Firefox which causes problems when switching back to a playbackRate of exactly 1.
|
|
13
|
+
mediaElement.playbackRate = nextValue === 1 ? (previousValue > 1 ? 1.00001 : 0.99999) : nextValue;
|
|
14
|
+
|
|
15
|
+
playbackRateAssignments.set(mediaElement, [mediaElement.playbackRate, nextValue]);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TSetTimingsrcWithCustomUpdateFunctionFactory } from '../types';
|
|
2
|
+
|
|
3
|
+
export const createSetTimingsrcWithCustomUpdateFunction: TSetTimingsrcWithCustomUpdateFunctionFactory = (
|
|
4
|
+
animationFrame,
|
|
5
|
+
updateMediaElement
|
|
6
|
+
) => {
|
|
7
|
+
return (mediaElement, timingObject, updateFunction, prepareTimingStateVector = null) =>
|
|
8
|
+
animationFrame()(() => {
|
|
9
|
+
const { currentTime, duration, playbackRate } = mediaElement;
|
|
10
|
+
const timingStateVector = timingObject.query();
|
|
11
|
+
const { position, velocity } = updateFunction(
|
|
12
|
+
prepareTimingStateVector === null ? timingStateVector : prepareTimingStateVector(timingStateVector),
|
|
13
|
+
currentTime
|
|
14
|
+
);
|
|
15
|
+
const sanitizedDuration = typeof duration === 'number' && !isNaN(duration) ? duration : 0;
|
|
16
|
+
|
|
17
|
+
updateMediaElement(currentTime, sanitizedDuration, mediaElement, playbackRate, position, velocity);
|
|
18
|
+
});
|
|
19
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TSetTimingsrcFactory } from '../types';
|
|
2
|
+
|
|
3
|
+
export const createSetTimingsrc: TSetTimingsrcFactory = (setTimingsrcWithCustomUpdateFunction, update) => {
|
|
4
|
+
return (mediaElement, timingObject, prepareTimingStateVector = null) =>
|
|
5
|
+
setTimingsrcWithCustomUpdateFunction(mediaElement, timingObject, update, prepareTimingStateVector);
|
|
6
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TUpdateGraduallyFactory } from '../types';
|
|
2
|
+
|
|
3
|
+
export const createUpdateGradually: TUpdateGraduallyFactory = (timeConstant, threshold, tolerance) => {
|
|
4
|
+
return ({ position, velocity }, currentTime) => {
|
|
5
|
+
if (position < 0 || velocity === 0) {
|
|
6
|
+
return { position, velocity };
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const positionDifference = currentTime - position;
|
|
10
|
+
const absolutePositionDifference = Math.abs(positionDifference);
|
|
11
|
+
|
|
12
|
+
if (absolutePositionDifference > threshold) {
|
|
13
|
+
return { position, velocity };
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (absolutePositionDifference > tolerance) {
|
|
17
|
+
return { position: currentTime, velocity: ((timeConstant - positionDifference) / timeConstant) * velocity };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return { position: currentTime, velocity };
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { TUpdateMediaElementFactory } from '../types';
|
|
2
|
+
|
|
3
|
+
export const createUpdateMediaElement: TUpdateMediaElementFactory = (pause, play, setCurrentTime, setPlaybackRate) => {
|
|
4
|
+
return (currentTime, duration, mediaElement, playbackRate, position, velocity) => {
|
|
5
|
+
if (position < 0) {
|
|
6
|
+
if (currentTime > 0) {
|
|
7
|
+
setCurrentTime(mediaElement, currentTime, 0);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
pause(mediaElement);
|
|
11
|
+
} else if (position >= duration) {
|
|
12
|
+
if (currentTime !== duration) {
|
|
13
|
+
setCurrentTime(mediaElement, currentTime, duration);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
pause(mediaElement);
|
|
17
|
+
} else if (currentTime !== position) {
|
|
18
|
+
setCurrentTime(mediaElement, currentTime, position);
|
|
19
|
+
|
|
20
|
+
if (velocity !== 0) {
|
|
21
|
+
if (playbackRate !== velocity) {
|
|
22
|
+
setPlaybackRate(mediaElement, playbackRate, velocity);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
play(mediaElement);
|
|
26
|
+
} else {
|
|
27
|
+
pause(mediaElement);
|
|
28
|
+
}
|
|
29
|
+
} else if (playbackRate !== velocity) {
|
|
30
|
+
if (velocity !== 0) {
|
|
31
|
+
setPlaybackRate(mediaElement, playbackRate, velocity);
|
|
32
|
+
play(mediaElement);
|
|
33
|
+
} else {
|
|
34
|
+
pause(mediaElement);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { TUpdateStepwiseFactoryFactory } from '../types';
|
|
2
|
+
|
|
3
|
+
export const createUpdateStepwiseFactory: TUpdateStepwiseFactoryFactory = (translateTimingStateVector) => {
|
|
4
|
+
return (tolerance) => {
|
|
5
|
+
let lastMotionUpdate: null | { position: number; timestamp: number; velocity: number } = null;
|
|
6
|
+
let mediaElementDelay = 0;
|
|
7
|
+
|
|
8
|
+
return (timingStateVector, currentTime) => {
|
|
9
|
+
if (timingStateVector.position < 0 || timingStateVector.velocity === 0) {
|
|
10
|
+
lastMotionUpdate = null;
|
|
11
|
+
|
|
12
|
+
return { position: timingStateVector.position, velocity: timingStateVector.velocity };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (lastMotionUpdate !== null) {
|
|
16
|
+
const playheadDifference = Math.abs(currentTime - lastMotionUpdate.position);
|
|
17
|
+
|
|
18
|
+
// Check if at least 10ms were played since the last motion update.
|
|
19
|
+
if (playheadDifference < 0.01) {
|
|
20
|
+
return { position: currentTime, velocity: lastMotionUpdate.velocity };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const positionDifference = Math.abs(currentTime - timingStateVector.position);
|
|
25
|
+
|
|
26
|
+
if (positionDifference > tolerance) {
|
|
27
|
+
if (lastMotionUpdate !== null) {
|
|
28
|
+
const elapsedTime = timingStateVector.timestamp - lastMotionUpdate.timestamp;
|
|
29
|
+
|
|
30
|
+
const { position } = translateTimingStateVector({ acceleration: 0, ...lastMotionUpdate }, elapsedTime);
|
|
31
|
+
|
|
32
|
+
mediaElementDelay = position - currentTime;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const positioWithDelay = timingStateVector.position + mediaElementDelay;
|
|
36
|
+
|
|
37
|
+
lastMotionUpdate = {
|
|
38
|
+
position: positioWithDelay,
|
|
39
|
+
timestamp: timingStateVector.timestamp,
|
|
40
|
+
velocity: timingStateVector.velocity
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
return { position: positioWithDelay, velocity: timingStateVector.velocity };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
lastMotionUpdate = null;
|
|
47
|
+
|
|
48
|
+
return { position: currentTime, velocity: timingStateVector.velocity };
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './update-vector';
|
package/src/module.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { animationFrame } from 'subscribable-things';
|
|
2
|
+
import { translateTimingStateVector } from 'timing-object';
|
|
3
|
+
import { createDefaultSetTimingsrc } from './factories/default-set-timingsrc';
|
|
4
|
+
import { createSetCurrentTime } from './factories/set-current-time';
|
|
5
|
+
import { createSetPlaybackRate } from './factories/set-playback-rate';
|
|
6
|
+
import { createSetTimingsrc } from './factories/set-timingsrc';
|
|
7
|
+
import { createSetTimingsrcWithCustomUpdateFunction } from './factories/set-timingsrc-with-custom-update-function';
|
|
8
|
+
import { createUpdateGradually } from './factories/update-gradually';
|
|
9
|
+
import { createUpdateMediaElement } from './factories/update-media-element';
|
|
10
|
+
import { createUpdateStepwiseFactory } from './factories/update-stepwise-factory';
|
|
11
|
+
import { createWindow } from './factories/window';
|
|
12
|
+
import { pause } from './functions/pause';
|
|
13
|
+
import { play } from './functions/play';
|
|
14
|
+
|
|
15
|
+
export { createSetTimingsrc };
|
|
16
|
+
|
|
17
|
+
export { createUpdateGradually };
|
|
18
|
+
|
|
19
|
+
export const createUpdateStepwise = createUpdateStepwiseFactory(translateTimingStateVector);
|
|
20
|
+
|
|
21
|
+
const updateMediaElement = createUpdateMediaElement(pause, play, createSetCurrentTime(new WeakMap()), createSetPlaybackRate(new WeakMap()));
|
|
22
|
+
|
|
23
|
+
export const setTimingsrcWithCustomUpdateFunction = createSetTimingsrcWithCustomUpdateFunction(animationFrame, updateMediaElement);
|
|
24
|
+
|
|
25
|
+
export const setTimingsrc = createDefaultSetTimingsrc(
|
|
26
|
+
createSetTimingsrc,
|
|
27
|
+
createUpdateGradually,
|
|
28
|
+
createUpdateStepwise,
|
|
29
|
+
setTimingsrcWithCustomUpdateFunction,
|
|
30
|
+
createWindow()
|
|
31
|
+
);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TSetTimingsrcFactory } from './set-timingsrc-factory';
|
|
2
|
+
import { TSetTimingsrcFunction } from './set-timingsrc-function';
|
|
3
|
+
import { TSetTimingsrcWithCustomUpdateFunctionFunction } from './set-timingsrc-with-custom-update-function-function';
|
|
4
|
+
import { TUpdateGraduallyFactory } from './update-gradually-factory';
|
|
5
|
+
import { TUpdateStepwiseFactory } from './update-stepwise-factory';
|
|
6
|
+
|
|
7
|
+
export type TDefaultSetTimingsrcFactory = (
|
|
8
|
+
createSetTimingsrc: TSetTimingsrcFactory,
|
|
9
|
+
createUpdateGradually: TUpdateGraduallyFactory,
|
|
10
|
+
createUpdateStepwise: TUpdateStepwiseFactory,
|
|
11
|
+
setTimingsrcWithCustomUpdateFunction: TSetTimingsrcWithCustomUpdateFunctionFunction,
|
|
12
|
+
window: null | Window
|
|
13
|
+
) => TSetTimingsrcFunction;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from './default-timingsrc-factory';
|
|
2
|
+
export * from './pause-function';
|
|
3
|
+
export * from './play-function';
|
|
4
|
+
export * from './prepare-timing-state-vector-function';
|
|
5
|
+
export * from './set-current-time-factory';
|
|
6
|
+
export * from './set-current-time-function';
|
|
7
|
+
export * from './set-playback-rate-factory';
|
|
8
|
+
export * from './set-playback-rate-function';
|
|
9
|
+
export * from './set-timingsrc-factory';
|
|
10
|
+
export * from './set-timingsrc-function';
|
|
11
|
+
export * from './set-timingsrc-with-custom-update-function-factory';
|
|
12
|
+
export * from './set-timingsrc-with-custom-update-function-function';
|
|
13
|
+
export * from './update-function';
|
|
14
|
+
export * from './update-gradually-factory';
|
|
15
|
+
export * from './update-media-element-factory';
|
|
16
|
+
export * from './update-stepwise-factory';
|
|
17
|
+
export * from './update-stepwise-factory-factory';
|
|
18
|
+
export * from './window-factory';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type TPauseFunction = (mediaElement: HTMLMediaElement) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type TPlayFunction = (mediaElement: HTMLMediaElement) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type TSetCurrentTimeFunction = (mediaElement: HTMLMediaElement, currentValue: number, nextValue: number) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type TSetPlaybackRateFunction = (mediaElement: HTMLMediaElement, currentValue: number, nextValue: number) => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TSetTimingsrcFunction } from './set-timingsrc-function';
|
|
2
|
+
import { TSetTimingsrcWithCustomUpdateFunctionFunction } from './set-timingsrc-with-custom-update-function-function';
|
|
3
|
+
import { TUpdateFunction } from './update-function';
|
|
4
|
+
|
|
5
|
+
export type TSetTimingsrcFactory = (
|
|
6
|
+
setTimingsrcWithCustomUpdateFunction: TSetTimingsrcWithCustomUpdateFunctionFunction,
|
|
7
|
+
update: TUpdateFunction
|
|
8
|
+
) => TSetTimingsrcFunction;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ITimingObject } from 'timing-object';
|
|
2
|
+
import { TPrepareTimingStateVectorFunction } from './prepare-timing-state-vector-function';
|
|
3
|
+
|
|
4
|
+
export type TSetTimingsrcFunction = (
|
|
5
|
+
mediaElement: HTMLMediaElement,
|
|
6
|
+
timingObject: ITimingObject,
|
|
7
|
+
prepareTimingStateVector?: null | TPrepareTimingStateVectorFunction
|
|
8
|
+
) => () => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TAnimationFrameFunction } from 'subscribable-things';
|
|
2
|
+
import { TSetTimingsrcWithCustomUpdateFunctionFunction } from './set-timingsrc-with-custom-update-function-function';
|
|
3
|
+
import { TUpdateMediaElementFunction } from './update-media-element-function';
|
|
4
|
+
|
|
5
|
+
export type TSetTimingsrcWithCustomUpdateFunctionFactory = (
|
|
6
|
+
animationFrame: TAnimationFrameFunction,
|
|
7
|
+
updateMediaElement: TUpdateMediaElementFunction
|
|
8
|
+
) => TSetTimingsrcWithCustomUpdateFunctionFunction;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ITimingObject } from 'timing-object';
|
|
2
|
+
import { TPrepareTimingStateVectorFunction } from './prepare-timing-state-vector-function';
|
|
3
|
+
import { TUpdateFunction } from './update-function';
|
|
4
|
+
|
|
5
|
+
export type TSetTimingsrcWithCustomUpdateFunctionFunction = (
|
|
6
|
+
mediaElement: HTMLMediaElement,
|
|
7
|
+
timingObject: ITimingObject,
|
|
8
|
+
updateFunction: TUpdateFunction,
|
|
9
|
+
prepareTimingStateVector?: null | TPrepareTimingStateVectorFunction
|
|
10
|
+
) => () => void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TPauseFunction } from './pause-function';
|
|
2
|
+
import { TPlayFunction } from './play-function';
|
|
3
|
+
import { TSetCurrentTimeFunction } from './set-current-time-function';
|
|
4
|
+
import { TSetPlaybackRateFunction } from './set-playback-rate-function';
|
|
5
|
+
import { TUpdateMediaElementFunction } from './update-media-element-function';
|
|
6
|
+
|
|
7
|
+
export type TUpdateMediaElementFactory = (
|
|
8
|
+
pause: TPauseFunction,
|
|
9
|
+
play: TPlayFunction,
|
|
10
|
+
setCurrentTime: TSetCurrentTimeFunction,
|
|
11
|
+
setPlaybackRate: TSetPlaybackRateFunction
|
|
12
|
+
) => TUpdateMediaElementFunction;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TTranslateTimingStateVectorFunction } from 'timing-object';
|
|
2
|
+
import { TUpdateStepwiseFactory } from './update-stepwise-factory';
|
|
3
|
+
|
|
4
|
+
export type TUpdateStepwiseFactoryFactory = (translateTimingStateVector: TTranslateTimingStateVectorFunction) => TUpdateStepwiseFactory;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type TWindowFactory = () => null | Window;
|