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 @@
|
|
|
1
|
+
{"version":3,"file":"set-current-time-factory.d.ts","sourceRoot":"","sources":["../../../src/types/set-current-time-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,oBAAY,sBAAsB,GAAG,CAAC,sBAAsB,EAAE,OAAO,CAAC,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-current-time-factory.js","sourceRoot":"","sources":["../../../src/types/set-current-time-factory.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-current-time-function.d.ts","sourceRoot":"","sources":["../../../src/types/set-current-time-function.ts"],"names":[],"mappings":"AAAA,oBAAY,uBAAuB,GAAG,CAAC,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-current-time-function.js","sourceRoot":"","sources":["../../../src/types/set-current-time-function.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TSetPlaybackRateFunction } from './set-playback-rate-function';
|
|
2
|
+
export declare type TSetPlaybackRateFactory = (playbackRateAssignments: WeakMap<HTMLMediaElement, [number, number]>) => TSetPlaybackRateFunction;
|
|
3
|
+
//# sourceMappingURL=set-playback-rate-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-playback-rate-factory.d.ts","sourceRoot":"","sources":["../../../src/types/set-playback-rate-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAExE,oBAAY,uBAAuB,GAAG,CAAC,uBAAuB,EAAE,OAAO,CAAC,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-playback-rate-factory.js","sourceRoot":"","sources":["../../../src/types/set-playback-rate-factory.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-playback-rate-function.d.ts","sourceRoot":"","sources":["../../../src/types/set-playback-rate-function.ts"],"names":[],"mappings":"AAAA,oBAAY,wBAAwB,GAAG,CAAC,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-playback-rate-function.js","sourceRoot":"","sources":["../../../src/types/set-playback-rate-function.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
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
|
+
export declare type TSetTimingsrcFactory = (setTimingsrcWithCustomUpdateFunction: TSetTimingsrcWithCustomUpdateFunctionFunction, update: TUpdateFunction) => TSetTimingsrcFunction;
|
|
5
|
+
//# sourceMappingURL=set-timingsrc-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-timingsrc-factory.d.ts","sourceRoot":"","sources":["../../../src/types/set-timingsrc-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,6CAA6C,EAAE,MAAM,sDAAsD,CAAC;AACrH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,oBAAY,oBAAoB,GAAG,CAC/B,oCAAoC,EAAE,6CAA6C,EACnF,MAAM,EAAE,eAAe,KACtB,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-timingsrc-factory.js","sourceRoot":"","sources":["../../../src/types/set-timingsrc-factory.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ITimingObject } from 'timing-object';
|
|
2
|
+
import { TPrepareTimingStateVectorFunction } from './prepare-timing-state-vector-function';
|
|
3
|
+
export declare type TSetTimingsrcFunction = (mediaElement: HTMLMediaElement, timingObject: ITimingObject, prepareTimingStateVector?: null | TPrepareTimingStateVectorFunction) => () => void;
|
|
4
|
+
//# sourceMappingURL=set-timingsrc-function.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-timingsrc-function.d.ts","sourceRoot":"","sources":["../../../src/types/set-timingsrc-function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC;AAE3F,oBAAY,qBAAqB,GAAG,CAChC,YAAY,EAAE,gBAAgB,EAC9B,YAAY,EAAE,aAAa,EAC3B,wBAAwB,CAAC,EAAE,IAAI,GAAG,iCAAiC,KAClE,MAAM,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-timingsrc-function.js","sourceRoot":"","sources":["../../../src/types/set-timingsrc-function.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
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
|
+
export declare type TSetTimingsrcWithCustomUpdateFunctionFactory = (animationFrame: TAnimationFrameFunction, updateMediaElement: TUpdateMediaElementFunction) => TSetTimingsrcWithCustomUpdateFunctionFunction;
|
|
5
|
+
//# sourceMappingURL=set-timingsrc-with-custom-update-function-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-timingsrc-with-custom-update-function-factory.d.ts","sourceRoot":"","sources":["../../../src/types/set-timingsrc-with-custom-update-function-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,6CAA6C,EAAE,MAAM,sDAAsD,CAAC;AACrH,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAE9E,oBAAY,4CAA4C,GAAG,CACvD,cAAc,EAAE,uBAAuB,EACvC,kBAAkB,EAAE,2BAA2B,KAC9C,6CAA6C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-timingsrc-with-custom-update-function-factory.js","sourceRoot":"","sources":["../../../src/types/set-timingsrc-with-custom-update-function-factory.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ITimingObject } from 'timing-object';
|
|
2
|
+
import { TPrepareTimingStateVectorFunction } from './prepare-timing-state-vector-function';
|
|
3
|
+
import { TUpdateFunction } from './update-function';
|
|
4
|
+
export declare type TSetTimingsrcWithCustomUpdateFunctionFunction = (mediaElement: HTMLMediaElement, timingObject: ITimingObject, updateFunction: TUpdateFunction, prepareTimingStateVector?: null | TPrepareTimingStateVectorFunction) => () => void;
|
|
5
|
+
//# sourceMappingURL=set-timingsrc-with-custom-update-function-function.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-timingsrc-with-custom-update-function-function.d.ts","sourceRoot":"","sources":["../../../src/types/set-timingsrc-with-custom-update-function-function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,oBAAY,6CAA6C,GAAG,CACxD,YAAY,EAAE,gBAAgB,EAC9B,YAAY,EAAE,aAAa,EAC3B,cAAc,EAAE,eAAe,EAC/B,wBAAwB,CAAC,EAAE,IAAI,GAAG,iCAAiC,KAClE,MAAM,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-timingsrc-with-custom-update-function-function.js","sourceRoot":"","sources":["../../../src/types/set-timingsrc-with-custom-update-function-function.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-function.d.ts","sourceRoot":"","sources":["../../../src/types/update-function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,oBAAY,eAAe,GAAG,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,KAAK,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-function.js","sourceRoot":"","sources":["../../../src/types/update-function.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-gradually-factory.d.ts","sourceRoot":"","sources":["../../../src/types/update-gradually-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,oBAAY,uBAAuB,GAAG,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-gradually-factory.js","sourceRoot":"","sources":["../../../src/types/update-gradually-factory.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
export declare type TUpdateMediaElementFactory = (pause: TPauseFunction, play: TPlayFunction, setCurrentTime: TSetCurrentTimeFunction, setPlaybackRate: TSetPlaybackRateFunction) => TUpdateMediaElementFunction;
|
|
7
|
+
//# sourceMappingURL=update-media-element-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-media-element-factory.d.ts","sourceRoot":"","sources":["../../../src/types/update-media-element-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAE9E,oBAAY,0BAA0B,GAAG,CACrC,KAAK,EAAE,cAAc,EACrB,IAAI,EAAE,aAAa,EACnB,cAAc,EAAE,uBAAuB,EACvC,eAAe,EAAE,wBAAwB,KACxC,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-media-element-factory.js","sourceRoot":"","sources":["../../../src/types/update-media-element-factory.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-media-element-function.d.ts","sourceRoot":"","sources":["../../../src/types/update-media-element-function.ts"],"names":[],"mappings":"AAAA,oBAAY,2BAA2B,GAAG,CACtC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,gBAAgB,EAC9B,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,KACf,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-media-element-function.js","sourceRoot":"","sources":["../../../src/types/update-media-element-function.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TTranslateTimingStateVectorFunction } from 'timing-object';
|
|
2
|
+
import { TUpdateStepwiseFactory } from './update-stepwise-factory';
|
|
3
|
+
export declare type TUpdateStepwiseFactoryFactory = (translateTimingStateVector: TTranslateTimingStateVectorFunction) => TUpdateStepwiseFactory;
|
|
4
|
+
//# sourceMappingURL=update-stepwise-factory-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-stepwise-factory-factory.d.ts","sourceRoot":"","sources":["../../../src/types/update-stepwise-factory-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,oBAAY,6BAA6B,GAAG,CAAC,0BAA0B,EAAE,mCAAmC,KAAK,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-stepwise-factory-factory.js","sourceRoot":"","sources":["../../../src/types/update-stepwise-factory-factory.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-stepwise-factory.d.ts","sourceRoot":"","sources":["../../../src/types/update-stepwise-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,oBAAY,sBAAsB,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-stepwise-factory.js","sourceRoot":"","sources":["../../../src/types/update-stepwise-factory.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"window-factory.d.ts","sourceRoot":"","sources":["../../../src/types/window-factory.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc,GAAG,MAAM,IAAI,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"window-factory.js","sourceRoot":"","sources":["../../../src/types/window-factory.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('subscribable-things'), require('timing-object'), require('@babel/runtime/helpers/defineProperty')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'subscribable-things', 'timing-object', '@babel/runtime/helpers/defineProperty'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.timingsrc = {}, global.subscribableThings, global.timingObject, global._defineProperty));
|
|
5
|
+
}(this, (function (exports, subscribableThings, timingObject, _defineProperty) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
10
|
+
|
|
11
|
+
var DEFAULT_THRESHOLD = 1;
|
|
12
|
+
var DEFAULT_TIME_CONSTANT = 0.5;
|
|
13
|
+
var DEFAULT_TOLERANCE = 0.025;
|
|
14
|
+
var createDefaultSetTimingsrc = function createDefaultSetTimingsrc(createSetTimingsrc, createUpdateGradually, createUpdateStepwise, setTimingsrcWithCustomUpdateFunction, window) {
|
|
15
|
+
return window !== null && window.navigator.userAgent.includes('Safari') && !window.navigator.userAgent.includes('Chrome') ? function () {
|
|
16
|
+
return createSetTimingsrc(setTimingsrcWithCustomUpdateFunction, createUpdateStepwise(DEFAULT_TOLERANCE)).apply(void 0, arguments);
|
|
17
|
+
} : createSetTimingsrc(setTimingsrcWithCustomUpdateFunction, createUpdateGradually(DEFAULT_TIME_CONSTANT, DEFAULT_THRESHOLD, DEFAULT_TOLERANCE));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
var createSetCurrentTime = function createSetCurrentTime(currentTimeAssignments) {
|
|
21
|
+
return function (mediaElement, previousValue, nextValue) {
|
|
22
|
+
var currentTimeAssignment = currentTimeAssignments.get(mediaElement);
|
|
23
|
+
|
|
24
|
+
if (currentTimeAssignment === undefined || currentTimeAssignment[0] !== previousValue || currentTimeAssignment[1] !== nextValue) {
|
|
25
|
+
mediaElement.currentTime = nextValue;
|
|
26
|
+
currentTimeAssignments.set(mediaElement, [mediaElement.currentTime, nextValue]);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
var createSetPlaybackRate = function createSetPlaybackRate(playbackRateAssignments) {
|
|
32
|
+
return function (mediaElement, previousValue, nextValue) {
|
|
33
|
+
var playbackRateAssignment = playbackRateAssignments.get(mediaElement);
|
|
34
|
+
|
|
35
|
+
if (playbackRateAssignment === undefined || playbackRateAssignment[0] !== previousValue || playbackRateAssignment[1] !== nextValue) {
|
|
36
|
+
// There is currently a bug in Firefox which causes problems when switching back to a playbackRate of exactly 1.
|
|
37
|
+
mediaElement.playbackRate = nextValue === 1 ? previousValue > 1 ? 1.00001 : 0.99999 : nextValue;
|
|
38
|
+
playbackRateAssignments.set(mediaElement, [mediaElement.playbackRate, nextValue]);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
var createSetTimingsrc = function createSetTimingsrc(setTimingsrcWithCustomUpdateFunction, update) {
|
|
44
|
+
return function (mediaElement, timingObject) {
|
|
45
|
+
var prepareTimingStateVector = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
46
|
+
return setTimingsrcWithCustomUpdateFunction(mediaElement, timingObject, update, prepareTimingStateVector);
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var createSetTimingsrcWithCustomUpdateFunction = function createSetTimingsrcWithCustomUpdateFunction(animationFrame, updateMediaElement) {
|
|
51
|
+
return function (mediaElement, timingObject, updateFunction) {
|
|
52
|
+
var prepareTimingStateVector = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
53
|
+
return animationFrame()(function () {
|
|
54
|
+
var currentTime = mediaElement.currentTime,
|
|
55
|
+
duration = mediaElement.duration,
|
|
56
|
+
playbackRate = mediaElement.playbackRate;
|
|
57
|
+
var timingStateVector = timingObject.query();
|
|
58
|
+
|
|
59
|
+
var _updateFunction = updateFunction(prepareTimingStateVector === null ? timingStateVector : prepareTimingStateVector(timingStateVector), currentTime),
|
|
60
|
+
position = _updateFunction.position,
|
|
61
|
+
velocity = _updateFunction.velocity;
|
|
62
|
+
|
|
63
|
+
var sanitizedDuration = typeof duration === 'number' && !isNaN(duration) ? duration : 0;
|
|
64
|
+
updateMediaElement(currentTime, sanitizedDuration, mediaElement, playbackRate, position, velocity);
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
var createUpdateGradually = function createUpdateGradually(timeConstant, threshold, tolerance) {
|
|
70
|
+
return function (_ref, currentTime) {
|
|
71
|
+
var position = _ref.position,
|
|
72
|
+
velocity = _ref.velocity;
|
|
73
|
+
|
|
74
|
+
if (position < 0 || velocity === 0) {
|
|
75
|
+
return {
|
|
76
|
+
position: position,
|
|
77
|
+
velocity: velocity
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
var positionDifference = currentTime - position;
|
|
82
|
+
var absolutePositionDifference = Math.abs(positionDifference);
|
|
83
|
+
|
|
84
|
+
if (absolutePositionDifference > threshold) {
|
|
85
|
+
return {
|
|
86
|
+
position: position,
|
|
87
|
+
velocity: velocity
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (absolutePositionDifference > tolerance) {
|
|
92
|
+
return {
|
|
93
|
+
position: currentTime,
|
|
94
|
+
velocity: (timeConstant - positionDifference) / timeConstant * velocity
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
position: currentTime,
|
|
100
|
+
velocity: velocity
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
var createUpdateMediaElement = function createUpdateMediaElement(pause, play, setCurrentTime, setPlaybackRate) {
|
|
106
|
+
return function (currentTime, duration, mediaElement, playbackRate, position, velocity) {
|
|
107
|
+
if (position < 0) {
|
|
108
|
+
if (currentTime > 0) {
|
|
109
|
+
setCurrentTime(mediaElement, currentTime, 0);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
pause(mediaElement);
|
|
113
|
+
} else if (position >= duration) {
|
|
114
|
+
if (currentTime !== duration) {
|
|
115
|
+
setCurrentTime(mediaElement, currentTime, duration);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
pause(mediaElement);
|
|
119
|
+
} else if (currentTime !== position) {
|
|
120
|
+
setCurrentTime(mediaElement, currentTime, position);
|
|
121
|
+
|
|
122
|
+
if (velocity !== 0) {
|
|
123
|
+
if (playbackRate !== velocity) {
|
|
124
|
+
setPlaybackRate(mediaElement, playbackRate, velocity);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
play(mediaElement);
|
|
128
|
+
} else {
|
|
129
|
+
pause(mediaElement);
|
|
130
|
+
}
|
|
131
|
+
} else if (playbackRate !== velocity) {
|
|
132
|
+
if (velocity !== 0) {
|
|
133
|
+
setPlaybackRate(mediaElement, playbackRate, velocity);
|
|
134
|
+
play(mediaElement);
|
|
135
|
+
} else {
|
|
136
|
+
pause(mediaElement);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
143
|
+
|
|
144
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
145
|
+
|
|
146
|
+
var createUpdateStepwiseFactory = function createUpdateStepwiseFactory(translateTimingStateVector) {
|
|
147
|
+
return function (tolerance) {
|
|
148
|
+
var lastMotionUpdate = null;
|
|
149
|
+
var mediaElementDelay = 0;
|
|
150
|
+
return function (timingStateVector, currentTime) {
|
|
151
|
+
if (timingStateVector.position < 0 || timingStateVector.velocity === 0) {
|
|
152
|
+
lastMotionUpdate = null;
|
|
153
|
+
return {
|
|
154
|
+
position: timingStateVector.position,
|
|
155
|
+
velocity: timingStateVector.velocity
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (lastMotionUpdate !== null) {
|
|
160
|
+
var playheadDifference = Math.abs(currentTime - lastMotionUpdate.position); // Check if at least 10ms were played since the last motion update.
|
|
161
|
+
|
|
162
|
+
if (playheadDifference < 0.01) {
|
|
163
|
+
return {
|
|
164
|
+
position: currentTime,
|
|
165
|
+
velocity: lastMotionUpdate.velocity
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
var positionDifference = Math.abs(currentTime - timingStateVector.position);
|
|
171
|
+
|
|
172
|
+
if (positionDifference > tolerance) {
|
|
173
|
+
if (lastMotionUpdate !== null) {
|
|
174
|
+
var elapsedTime = timingStateVector.timestamp - lastMotionUpdate.timestamp;
|
|
175
|
+
|
|
176
|
+
var _translateTimingState = translateTimingStateVector(_objectSpread({
|
|
177
|
+
acceleration: 0
|
|
178
|
+
}, lastMotionUpdate), elapsedTime),
|
|
179
|
+
position = _translateTimingState.position;
|
|
180
|
+
|
|
181
|
+
mediaElementDelay = position - currentTime;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
var positioWithDelay = timingStateVector.position + mediaElementDelay;
|
|
185
|
+
lastMotionUpdate = {
|
|
186
|
+
position: positioWithDelay,
|
|
187
|
+
timestamp: timingStateVector.timestamp,
|
|
188
|
+
velocity: timingStateVector.velocity
|
|
189
|
+
};
|
|
190
|
+
return {
|
|
191
|
+
position: positioWithDelay,
|
|
192
|
+
velocity: timingStateVector.velocity
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
lastMotionUpdate = null;
|
|
197
|
+
return {
|
|
198
|
+
position: currentTime,
|
|
199
|
+
velocity: timingStateVector.velocity
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
var createWindow = function createWindow() {
|
|
206
|
+
return typeof window === 'undefined' ? null : window;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
var pause = function pause(mediaElement) {
|
|
210
|
+
if (!mediaElement.paused) {
|
|
211
|
+
mediaElement.pause();
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
var play = function play(mediaElement) {
|
|
216
|
+
if (mediaElement.paused) {
|
|
217
|
+
mediaElement.play()["catch"](function (err) {
|
|
218
|
+
return console.error(err);
|
|
219
|
+
}); // tslint:disable-line no-console
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
var createUpdateStepwise = createUpdateStepwiseFactory(timingObject.translateTimingStateVector);
|
|
224
|
+
var updateMediaElement = createUpdateMediaElement(pause, play, createSetCurrentTime(new WeakMap()), createSetPlaybackRate(new WeakMap()));
|
|
225
|
+
var setTimingsrcWithCustomUpdateFunction = createSetTimingsrcWithCustomUpdateFunction(subscribableThings.animationFrame, updateMediaElement);
|
|
226
|
+
var setTimingsrc = createDefaultSetTimingsrc(createSetTimingsrc, createUpdateGradually, createUpdateStepwise, setTimingsrcWithCustomUpdateFunction, createWindow());
|
|
227
|
+
|
|
228
|
+
exports.createSetTimingsrc = createSetTimingsrc;
|
|
229
|
+
exports.createUpdateGradually = createUpdateGradually;
|
|
230
|
+
exports.createUpdateStepwise = createUpdateStepwise;
|
|
231
|
+
exports.setTimingsrc = setTimingsrc;
|
|
232
|
+
exports.setTimingsrcWithCustomUpdateFunction = setTimingsrcWithCustomUpdateFunction;
|
|
233
|
+
|
|
234
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
235
|
+
|
|
236
|
+
})));
|
package/package.json
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"author": "Christoph Guttandin",
|
|
3
|
+
"bugs": {
|
|
4
|
+
"url": "https://github.com/chrisguttandin/timingsrc/issues"
|
|
5
|
+
},
|
|
6
|
+
"config": {
|
|
7
|
+
"commitizen": {
|
|
8
|
+
"path": "cz-conventional-changelog"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@babel/runtime": "^7.15.4",
|
|
13
|
+
"subscribable-things": "^1.12.1",
|
|
14
|
+
"timing-object": "^3.1.37",
|
|
15
|
+
"tslib": "^2.3.1"
|
|
16
|
+
},
|
|
17
|
+
"description": "A library to synchronize a MediaElement with a TimingObject.",
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@babel/core": "^7.15.5",
|
|
20
|
+
"@babel/plugin-external-helpers": "^7.14.5",
|
|
21
|
+
"@babel/plugin-transform-runtime": "^7.15.0",
|
|
22
|
+
"@babel/preset-env": "^7.15.6",
|
|
23
|
+
"@commitlint/cli": "^13.1.0",
|
|
24
|
+
"@commitlint/config-angular": "^13.1.0",
|
|
25
|
+
"@rollup/plugin-babel": "^5.3.0",
|
|
26
|
+
"chai": "^4.3.4",
|
|
27
|
+
"commitizen": "^4.2.4",
|
|
28
|
+
"cz-conventional-changelog": "^3.3.0",
|
|
29
|
+
"eslint": "^7.32.0",
|
|
30
|
+
"eslint-config-holy-grail": "^50.1.8",
|
|
31
|
+
"grunt": "^1.4.1",
|
|
32
|
+
"grunt-cli": "^1.4.3",
|
|
33
|
+
"grunt-contrib-clean": "^2.0.0",
|
|
34
|
+
"grunt-sh": "^0.2.0",
|
|
35
|
+
"husky": "^7.0.2",
|
|
36
|
+
"karma": "^6.3.4",
|
|
37
|
+
"karma-browserstack-launcher": "^1.6.0",
|
|
38
|
+
"karma-chrome-launcher": "^3.1.0",
|
|
39
|
+
"karma-firefox-launcher": "^2.1.1",
|
|
40
|
+
"karma-mocha": "^2.0.1",
|
|
41
|
+
"karma-safari-launcher": "^1.0.0",
|
|
42
|
+
"karma-sinon-chai": "^2.0.2",
|
|
43
|
+
"karma-webpack": "^5.0.0",
|
|
44
|
+
"load-grunt-config": "^4.0.1",
|
|
45
|
+
"mocha": "^9.1.1",
|
|
46
|
+
"prettier": "^2.4.1",
|
|
47
|
+
"pretty-quick": "^3.1.1",
|
|
48
|
+
"rollup": "^2.56.3",
|
|
49
|
+
"sinon": "^11.1.2",
|
|
50
|
+
"sinon-chai": "^3.7.0",
|
|
51
|
+
"ts-loader": "^9.2.5",
|
|
52
|
+
"tsconfig-holy-grail": "^11.1.12",
|
|
53
|
+
"tslint": "^6.1.3",
|
|
54
|
+
"tslint-config-holy-grail": "^53.2.25",
|
|
55
|
+
"typescript": "^4.4.3",
|
|
56
|
+
"webpack": "^5.53.0"
|
|
57
|
+
},
|
|
58
|
+
"files": [
|
|
59
|
+
"build/es2019/",
|
|
60
|
+
"build/es5/",
|
|
61
|
+
"src/"
|
|
62
|
+
],
|
|
63
|
+
"homepage": "https://github.com/chrisguttandin/timingsrc",
|
|
64
|
+
"license": "MIT",
|
|
65
|
+
"main": "build/es5/bundle.js",
|
|
66
|
+
"module": "build/es2019/module.js",
|
|
67
|
+
"name": "timingsrc",
|
|
68
|
+
"repository": {
|
|
69
|
+
"type": "git",
|
|
70
|
+
"url": "https://github.com/chrisguttandin/timingsrc.git"
|
|
71
|
+
},
|
|
72
|
+
"scripts": {
|
|
73
|
+
"prepare": "husky install",
|
|
74
|
+
"prepublishOnly": "grunt build",
|
|
75
|
+
"test": "grunt lint && grunt test"
|
|
76
|
+
},
|
|
77
|
+
"types": "build/es2019/module.d.ts",
|
|
78
|
+
"version": "1.1.17"
|
|
79
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TDefaultSetTimingsrcFactory, TSetTimingsrcFunction } from '../types';
|
|
2
|
+
|
|
3
|
+
const DEFAULT_THRESHOLD = 1;
|
|
4
|
+
const DEFAULT_TIME_CONSTANT = 0.5;
|
|
5
|
+
const DEFAULT_TOLERANCE = 0.025;
|
|
6
|
+
|
|
7
|
+
export const createDefaultSetTimingsrc: TDefaultSetTimingsrcFactory = (
|
|
8
|
+
createSetTimingsrc,
|
|
9
|
+
createUpdateGradually,
|
|
10
|
+
createUpdateStepwise,
|
|
11
|
+
setTimingsrcWithCustomUpdateFunction,
|
|
12
|
+
window
|
|
13
|
+
) =>
|
|
14
|
+
window !== null && window.navigator.userAgent.includes('Safari') && !window.navigator.userAgent.includes('Chrome')
|
|
15
|
+
? (...args: Parameters<TSetTimingsrcFunction>) =>
|
|
16
|
+
createSetTimingsrc(setTimingsrcWithCustomUpdateFunction, createUpdateStepwise(DEFAULT_TOLERANCE))(...args)
|
|
17
|
+
: createSetTimingsrc(
|
|
18
|
+
setTimingsrcWithCustomUpdateFunction,
|
|
19
|
+
createUpdateGradually(DEFAULT_TIME_CONSTANT, DEFAULT_THRESHOLD, DEFAULT_TOLERANCE)
|
|
20
|
+
);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TSetCurrentTimeFactory } from '../types';
|
|
2
|
+
|
|
3
|
+
export const createSetCurrentTime: TSetCurrentTimeFactory = (currentTimeAssignments) => {
|
|
4
|
+
return (mediaElement, previousValue, nextValue) => {
|
|
5
|
+
const currentTimeAssignment = currentTimeAssignments.get(mediaElement);
|
|
6
|
+
|
|
7
|
+
if (currentTimeAssignment === undefined || currentTimeAssignment[0] !== previousValue || currentTimeAssignment[1] !== nextValue) {
|
|
8
|
+
mediaElement.currentTime = nextValue;
|
|
9
|
+
|
|
10
|
+
currentTimeAssignments.set(mediaElement, [mediaElement.currentTime, nextValue]);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
};
|