native-fn 1.2.0 → 1.2.1
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 +14 -14
- package/dist/index.d.ts +12 -6
- package/dist/native.cjs +180 -102
- package/dist/native.min.cjs +1 -1
- package/dist/native.min.mjs +1 -1
- package/dist/native.mjs +180 -102
- package/dist/native.umd.js +180 -102
- package/dist/native.umd.min.js +1 -1
- package/dist/plugin/appearance/index.cjs +8 -3
- package/dist/plugin/appearance/index.mjs +8 -3
- package/dist/plugin/appearance/src/plugin/fullscreen/types/fullscreen.d.ts +7 -4
- package/dist/plugin/appearance/src/plugin/pip/types/pip.d.ts +5 -2
- package/dist/plugin/appearance/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/badge/src/plugin/fullscreen/types/fullscreen.d.ts +7 -4
- package/dist/plugin/badge/src/plugin/pip/types/pip.d.ts +5 -2
- package/dist/plugin/badge/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/battery/src/plugin/fullscreen/types/fullscreen.d.ts +7 -4
- package/dist/plugin/battery/src/plugin/pip/types/pip.d.ts +5 -2
- package/dist/plugin/battery/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/clipboard/src/plugin/fullscreen/types/fullscreen.d.ts +7 -4
- package/dist/plugin/clipboard/src/plugin/pip/types/pip.d.ts +5 -2
- package/dist/plugin/clipboard/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/dimension/src/plugin/fullscreen/types/fullscreen.d.ts +7 -4
- package/dist/plugin/dimension/src/plugin/pip/types/pip.d.ts +5 -2
- package/dist/plugin/dimension/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/fullscreen/index.cjs +93 -54
- package/dist/plugin/fullscreen/index.d.ts +7 -4
- package/dist/plugin/fullscreen/index.mjs +93 -54
- package/dist/plugin/fullscreen/src/plugin/fullscreen/types/fullscreen.d.ts +7 -4
- package/dist/plugin/fullscreen/src/plugin/pip/types/pip.d.ts +5 -2
- package/dist/plugin/fullscreen/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/geolocation/src/plugin/fullscreen/types/fullscreen.d.ts +7 -4
- package/dist/plugin/geolocation/src/plugin/pip/types/pip.d.ts +5 -2
- package/dist/plugin/geolocation/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/notification/src/plugin/fullscreen/types/fullscreen.d.ts +7 -4
- package/dist/plugin/notification/src/plugin/pip/types/pip.d.ts +5 -2
- package/dist/plugin/notification/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/open/index.cjs +8 -3
- package/dist/plugin/open/index.mjs +8 -3
- package/dist/plugin/open/src/plugin/fullscreen/types/fullscreen.d.ts +7 -4
- package/dist/plugin/open/src/plugin/pip/types/pip.d.ts +5 -2
- package/dist/plugin/open/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/permission/src/plugin/fullscreen/types/fullscreen.d.ts +7 -4
- package/dist/plugin/permission/src/plugin/pip/types/pip.d.ts +5 -2
- package/dist/plugin/permission/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/pip/index.cjs +448 -47
- package/dist/plugin/pip/index.d.ts +5 -2
- package/dist/plugin/pip/index.mjs +448 -47
- package/dist/plugin/pip/src/plugin/fullscreen/types/fullscreen.d.ts +7 -4
- package/dist/plugin/pip/src/plugin/pip/types/pip.d.ts +5 -2
- package/dist/plugin/pip/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/platform/index.cjs +8 -3
- package/dist/plugin/platform/index.mjs +8 -3
- package/dist/plugin/platform/src/plugin/fullscreen/types/fullscreen.d.ts +7 -4
- package/dist/plugin/platform/src/plugin/pip/types/pip.d.ts +5 -2
- package/dist/plugin/platform/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/theme/index.cjs +8 -3
- package/dist/plugin/theme/index.mjs +8 -3
- package/dist/plugin/theme/src/plugin/fullscreen/types/fullscreen.d.ts +7 -4
- package/dist/plugin/theme/src/plugin/pip/types/pip.d.ts +5 -2
- package/dist/plugin/theme/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/vibration/src/plugin/fullscreen/types/fullscreen.d.ts +7 -4
- package/dist/plugin/vibration/src/plugin/pip/types/pip.d.ts +5 -2
- package/dist/plugin/vibration/src/types/subscription-manager.d.ts +1 -1
- package/dist/src/plugin/fullscreen/types/fullscreen.d.ts +7 -4
- package/dist/src/plugin/pip/types/pip.d.ts +5 -2
- package/dist/src/types/subscription-manager.d.ts +1 -1
- package/package.json +1 -1
|
@@ -3,11 +3,14 @@ import { InvalidStateError } from "../../../errors/invalid-state-error";
|
|
|
3
3
|
export declare interface PipInstance {
|
|
4
4
|
get supported(): boolean;
|
|
5
5
|
get element(): HTMLVideoElement | null;
|
|
6
|
-
get
|
|
6
|
+
get isActive(): boolean;
|
|
7
7
|
request(target?: HTMLVideoElement): Promise<void>;
|
|
8
8
|
exit(): Promise<void>;
|
|
9
|
+
toggle(target?: HTMLVideoElement): Promise<void>;
|
|
9
10
|
onChange(listener: (payload: PipEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
11
|
+
onChange(target: HTMLVideoElement, listener: (payload: PipEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
10
12
|
onError(listener: (payload: PipEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
13
|
+
onError(target: HTMLVideoElement, listener: (payload: PipEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
11
14
|
Constants: {};
|
|
12
15
|
Errors: {
|
|
13
16
|
NotSupportedError: typeof NotSupportedError;
|
|
@@ -17,5 +20,5 @@ export declare interface PipInstance {
|
|
|
17
20
|
export declare interface PipEventPayload {
|
|
18
21
|
nativeEvent: Event;
|
|
19
22
|
element: HTMLVideoElement;
|
|
20
|
-
|
|
23
|
+
isActive: boolean;
|
|
21
24
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare interface SubscriptionManager<T, U> {
|
|
2
2
|
emit: (value: U) => void;
|
|
3
|
-
subscribe: (
|
|
3
|
+
subscribe: (listener: (value: U) => void, options?: AddEventListenerOptions) => () => void;
|
|
4
4
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { NotSupportedError } from "../../../errors/not-supported-error";
|
|
2
2
|
import { InvalidStateError } from "../../../errors/invalid-state-error";
|
|
3
3
|
export declare interface FullscreenInstance {
|
|
4
|
-
supported: boolean;
|
|
5
|
-
element: Element | null;
|
|
6
|
-
|
|
4
|
+
get supported(): boolean;
|
|
5
|
+
get element(): Element | null;
|
|
6
|
+
get isActive(): boolean;
|
|
7
7
|
request(target?: Element, options?: FullscreenOptions): Promise<void>;
|
|
8
|
+
toggle(target?: Element, options?: FullscreenOptions): Promise<void>;
|
|
8
9
|
exit(): Promise<void>;
|
|
9
10
|
onChange(listener: (payload: FullscreenEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
11
|
+
onChange(target: Element, listener: (payload: FullscreenEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
10
12
|
onError(listener: (payload: FullscreenEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
13
|
+
onChange(target: Element, listener: (payload: FullscreenEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
11
14
|
Constants: {};
|
|
12
15
|
Errors: {
|
|
13
16
|
NotSupportedError: typeof NotSupportedError;
|
|
@@ -17,5 +20,5 @@ export declare interface FullscreenInstance {
|
|
|
17
20
|
export declare interface FullscreenEventPayload {
|
|
18
21
|
nativeEvent: Event;
|
|
19
22
|
element: Element;
|
|
20
|
-
|
|
23
|
+
isActive: boolean;
|
|
21
24
|
}
|
|
@@ -3,11 +3,14 @@ import { InvalidStateError } from "../../../errors/invalid-state-error";
|
|
|
3
3
|
export declare interface PipInstance {
|
|
4
4
|
get supported(): boolean;
|
|
5
5
|
get element(): HTMLVideoElement | null;
|
|
6
|
-
get
|
|
6
|
+
get isActive(): boolean;
|
|
7
7
|
request(target?: HTMLVideoElement): Promise<void>;
|
|
8
8
|
exit(): Promise<void>;
|
|
9
|
+
toggle(target?: HTMLVideoElement): Promise<void>;
|
|
9
10
|
onChange(listener: (payload: PipEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
11
|
+
onChange(target: HTMLVideoElement, listener: (payload: PipEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
10
12
|
onError(listener: (payload: PipEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
13
|
+
onError(target: HTMLVideoElement, listener: (payload: PipEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
11
14
|
Constants: {};
|
|
12
15
|
Errors: {
|
|
13
16
|
NotSupportedError: typeof NotSupportedError;
|
|
@@ -17,5 +20,5 @@ export declare interface PipInstance {
|
|
|
17
20
|
export declare interface PipEventPayload {
|
|
18
21
|
nativeEvent: Event;
|
|
19
22
|
element: HTMLVideoElement;
|
|
20
|
-
|
|
23
|
+
isActive: boolean;
|
|
21
24
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare interface SubscriptionManager<T, U> {
|
|
2
2
|
emit: (value: U) => void;
|
|
3
|
-
subscribe: (
|
|
3
|
+
subscribe: (listener: (value: U) => void, options?: AddEventListenerOptions) => () => void;
|
|
4
4
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { NotSupportedError } from "../../../errors/not-supported-error";
|
|
2
2
|
import { InvalidStateError } from "../../../errors/invalid-state-error";
|
|
3
3
|
export declare interface FullscreenInstance {
|
|
4
|
-
supported: boolean;
|
|
5
|
-
element: Element | null;
|
|
6
|
-
|
|
4
|
+
get supported(): boolean;
|
|
5
|
+
get element(): Element | null;
|
|
6
|
+
get isActive(): boolean;
|
|
7
7
|
request(target?: Element, options?: FullscreenOptions): Promise<void>;
|
|
8
|
+
toggle(target?: Element, options?: FullscreenOptions): Promise<void>;
|
|
8
9
|
exit(): Promise<void>;
|
|
9
10
|
onChange(listener: (payload: FullscreenEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
11
|
+
onChange(target: Element, listener: (payload: FullscreenEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
10
12
|
onError(listener: (payload: FullscreenEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
13
|
+
onChange(target: Element, listener: (payload: FullscreenEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
11
14
|
Constants: {};
|
|
12
15
|
Errors: {
|
|
13
16
|
NotSupportedError: typeof NotSupportedError;
|
|
@@ -17,5 +20,5 @@ export declare interface FullscreenInstance {
|
|
|
17
20
|
export declare interface FullscreenEventPayload {
|
|
18
21
|
nativeEvent: Event;
|
|
19
22
|
element: Element;
|
|
20
|
-
|
|
23
|
+
isActive: boolean;
|
|
21
24
|
}
|
|
@@ -3,11 +3,14 @@ import { InvalidStateError } from "../../../errors/invalid-state-error";
|
|
|
3
3
|
export declare interface PipInstance {
|
|
4
4
|
get supported(): boolean;
|
|
5
5
|
get element(): HTMLVideoElement | null;
|
|
6
|
-
get
|
|
6
|
+
get isActive(): boolean;
|
|
7
7
|
request(target?: HTMLVideoElement): Promise<void>;
|
|
8
8
|
exit(): Promise<void>;
|
|
9
|
+
toggle(target?: HTMLVideoElement): Promise<void>;
|
|
9
10
|
onChange(listener: (payload: PipEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
11
|
+
onChange(target: HTMLVideoElement, listener: (payload: PipEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
10
12
|
onError(listener: (payload: PipEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
13
|
+
onError(target: HTMLVideoElement, listener: (payload: PipEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
11
14
|
Constants: {};
|
|
12
15
|
Errors: {
|
|
13
16
|
NotSupportedError: typeof NotSupportedError;
|
|
@@ -17,5 +20,5 @@ export declare interface PipInstance {
|
|
|
17
20
|
export declare interface PipEventPayload {
|
|
18
21
|
nativeEvent: Event;
|
|
19
22
|
element: HTMLVideoElement;
|
|
20
|
-
|
|
23
|
+
isActive: boolean;
|
|
21
24
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare interface SubscriptionManager<T, U> {
|
|
2
2
|
emit: (value: U) => void;
|
|
3
|
-
subscribe: (
|
|
3
|
+
subscribe: (listener: (value: U) => void, options?: AddEventListenerOptions) => () => void;
|
|
4
4
|
}
|
|
@@ -654,10 +654,15 @@ function parseFromHighEntropyValues() {
|
|
|
654
654
|
parsedFromHighEntropyValuesEngine.version = brandVersion;
|
|
655
655
|
}
|
|
656
656
|
if (typeof platformVersion === 'string') {
|
|
657
|
-
if (getParsedCache().os.name === OS.Windows)
|
|
658
|
-
|
|
659
|
-
|
|
657
|
+
if (getParsedCache().os.name === OS.Windows) {
|
|
658
|
+
if (parseInt(platformVersion.split('.')[0], 10) >= 13)
|
|
659
|
+
parsedFromHighEntropyValuesOS.version = '11';
|
|
660
|
+
else
|
|
661
|
+
parsedFromHighEntropyValuesOS.version = '10';
|
|
662
|
+
}
|
|
663
|
+
else {
|
|
660
664
|
parsedFromHighEntropyValuesOS.version = platformVersion;
|
|
665
|
+
}
|
|
661
666
|
}
|
|
662
667
|
if (typeof platform === 'string') {
|
|
663
668
|
if (/android/i.test(platform))
|
|
@@ -906,7 +911,8 @@ var NotSupportedError = createCustomError('NotSupportedError');
|
|
|
906
911
|
|
|
907
912
|
var InvalidStateError = createCustomError('InvalidStateError');
|
|
908
913
|
|
|
909
|
-
var
|
|
914
|
+
var videoElement = null;
|
|
915
|
+
var lastFallbackVideoElement = null;
|
|
910
916
|
var eventsBridged = false;
|
|
911
917
|
var FS_BRIDGE_KEY = (function () {
|
|
912
918
|
if (typeof Symbol === 'function') {
|
|
@@ -952,24 +958,33 @@ var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, deta
|
|
|
952
958
|
var onErrorSubscriptionManager = createSubscriptionManager(attachOnError, detachOnError);
|
|
953
959
|
var Fullscreen = {
|
|
954
960
|
get supported() {
|
|
955
|
-
return
|
|
961
|
+
return getSupported();
|
|
956
962
|
},
|
|
957
963
|
get element() {
|
|
958
964
|
return getElement();
|
|
959
965
|
},
|
|
960
|
-
get
|
|
961
|
-
return
|
|
966
|
+
get isActive() {
|
|
967
|
+
return getIsActive();
|
|
962
968
|
},
|
|
963
969
|
request: request,
|
|
964
970
|
exit: exit,
|
|
965
|
-
|
|
966
|
-
|
|
971
|
+
toggle: toggle,
|
|
972
|
+
onChange: onChange,
|
|
973
|
+
onError: onError,
|
|
967
974
|
Constants: {},
|
|
968
975
|
Errors: {
|
|
969
976
|
NotSupportedError: NotSupportedError,
|
|
970
977
|
InvalidStateError: InvalidStateError,
|
|
971
978
|
},
|
|
972
979
|
};
|
|
980
|
+
function getHTMLVideoElement() {
|
|
981
|
+
var selected = globalThis.document.querySelector('video');
|
|
982
|
+
if (selected !== null)
|
|
983
|
+
return selected;
|
|
984
|
+
if (videoElement === null)
|
|
985
|
+
return videoElement = globalThis.document.createElement('video');
|
|
986
|
+
return videoElement;
|
|
987
|
+
}
|
|
973
988
|
function hasStandardApi() {
|
|
974
989
|
return api !== null;
|
|
975
990
|
}
|
|
@@ -992,27 +1007,24 @@ function detectApi() {
|
|
|
992
1007
|
function getDefaultTarget() {
|
|
993
1008
|
if (Platform.os.name === OS.iOS) {
|
|
994
1009
|
var video = globalThis.document.querySelector('video');
|
|
995
|
-
|
|
1010
|
+
if (video !== null)
|
|
1011
|
+
return video;
|
|
1012
|
+
return undefined;
|
|
996
1013
|
}
|
|
997
1014
|
return globalThis.document.documentElement;
|
|
998
1015
|
}
|
|
999
|
-
function
|
|
1016
|
+
function getSupported() {
|
|
1000
1017
|
if (api !== null)
|
|
1001
1018
|
return globalThis.document[api.enabled] === true;
|
|
1002
1019
|
if (Platform.os.name !== OS.iOS)
|
|
1003
1020
|
return false;
|
|
1004
|
-
var video;
|
|
1005
|
-
var selected = globalThis.document.querySelector('video');
|
|
1006
|
-
if (selected !== null)
|
|
1007
|
-
video = selected;
|
|
1008
|
-
else
|
|
1009
|
-
video = globalThis.document.createElement('video');
|
|
1021
|
+
var video = getHTMLVideoElement();
|
|
1010
1022
|
return video.webkitSupportsFullscreen === true || typeof video.webkitEnterFullscreen === 'function';
|
|
1011
1023
|
}
|
|
1012
1024
|
function getElement() {
|
|
1013
1025
|
if (api === null) {
|
|
1014
|
-
if (
|
|
1015
|
-
return
|
|
1026
|
+
if (lastFallbackVideoElement !== null && lastFallbackVideoElement.webkitDisplayingFullscreen === true)
|
|
1027
|
+
return lastFallbackVideoElement;
|
|
1016
1028
|
return null;
|
|
1017
1029
|
}
|
|
1018
1030
|
var currentElement = globalThis.document[api.element];
|
|
@@ -1020,43 +1032,43 @@ function getElement() {
|
|
|
1020
1032
|
return currentElement;
|
|
1021
1033
|
return null;
|
|
1022
1034
|
}
|
|
1023
|
-
function
|
|
1035
|
+
function getIsActive() {
|
|
1024
1036
|
return getElement() !== null;
|
|
1025
1037
|
}
|
|
1026
|
-
function createEventPayload(nativeEvent, element,
|
|
1038
|
+
function createEventPayload(nativeEvent, element, isActive) {
|
|
1027
1039
|
return {
|
|
1028
1040
|
nativeEvent: nativeEvent,
|
|
1029
1041
|
element: element,
|
|
1030
|
-
|
|
1042
|
+
isActive: isActive,
|
|
1031
1043
|
};
|
|
1032
1044
|
}
|
|
1033
|
-
function emitChange(nativeEvent, element,
|
|
1034
|
-
onChangeSubscriptionManager.emit(createEventPayload(nativeEvent, element,
|
|
1045
|
+
function emitChange(nativeEvent, element, isActive) {
|
|
1046
|
+
onChangeSubscriptionManager.emit(createEventPayload(nativeEvent, element, isActive));
|
|
1035
1047
|
}
|
|
1036
|
-
function emitError(nativeEvent, element,
|
|
1037
|
-
onErrorSubscriptionManager.emit(createEventPayload(nativeEvent, element,
|
|
1048
|
+
function emitError(nativeEvent, element, isActive) {
|
|
1049
|
+
onErrorSubscriptionManager.emit(createEventPayload(nativeEvent, element, isActive));
|
|
1038
1050
|
}
|
|
1039
1051
|
function onFullscreenChange(event) {
|
|
1040
1052
|
var target = event.target;
|
|
1041
1053
|
if (target instanceof globalThis.Element)
|
|
1042
|
-
emitChange(event, target,
|
|
1054
|
+
emitChange(event, target, getIsActive());
|
|
1043
1055
|
if (target instanceof globalThis.Document)
|
|
1044
|
-
emitChange(event, globalThis.document.documentElement,
|
|
1056
|
+
emitChange(event, globalThis.document.documentElement, getIsActive());
|
|
1045
1057
|
}
|
|
1046
1058
|
function onFullscreenError(event) {
|
|
1047
1059
|
var target = event.target;
|
|
1048
1060
|
if (target instanceof globalThis.Element)
|
|
1049
|
-
emitError(event, target,
|
|
1061
|
+
emitError(event, target, getIsActive());
|
|
1050
1062
|
if (target instanceof globalThis.Document)
|
|
1051
|
-
emitError(event, globalThis.document.documentElement,
|
|
1063
|
+
emitError(event, globalThis.document.documentElement, getIsActive());
|
|
1052
1064
|
}
|
|
1053
1065
|
function onIOSBeginFullscreen(event) {
|
|
1054
|
-
|
|
1066
|
+
lastFallbackVideoElement = this;
|
|
1055
1067
|
emitChange(event, this, true);
|
|
1056
1068
|
}
|
|
1057
1069
|
function onIOSEndFullscreen(event) {
|
|
1058
|
-
if (
|
|
1059
|
-
|
|
1070
|
+
if (lastFallbackVideoElement === this)
|
|
1071
|
+
lastFallbackVideoElement = null;
|
|
1060
1072
|
emitChange(event, this, false);
|
|
1061
1073
|
}
|
|
1062
1074
|
function bridgeSingleVideoNode(video) {
|
|
@@ -1083,13 +1095,13 @@ function bridgeEvents() {
|
|
|
1083
1095
|
if (typeof globalThis.MutationObserver === 'undefined')
|
|
1084
1096
|
return;
|
|
1085
1097
|
var observer = new globalThis.MutationObserver(function (records) {
|
|
1086
|
-
if (
|
|
1098
|
+
if (lastFallbackVideoElement !== null) {
|
|
1087
1099
|
var removed = false;
|
|
1088
1100
|
for (var i = 0; i < records.length; i++) {
|
|
1089
1101
|
var removedNodes = records[i].removedNodes;
|
|
1090
1102
|
for (var j = 0; j < removedNodes.length; j++) {
|
|
1091
1103
|
var node = removedNodes[j];
|
|
1092
|
-
if (node ===
|
|
1104
|
+
if (node === lastFallbackVideoElement || (node.nodeType === Node.ELEMENT_NODE && node.contains(lastFallbackVideoElement))) {
|
|
1093
1105
|
removed = true;
|
|
1094
1106
|
break;
|
|
1095
1107
|
}
|
|
@@ -1097,8 +1109,8 @@ function bridgeEvents() {
|
|
|
1097
1109
|
if (removed)
|
|
1098
1110
|
break;
|
|
1099
1111
|
}
|
|
1100
|
-
if (removed && !globalThis.document.contains(
|
|
1101
|
-
|
|
1112
|
+
if (removed && !globalThis.document.contains(lastFallbackVideoElement))
|
|
1113
|
+
lastFallbackVideoElement = null;
|
|
1102
1114
|
}
|
|
1103
1115
|
for (var i = 0; i < records.length; i++) {
|
|
1104
1116
|
var addedNodes = records[i].addedNodes;
|
|
@@ -1151,8 +1163,10 @@ function request(target, options) {
|
|
|
1151
1163
|
target = getDefaultTarget();
|
|
1152
1164
|
if (typeof target === 'undefined')
|
|
1153
1165
|
return reject(new NotSupportedError('Failed to enter fullscreen mode.'));
|
|
1166
|
+
if (getIsActive() && getElement() !== target && Platform.browser.name === Browsers.Safari && Platform.os.name === OS.iOS)
|
|
1167
|
+
return reject(new NotSupportedError('There is already a Fullscreen element in this document.'));
|
|
1154
1168
|
var tagName = target.tagName.toLowerCase();
|
|
1155
|
-
var isIOSFullscreenActive =
|
|
1169
|
+
var isIOSFullscreenActive = lastFallbackVideoElement !== null && lastFallbackVideoElement.webkitDisplayingFullscreen === true;
|
|
1156
1170
|
if (api !== null) {
|
|
1157
1171
|
var method = target[api.request];
|
|
1158
1172
|
if (typeof method === 'function' && !isIOSFullscreenActive) {
|
|
@@ -1166,7 +1180,7 @@ function request(target, options) {
|
|
|
1166
1180
|
return reject(new NotSupportedError('The "' + tagName + '" element does not support fullscreen requests.'));
|
|
1167
1181
|
fallbackToIOSVideo();
|
|
1168
1182
|
}
|
|
1169
|
-
catch (
|
|
1183
|
+
catch (e) {
|
|
1170
1184
|
reject(new NotSupportedError('The "' + tagName + '" element does not support fullscreen requests.'));
|
|
1171
1185
|
}
|
|
1172
1186
|
});
|
|
@@ -1185,7 +1199,8 @@ function request(target, options) {
|
|
|
1185
1199
|
video_1.play()
|
|
1186
1200
|
.then(function () {
|
|
1187
1201
|
try {
|
|
1188
|
-
video_1.webkitEnterFullscreen
|
|
1202
|
+
if (video_1.webkitSupportsFullscreen && typeof video_1.webkitEnterFullscreen === 'function')
|
|
1203
|
+
video_1.webkitEnterFullscreen();
|
|
1189
1204
|
}
|
|
1190
1205
|
catch (e) {
|
|
1191
1206
|
return reject(new InvalidStateError('The object is in an invalid state.'));
|
|
@@ -1200,7 +1215,7 @@ function request(target, options) {
|
|
|
1200
1215
|
return reject(new InvalidStateError('The object is in an invalid state.'));
|
|
1201
1216
|
}
|
|
1202
1217
|
}
|
|
1203
|
-
|
|
1218
|
+
lastFallbackVideoElement = video_1;
|
|
1204
1219
|
return resolve();
|
|
1205
1220
|
}
|
|
1206
1221
|
}
|
|
@@ -1218,16 +1233,7 @@ function exit() {
|
|
|
1218
1233
|
if (typeof result !== 'undefined' && typeof result.then === 'function') {
|
|
1219
1234
|
result
|
|
1220
1235
|
.then(resolve)
|
|
1221
|
-
.catch(
|
|
1222
|
-
try {
|
|
1223
|
-
if (Platform.os.name !== OS.iOS)
|
|
1224
|
-
return reject(new NotSupportedError('Failed to exit fullscreen mode.'));
|
|
1225
|
-
fallbackToIOSVideo();
|
|
1226
|
-
}
|
|
1227
|
-
catch (_e) {
|
|
1228
|
-
reject(new NotSupportedError('Failed to exit fullscreen mode.'));
|
|
1229
|
-
}
|
|
1230
|
-
});
|
|
1236
|
+
.catch(resolve);
|
|
1231
1237
|
return;
|
|
1232
1238
|
}
|
|
1233
1239
|
return resolve();
|
|
@@ -1238,12 +1244,12 @@ function exit() {
|
|
|
1238
1244
|
reject(new NotSupportedError('Failed to exit fullscreen mode.'));
|
|
1239
1245
|
return;
|
|
1240
1246
|
}
|
|
1241
|
-
var target =
|
|
1247
|
+
var target = lastFallbackVideoElement;
|
|
1242
1248
|
if (target !== null && typeof target.webkitExitFullscreen === 'function' && target.webkitDisplayingFullscreen === true) {
|
|
1243
1249
|
target.webkitExitFullscreen();
|
|
1244
1250
|
if (target.webkitDisplayingFullscreen)
|
|
1245
1251
|
return reject(new NotSupportedError('Failed to exit fullscreen mode.'));
|
|
1246
|
-
|
|
1252
|
+
lastFallbackVideoElement = null;
|
|
1247
1253
|
return resolve();
|
|
1248
1254
|
}
|
|
1249
1255
|
var videos = globalThis.document.querySelectorAll('video');
|
|
@@ -1253,7 +1259,7 @@ function exit() {
|
|
|
1253
1259
|
video.webkitExitFullscreen();
|
|
1254
1260
|
if (video.webkitDisplayingFullscreen)
|
|
1255
1261
|
return reject(new NotSupportedError('Failed to exit fullscreen mode.'));
|
|
1256
|
-
|
|
1262
|
+
lastFallbackVideoElement = null;
|
|
1257
1263
|
return resolve();
|
|
1258
1264
|
}
|
|
1259
1265
|
}
|
|
@@ -1264,6 +1270,39 @@ function exit() {
|
|
|
1264
1270
|
fallbackToIOSVideo();
|
|
1265
1271
|
});
|
|
1266
1272
|
}
|
|
1273
|
+
function toggle(target, options) {
|
|
1274
|
+
var current = getElement();
|
|
1275
|
+
if (typeof target !== 'undefined') {
|
|
1276
|
+
if (current === target)
|
|
1277
|
+
return this.exit();
|
|
1278
|
+
return this.request(target, options);
|
|
1279
|
+
}
|
|
1280
|
+
if (current !== null)
|
|
1281
|
+
return this.exit();
|
|
1282
|
+
return this.request(undefined, options);
|
|
1283
|
+
}
|
|
1284
|
+
function onChange(targetOrListener, listenerOrOptions, options) {
|
|
1285
|
+
if (typeof targetOrListener === 'function')
|
|
1286
|
+
return onChangeSubscriptionManager.subscribe(targetOrListener, listenerOrOptions);
|
|
1287
|
+
var target = targetOrListener;
|
|
1288
|
+
var listener = listenerOrOptions;
|
|
1289
|
+
function wrappedListener(payload) {
|
|
1290
|
+
if (payload.element === target)
|
|
1291
|
+
listener(payload);
|
|
1292
|
+
}
|
|
1293
|
+
return onChangeSubscriptionManager.subscribe(wrappedListener, options);
|
|
1294
|
+
}
|
|
1295
|
+
function onError(targetOrListener, listenerOrOptions, options) {
|
|
1296
|
+
if (typeof targetOrListener === 'function')
|
|
1297
|
+
return onErrorSubscriptionManager.subscribe(targetOrListener, listenerOrOptions);
|
|
1298
|
+
var target = targetOrListener;
|
|
1299
|
+
var listener = listenerOrOptions;
|
|
1300
|
+
function wrappedListener(payload) {
|
|
1301
|
+
if (payload.element === target)
|
|
1302
|
+
listener(payload);
|
|
1303
|
+
}
|
|
1304
|
+
return onErrorSubscriptionManager.subscribe(wrappedListener, options);
|
|
1305
|
+
}
|
|
1267
1306
|
bridgeEvents();
|
|
1268
1307
|
|
|
1269
1308
|
module.exports = Fullscreen;
|
|
@@ -3,13 +3,16 @@ declare const NotSupportedError: ErrorConstructor;
|
|
|
3
3
|
declare const InvalidStateError: ErrorConstructor;
|
|
4
4
|
|
|
5
5
|
declare interface FullscreenInstance {
|
|
6
|
-
supported: boolean;
|
|
7
|
-
element: Element | null;
|
|
8
|
-
|
|
6
|
+
get supported(): boolean;
|
|
7
|
+
get element(): Element | null;
|
|
8
|
+
get isActive(): boolean;
|
|
9
9
|
request(target?: Element, options?: FullscreenOptions): Promise<void>;
|
|
10
|
+
toggle(target?: Element, options?: FullscreenOptions): Promise<void>;
|
|
10
11
|
exit(): Promise<void>;
|
|
11
12
|
onChange(listener: (payload: FullscreenEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
13
|
+
onChange(target: Element, listener: (payload: FullscreenEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
12
14
|
onError(listener: (payload: FullscreenEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
15
|
+
onChange(target: Element, listener: (payload: FullscreenEventPayload) => void, options?: AddEventListenerOptions): () => void;
|
|
13
16
|
Constants: {};
|
|
14
17
|
Errors: {
|
|
15
18
|
NotSupportedError: typeof NotSupportedError;
|
|
@@ -19,7 +22,7 @@ declare interface FullscreenInstance {
|
|
|
19
22
|
declare interface FullscreenEventPayload {
|
|
20
23
|
nativeEvent: Event;
|
|
21
24
|
element: Element;
|
|
22
|
-
|
|
25
|
+
isActive: boolean;
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
declare global {
|