@swiftbrowser/native 0.17.6 → 0.17.8
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 +101 -2
- package/dist/blob.d.ts +60 -0
- package/dist/blob.d.ts.map +1 -0
- package/dist/blob.js +153 -0
- package/dist/blob.js.map +1 -0
- package/dist/bridge.d.ts +47 -1
- package/dist/bridge.d.ts.map +1 -1
- package/dist/bridge.js.map +1 -1
- package/dist/fetch.d.ts +11 -3
- package/dist/fetch.d.ts.map +1 -1
- package/dist/fetch.js +26 -2
- package/dist/fetch.js.map +1 -1
- package/dist/hostRequests.d.ts +49 -0
- package/dist/hostRequests.d.ts.map +1 -0
- package/dist/hostRequests.js +134 -0
- package/dist/hostRequests.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/matchMedia.d.ts +43 -0
- package/dist/matchMedia.d.ts.map +1 -0
- package/dist/matchMedia.js +63 -0
- package/dist/matchMedia.js.map +1 -0
- package/dist/mediaSession.d.ts +59 -0
- package/dist/mediaSession.d.ts.map +1 -0
- package/dist/mediaSession.js +119 -0
- package/dist/mediaSession.js.map +1 -0
- package/dist/notifications.d.ts +108 -0
- package/dist/notifications.d.ts.map +1 -0
- package/dist/notifications.js +251 -0
- package/dist/notifications.js.map +1 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +9 -1
- package/dist/run.js.map +1 -1
- package/dist/runtime.d.ts +3 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +72 -3
- package/dist/runtime.js.map +1 -1
- package/dist/secureStorage.d.ts +20 -0
- package/dist/secureStorage.d.ts.map +1 -0
- package/dist/secureStorage.js +28 -0
- package/dist/secureStorage.js.map +1 -0
- package/dist/subtle.d.ts +38 -0
- package/dist/subtle.d.ts.map +1 -0
- package/dist/subtle.js +72 -0
- package/dist/subtle.js.map +1 -0
- package/dist/webSocket.d.ts +73 -0
- package/dist/webSocket.d.ts.map +1 -0
- package/dist/webSocket.js +145 -0
- package/dist/webSocket.js.map +1 -0
- package/package.json +3 -3
- package/src/blob.ts +186 -0
- package/src/bridge.ts +57 -1
- package/src/fetch.ts +29 -3
- package/src/hostRequests.ts +148 -0
- package/src/index.ts +8 -0
- package/src/matchMedia.ts +79 -0
- package/src/mediaSession.ts +163 -0
- package/src/notifications.ts +317 -0
- package/src/run.ts +10 -1
- package/src/runtime.ts +73 -3
- package/src/secureStorage.ts +39 -0
- package/src/subtle.ts +87 -0
- package/src/webSocket.ts +175 -0
- package/swift/Sources/SwiftBrowserNative/Host/HostBridge.swift +180 -0
- package/swift/Sources/SwiftBrowserNative/Host/HostRequestBridge.swift +437 -0
- package/swift/Sources/SwiftBrowserNative/Host/NotificationBridge.swift +304 -0
- package/swift/Sources/SwiftBrowserNative/Host/NowPlayingBridge.swift +190 -0
- package/swift/Sources/SwiftBrowserNative/Host/SecureStorage.swift +60 -0
- package/swift/Sources/SwiftBrowserNative/Host/ShimAliases.swift +3 -0
- package/swift/Sources/SwiftBrowserNative/Host/WebSocketBridge.swift +118 -0
- package/swift/Sources/SwiftBrowserNative/Runtime/NativeApp.swift +26 -0
- package/swift/Sources/SwiftBrowserNative/Runtime/NativeAppDelegate.swift +36 -0
- package/swift/Sources/SwiftBrowserNative/Views/ElementView.swift +2 -0
- package/swift/Sources/SwiftBrowserNative/Views/Kinds/Controls.swift +22 -9
- package/swift/Sources/SwiftBrowserNative/Views/Kinds/Navigation.swift +8 -5
- package/swift/Sources/SwiftBrowserNative/Views/Kinds/Video.swift +304 -0
- package/swift/Sources/SwiftBrowserProtocol/Props.swift +43 -0
- package/swift/Sources/SwiftBrowserProtocol/RendererEvent.swift +12 -2
- package/wasm/SwiftBrowserNative.wasm +2 -2
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host requests `@swiftbrowser/react` sends to the browser environment
|
|
3
|
+
* (`ShareLink`, `fileImporter`, the clipboard, a color chooser: the web
|
|
4
|
+
* renderer's `performHostRequest` with its `browserEnvironment`), answered by
|
|
5
|
+
* the native app instead: the bridge's `hostRequest(id, kind, json)` performs
|
|
6
|
+
* one with UIKit (a share sheet, the photo or document picker, the
|
|
7
|
+
* pasteboard, the color picker, `ASWebAuthenticationSession`), answering
|
|
8
|
+
* `__sbHostResponse(id, { value } | { error })`. `installHostEnvironment`
|
|
9
|
+
* fills the environment's gaps with these, leaving what the page has (the
|
|
10
|
+
* round trip runs in a browser with a share sheet of its own).
|
|
11
|
+
*
|
|
12
|
+
* `webAuthenticate` is the sign-in window apps open for OAuth: the system's
|
|
13
|
+
* sheet, resolving with the callback URL.
|
|
14
|
+
*/
|
|
15
|
+
import type { NativeBridge } from './bridge';
|
|
16
|
+
export type HostRequestBridge = Required<Pick<NativeBridge, 'hostRequest'>>;
|
|
17
|
+
/** A file as it crosses the bridge: its name, MIME type and bytes (base64). */
|
|
18
|
+
export interface BridgedFile {
|
|
19
|
+
name: string;
|
|
20
|
+
type: string;
|
|
21
|
+
data: string;
|
|
22
|
+
}
|
|
23
|
+
export interface WebAuthenticateOptions {
|
|
24
|
+
/** The scheme of the callback URL the sign-in ends with (`myapp` for `myapp://auth`); universal links need none. */
|
|
25
|
+
callbackScheme?: string;
|
|
26
|
+
/** Whether the session shares no cookies with the system browser. */
|
|
27
|
+
ephemeral?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/** Points the requests at the bridge (the runtime, once per install). */
|
|
30
|
+
export declare function installHostRequests(native: HostRequestBridge): void;
|
|
31
|
+
/** The bridge's `__sbHostResponse(id, result)`. */
|
|
32
|
+
export declare function receiveHostResponse(id: number, result: string | {
|
|
33
|
+
value?: unknown;
|
|
34
|
+
error?: string;
|
|
35
|
+
}): void;
|
|
36
|
+
/** Performs one request of `kind` with `params`; resolves with the host's value. */
|
|
37
|
+
export declare function hostRequest<T = unknown>(kind: string, params: Record<string, unknown>): Promise<T>;
|
|
38
|
+
/** Forgets the bridge and the waiting requests, for tests. */
|
|
39
|
+
export declare function resetHostRequests(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Opens the system's sign-in sheet at `url` and resolves with the callback
|
|
42
|
+
* URL it ends with; rejects with an `AbortError` when the viewer closes it.
|
|
43
|
+
*/
|
|
44
|
+
export declare function webAuthenticate(url: string, options?: WebAuthenticateOptions): Promise<string>;
|
|
45
|
+
/** The environment fields the host answers, shaped as the web renderer's `HostRequestEnvironment`. */
|
|
46
|
+
export declare function nativeHostEnvironment(): Record<string, unknown>;
|
|
47
|
+
/** Fills what `environment` lacks with the host's answers; what the page has stays. */
|
|
48
|
+
export declare function installHostEnvironment(environment: Record<string, unknown>): void;
|
|
49
|
+
//# sourceMappingURL=hostRequests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hostRequests.d.ts","sourceRoot":"","sources":["../src/hostRequests.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG7C,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC;AAE5E,+EAA+E;AAC/E,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,sBAAsB;IACrC,oHAAoH;IACpH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAMD,yEAAyE;AACzE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAEnE;AAED,mDAAmD;AACnD,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAkB1G;AAED,oFAAoF;AACpF,wBAAgB,WAAW,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAUlG;AAED,8DAA8D;AAC9D,wBAAgB,iBAAiB,IAAI,IAAI,CAIxC;AAWD;;;GAGG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,sBAA2B,GAAG,OAAO,CAAC,MAAM,CAAC,CAOxG;AAED,sGAAsG;AACtG,wBAAgB,qBAAqB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA+B/D;AAED,uFAAuF;AACvF,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAKjF"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host requests `@swiftbrowser/react` sends to the browser environment
|
|
3
|
+
* (`ShareLink`, `fileImporter`, the clipboard, a color chooser: the web
|
|
4
|
+
* renderer's `performHostRequest` with its `browserEnvironment`), answered by
|
|
5
|
+
* the native app instead: the bridge's `hostRequest(id, kind, json)` performs
|
|
6
|
+
* one with UIKit (a share sheet, the photo or document picker, the
|
|
7
|
+
* pasteboard, the color picker, `ASWebAuthenticationSession`), answering
|
|
8
|
+
* `__sbHostResponse(id, { value } | { error })`. `installHostEnvironment`
|
|
9
|
+
* fills the environment's gaps with these, leaving what the page has (the
|
|
10
|
+
* round trip runs in a browser with a share sheet of its own).
|
|
11
|
+
*
|
|
12
|
+
* `webAuthenticate` is the sign-in window apps open for OAuth: the system's
|
|
13
|
+
* sheet, resolving with the callback URL.
|
|
14
|
+
*/
|
|
15
|
+
import { objectURL, SimpleBlob, SimpleFile } from './blob';
|
|
16
|
+
import { base64Decode, base64Encode } from './encoding';
|
|
17
|
+
let bridge = null;
|
|
18
|
+
let nextId = 1;
|
|
19
|
+
const pending = new Map();
|
|
20
|
+
/** Points the requests at the bridge (the runtime, once per install). */
|
|
21
|
+
export function installHostRequests(native) {
|
|
22
|
+
bridge = native;
|
|
23
|
+
}
|
|
24
|
+
/** The bridge's `__sbHostResponse(id, result)`. */
|
|
25
|
+
export function receiveHostResponse(id, result) {
|
|
26
|
+
const waiting = pending.get(id);
|
|
27
|
+
if (!waiting)
|
|
28
|
+
return;
|
|
29
|
+
pending.delete(id);
|
|
30
|
+
let parsed;
|
|
31
|
+
try {
|
|
32
|
+
parsed = typeof result === 'string' ? JSON.parse(result) : result;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
waiting.reject(new Error('host: malformed response'));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (typeof parsed.error === 'string') {
|
|
39
|
+
const error = new Error(parsed.error);
|
|
40
|
+
if (parsed.error.startsWith('cancelled'))
|
|
41
|
+
error.name = 'AbortError';
|
|
42
|
+
waiting.reject(error);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
waiting.resolve(parsed.value);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** Performs one request of `kind` with `params`; resolves with the host's value. */
|
|
49
|
+
export function hostRequest(kind, params) {
|
|
50
|
+
return new Promise((resolve, reject) => {
|
|
51
|
+
if (!bridge) {
|
|
52
|
+
reject(new Error(`unsupported: no native host for ${kind}`));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const id = nextId++;
|
|
56
|
+
pending.set(id, { resolve: resolve, reject });
|
|
57
|
+
bridge.hostRequest(id, kind, JSON.stringify(params));
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/** Forgets the bridge and the waiting requests, for tests. */
|
|
61
|
+
export function resetHostRequests() {
|
|
62
|
+
bridge = null;
|
|
63
|
+
pending.clear();
|
|
64
|
+
nextId = 1;
|
|
65
|
+
}
|
|
66
|
+
async function bridgedFile(file) {
|
|
67
|
+
return { name: file.name ?? 'file', type: file.type, data: base64Encode(file.bytes()) };
|
|
68
|
+
}
|
|
69
|
+
function filesOf(value) {
|
|
70
|
+
const files = value?.files ?? [];
|
|
71
|
+
return files.map((file) => new SimpleFile([base64Decode(file.data)], file.name, { type: file.type }));
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Opens the system's sign-in sheet at `url` and resolves with the callback
|
|
75
|
+
* URL it ends with; rejects with an `AbortError` when the viewer closes it.
|
|
76
|
+
*/
|
|
77
|
+
export async function webAuthenticate(url, options = {}) {
|
|
78
|
+
const params = { action: 'start', url };
|
|
79
|
+
if (options.callbackScheme)
|
|
80
|
+
params['callbackScheme'] = options.callbackScheme;
|
|
81
|
+
if (options.ephemeral !== undefined)
|
|
82
|
+
params['ephemeral'] = options.ephemeral;
|
|
83
|
+
const result = await hostRequest('webAuth', params);
|
|
84
|
+
if (typeof result?.url !== 'string')
|
|
85
|
+
throw new Error('webAuth: the sign-in ended without a URL');
|
|
86
|
+
return result.url;
|
|
87
|
+
}
|
|
88
|
+
/** The environment fields the host answers, shaped as the web renderer's `HostRequestEnvironment`. */
|
|
89
|
+
export function nativeHostEnvironment() {
|
|
90
|
+
return {
|
|
91
|
+
share: async (data) => {
|
|
92
|
+
const params = {};
|
|
93
|
+
if (data.title)
|
|
94
|
+
params['title'] = data.title;
|
|
95
|
+
if (data.text)
|
|
96
|
+
params['text'] = data.text;
|
|
97
|
+
if (data.url)
|
|
98
|
+
params['url'] = data.url;
|
|
99
|
+
if (data.files?.length)
|
|
100
|
+
params['files'] = await Promise.all(data.files.map(bridgedFile));
|
|
101
|
+
const result = await hostRequest('share', params);
|
|
102
|
+
if (result?.outcome === 'cancelled') {
|
|
103
|
+
const error = new Error('cancelled: the viewer closed the share sheet');
|
|
104
|
+
error.name = 'AbortError';
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
canShare: () => true,
|
|
109
|
+
download: (blob, filename) => {
|
|
110
|
+
void hostRequest('share', { files: [{ name: filename, type: blob.type, data: base64Encode(blob.bytes()) }] }).catch(() => undefined);
|
|
111
|
+
},
|
|
112
|
+
pickFiles: async (options) => filesOf(await hostRequest('pickFiles', { accept: options.accept, multiple: options.multiple })),
|
|
113
|
+
objectURL: (file) => objectURL(file),
|
|
114
|
+
clipboard: {
|
|
115
|
+
writeText: (text) => hostRequest('clipboard', { action: 'write', text }).then(() => undefined),
|
|
116
|
+
writeImage: async (png) => {
|
|
117
|
+
const file = await png;
|
|
118
|
+
await hostRequest('clipboard', { action: 'write', files: [{ name: 'image.png', type: file.type || 'image/png', data: base64Encode(file.bytes()) }] });
|
|
119
|
+
},
|
|
120
|
+
readText: async () => (await hostRequest('clipboard', { action: 'readText' }))?.text ?? '',
|
|
121
|
+
},
|
|
122
|
+
pickColor: async (color) => (await hostRequest('pickColor', { color }))?.color ?? null,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/** Fills what `environment` lacks with the host's answers; what the page has stays. */
|
|
126
|
+
export function installHostEnvironment(environment) {
|
|
127
|
+
if (!bridge)
|
|
128
|
+
return;
|
|
129
|
+
for (const [key, value] of Object.entries(nativeHostEnvironment())) {
|
|
130
|
+
if (environment[key] === undefined)
|
|
131
|
+
environment[key] = value;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=hostRequests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hostRequests.js","sourceRoot":"","sources":["../src/hostRequests.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAkBxD,IAAI,MAAM,GAA6B,IAAI,CAAC;AAC5C,IAAI,MAAM,GA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AQ,EAAE,KAAK,IAAqB,EAAE,CAAC,CAAC,MAAM,WAAW,CAAoB,WAAW,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE,IAAI,IAAI,EAAE;SAC/H;QACD,SAAS,EAAE,KAAK,EAAE,KAAa,EAA0B,EAAE,CAAC,CAAC,MAAM,WAAW,CAAqB,WAAW,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,KAAK,IAAI,IAAI;KAC3I,CAAC;AACJ,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,sBAAsB,CAAC,WAAoC;IACzE,IAAI,CAAC,MAAM;QAAE,OAAO;IACpB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,EAAE,CAAC;QACnE,IAAI,WAAW,CAAC,GAAG,CAAC,KAAK,SAAS;YAAE,WAAW,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC/D,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,15 @@ export { installRuntime, type InstallOptions } from './runtime';
|
|
|
16
16
|
export { nativeBridge, launchArguments, type NativeBridge, type NativeFetchRequest, type NativeFetchResult, type WorkerEngine } from './bridge';
|
|
17
17
|
export { SimpleHeaders, SimpleRequest, SimpleResponse, SimpleAbortController, SimpleAbortSignal, createFetch } from './fetch';
|
|
18
18
|
export { SimpleURL, SimpleURLSearchParams } from './url';
|
|
19
|
+
export { SimpleBlob, SimpleFile, SimpleFormData, encodeMultipart, objectURL } from './blob';
|
|
20
|
+
export { NativeWebSocket, type NativeWebSocketEvent } from './webSocket';
|
|
21
|
+
export { createSubtleCrypto } from './subtle';
|
|
22
|
+
export { matchMedia, updateMediaEnvironment, type MediaEnvironment } from './matchMedia';
|
|
23
|
+
export { hostRequest, webAuthenticate, nativeHostEnvironment, installHostEnvironment, type WebAuthenticateOptions, type BridgedFile } from './hostRequests';
|
|
24
|
+
export { secureStorage, createSecureStorage, type SecureStorage } from './secureStorage';
|
|
19
25
|
export { SimpleTextEncoder, SimpleTextDecoder, base64Encode, base64Decode, utf8Encode, utf8Decode } from './encoding';
|
|
20
26
|
export { createWorker, NativeWorker, encodeMessage, decodeMessage, workerName, type NativeWorkerOptions, type WorkerLike, type WorkerMessageEvent, type WorkerErrorEvent } from './worker';
|
|
21
27
|
export { onOpenURL } from './openURL';
|
|
28
|
+
export { onNotification, registerForPush, type NotificationEvent, type NativeNotificationOptions, type RegisterForPushOptions } from './notifications';
|
|
29
|
+
export { createMediaSession, NativeMediaMetadata, type NativeMediaSession, type MediaMetadataInit, type MediaActionDetails, type MediaActionHandler, type MediaPositionState } from './mediaSession';
|
|
22
30
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,GAAG,EAAE,KAAK,UAAU,EAAE,KAAK,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,KAAK,YAAY,EAAE,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAChJ,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC9H,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,YAAY,EAAE,YAAY,EAAE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eAAe,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,KAAK,sBAAsB,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC5J,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACtH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,mBAAmB,EAAE,KAAK,UAAU,EAAE,KAAK,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC3L,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,iBAAiB,EAAE,KAAK,yBAAyB,EAAE,KAAK,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACvJ,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -16,7 +16,15 @@ export { installRuntime } from './runtime';
|
|
|
16
16
|
export { nativeBridge, launchArguments } from './bridge';
|
|
17
17
|
export { SimpleHeaders, SimpleRequest, SimpleResponse, SimpleAbortController, SimpleAbortSignal, createFetch } from './fetch';
|
|
18
18
|
export { SimpleURL, SimpleURLSearchParams } from './url';
|
|
19
|
+
export { SimpleBlob, SimpleFile, SimpleFormData, encodeMultipart, objectURL } from './blob';
|
|
20
|
+
export { NativeWebSocket } from './webSocket';
|
|
21
|
+
export { createSubtleCrypto } from './subtle';
|
|
22
|
+
export { matchMedia, updateMediaEnvironment } from './matchMedia';
|
|
23
|
+
export { hostRequest, webAuthenticate, nativeHostEnvironment, installHostEnvironment } from './hostRequests';
|
|
24
|
+
export { secureStorage, createSecureStorage } from './secureStorage';
|
|
19
25
|
export { SimpleTextEncoder, SimpleTextDecoder, base64Encode, base64Decode, utf8Encode, utf8Decode } from './encoding';
|
|
20
26
|
export { createWorker, NativeWorker, encodeMessage, decodeMessage, workerName } from './worker';
|
|
21
27
|
export { onOpenURL } from './openURL';
|
|
28
|
+
export { onNotification, registerForPush } from './notifications';
|
|
29
|
+
export { createMediaSession, NativeMediaMetadata } from './mediaSession';
|
|
22
30
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,GAAG,EAAiC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAoB,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,cAAc,EAAuB,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAyF,MAAM,UAAU,CAAC;AAChJ,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC9H,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACtH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAA6F,MAAM,UAAU,CAAC;AAC3L,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names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B,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `matchMedia` for the native app: `(prefers-color-scheme: dark)` and
|
|
3
|
+
* `light` follow the color scheme the host sends with the environment
|
|
4
|
+
* (run.ts hands it over), `(prefers-reduced-motion: reduce)` the host's
|
|
5
|
+
* accessibility setting when it sends one; every other query matches
|
|
6
|
+
* nothing. Listeners hear a change when the environment does.
|
|
7
|
+
*/
|
|
8
|
+
export interface MediaQueryListLike {
|
|
9
|
+
readonly media: string;
|
|
10
|
+
readonly matches: boolean;
|
|
11
|
+
onchange: ((event: {
|
|
12
|
+
matches: boolean;
|
|
13
|
+
media: string;
|
|
14
|
+
}) => void) | null;
|
|
15
|
+
addEventListener(type: 'change', listener: (event: {
|
|
16
|
+
matches: boolean;
|
|
17
|
+
media: string;
|
|
18
|
+
}) => void): void;
|
|
19
|
+
removeEventListener(type: 'change', listener: (event: {
|
|
20
|
+
matches: boolean;
|
|
21
|
+
media: string;
|
|
22
|
+
}) => void): void;
|
|
23
|
+
/** The older names. */
|
|
24
|
+
addListener(listener: (event: {
|
|
25
|
+
matches: boolean;
|
|
26
|
+
media: string;
|
|
27
|
+
}) => void): void;
|
|
28
|
+
removeListener(listener: (event: {
|
|
29
|
+
matches: boolean;
|
|
30
|
+
media: string;
|
|
31
|
+
}) => void): void;
|
|
32
|
+
}
|
|
33
|
+
export interface MediaEnvironment {
|
|
34
|
+
colorScheme?: 'light' | 'dark';
|
|
35
|
+
reducedMotion?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/** The runtime's `matchMedia(query)`. */
|
|
38
|
+
export declare function matchMedia(query: string): MediaQueryListLike;
|
|
39
|
+
/** What the host sent with the environment; lists whose answer changed tell their listeners. */
|
|
40
|
+
export declare function updateMediaEnvironment(next: MediaEnvironment): void;
|
|
41
|
+
/** Forgets the environment and the lists, for tests. */
|
|
42
|
+
export declare function resetMediaEnvironment(): void;
|
|
43
|
+
//# sourceMappingURL=matchMedia.d.ts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BAAkB,CAoB5D;AAED,gGAAgG;AAChG,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAUnE;AAED,wDAAwD;AACxD,wBAAgB,qBAAqB,IAAI,IAAI,CAG5C"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `matchMedia` for the native app: `(prefers-color-scheme: dark)` and
|
|
3
|
+
* `light` follow the color scheme the host sends with the environment
|
|
4
|
+
* (run.ts hands it over), `(prefers-reduced-motion: reduce)` the host's
|
|
5
|
+
* accessibility setting when it sends one; every other query matches
|
|
6
|
+
* nothing. Listeners hear a change when the environment does.
|
|
7
|
+
*/
|
|
8
|
+
let environment = {};
|
|
9
|
+
const lists = new Set();
|
|
10
|
+
function evaluate(query) {
|
|
11
|
+
const normalized = query.trim().toLowerCase().replace(/\s+/g, '');
|
|
12
|
+
if (normalized === '(prefers-color-scheme:dark)')
|
|
13
|
+
return environment.colorScheme === 'dark';
|
|
14
|
+
if (normalized === '(prefers-color-scheme:light)')
|
|
15
|
+
return environment.colorScheme !== 'dark';
|
|
16
|
+
if (normalized === '(prefers-reduced-motion:reduce)')
|
|
17
|
+
return environment.reducedMotion === true;
|
|
18
|
+
if (normalized === '(prefers-reduced-motion:no-preference)')
|
|
19
|
+
return environment.reducedMotion !== true;
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
/** The runtime's `matchMedia(query)`. */
|
|
23
|
+
export function matchMedia(query) {
|
|
24
|
+
const media = String(query);
|
|
25
|
+
const state = { media, matches: evaluate(media), listeners: new Set(), onchange: null };
|
|
26
|
+
lists.add(state);
|
|
27
|
+
return {
|
|
28
|
+
media,
|
|
29
|
+
get matches() {
|
|
30
|
+
return state.matches;
|
|
31
|
+
},
|
|
32
|
+
get onchange() {
|
|
33
|
+
return state.onchange;
|
|
34
|
+
},
|
|
35
|
+
set onchange(listener) {
|
|
36
|
+
state.onchange = listener;
|
|
37
|
+
},
|
|
38
|
+
addEventListener: (_type, listener) => void state.listeners.add(listener),
|
|
39
|
+
removeEventListener: (_type, listener) => void state.listeners.delete(listener),
|
|
40
|
+
addListener: (listener) => void state.listeners.add(listener),
|
|
41
|
+
removeListener: (listener) => void state.listeners.delete(listener),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/** What the host sent with the environment; lists whose answer changed tell their listeners. */
|
|
45
|
+
export function updateMediaEnvironment(next) {
|
|
46
|
+
environment = { ...environment, ...next };
|
|
47
|
+
for (const state of lists) {
|
|
48
|
+
const matches = evaluate(state.media);
|
|
49
|
+
if (matches === state.matches)
|
|
50
|
+
continue;
|
|
51
|
+
state.matches = matches;
|
|
52
|
+
const event = { matches, media: state.media };
|
|
53
|
+
state.onchange?.(event);
|
|
54
|
+
for (const listener of state.listeners)
|
|
55
|
+
listener(event);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/** Forgets the environment and the lists, for tests. */
|
|
59
|
+
export function resetMediaEnvironment() {
|
|
60
|
+
environment = {};
|
|
61
|
+
lists.clear();
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=matchMedia.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matchMedia.js","sourceRoot":"","sources":["../src/matchMedia.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAoBH,IAAI,WAAW,GAAqB,EAAE,CAAC;AACvC,MAAM,KAAK,GAAG,IAAI,GAAG,EAA4F,CAAC;AAElH,SAAS,QAAQ,CAAC,KAAa;IAC7B,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAClE,IAAI,UAAU,KAAK,6BAA6B;QAAE,OAAO,WAAW,CAAC,WAAW,KAAK,MAAM,CAAC;IAC5F,IAAI,UAAU,KAAK,8BAA8B;QAAE,OAAO,WAAW,CAAC,WAAW,KAAK,MAAM,CAAC;IAC7F,IAAI,UAAU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sBAAsB,CAAC,IAAsB;IAC3D,WAAW,GAAG,EAAE,GAAG,WAAW,EAAE,GAAG,IAAI,EAAE,CAAC;IAC1C,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,CAAC;QAC1B,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,OAAO,KAAK,KAAK,CAAC,OAAO;YAAE,SAAS;QACxC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;QACxB,MAAM,KAAK,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;QAC9C,KAAK,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC;QACxB,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,SAAS;YAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC;AAED,wDAAwD;AACxD,MAAM,UAAU,qBAAqB;IACnC,WAAW,GAAG,EAAE,CAAC;IACjB,KAAK,CAAC,KAAK,EAAE,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `navigator.mediaSession` and `MediaMetadata` for the native app: what an
|
|
3
|
+
* audio app tells the browser about what plays (the lock screen, the media
|
|
4
|
+
* keys) reaches the host's `mediaSession(update)` instead, which sets
|
|
5
|
+
* `MPNowPlayingInfoCenter` and `MPRemoteCommandCenter` (HostBridge.swift,
|
|
6
|
+
* NowPlayingBridge.swift); the commands the viewer gives come back to
|
|
7
|
+
* `__sbMediaSessionCommand(json)` and run the handlers `setActionHandler`
|
|
8
|
+
* registered, with the details the browser would give (`seekTime`,
|
|
9
|
+
* `seekOffset`). The update is the one the web renderer's `mediaSession`
|
|
10
|
+
* request carries (docs/ops-protocol.md, "Now playing"), so an app writes
|
|
11
|
+
* the same code for the page and the native app. In the page (the round
|
|
12
|
+
* trip) the page's own `navigator.mediaSession` is there already and
|
|
13
|
+
* nothing is installed over it.
|
|
14
|
+
*/
|
|
15
|
+
import type { NativeBridge } from './bridge';
|
|
16
|
+
type Action = 'play' | 'pause' | 'stop' | 'nexttrack' | 'previoustrack' | 'seekto' | 'seekforward' | 'seekbackward' | 'skipad' | 'togglemicrophone' | 'togglecamera' | 'hangup';
|
|
17
|
+
export interface MediaImage {
|
|
18
|
+
src: string;
|
|
19
|
+
sizes?: string;
|
|
20
|
+
type?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface MediaMetadataInit {
|
|
23
|
+
title?: string;
|
|
24
|
+
artist?: string;
|
|
25
|
+
album?: string;
|
|
26
|
+
artwork?: MediaImage[];
|
|
27
|
+
}
|
|
28
|
+
/** The browser's `MediaMetadata`. */
|
|
29
|
+
export declare class NativeMediaMetadata {
|
|
30
|
+
title: string;
|
|
31
|
+
artist: string;
|
|
32
|
+
album: string;
|
|
33
|
+
artwork: MediaImage[];
|
|
34
|
+
constructor(init?: MediaMetadataInit);
|
|
35
|
+
}
|
|
36
|
+
export interface MediaPositionState {
|
|
37
|
+
duration?: number;
|
|
38
|
+
playbackRate?: number;
|
|
39
|
+
position?: number;
|
|
40
|
+
}
|
|
41
|
+
export interface MediaActionDetails {
|
|
42
|
+
action: Action;
|
|
43
|
+
seekTime?: number;
|
|
44
|
+
seekOffset?: number;
|
|
45
|
+
}
|
|
46
|
+
export type MediaActionHandler = (details: MediaActionDetails) => void;
|
|
47
|
+
/** The browser's `navigator.mediaSession`, as far as audio apps use it. */
|
|
48
|
+
export interface NativeMediaSession {
|
|
49
|
+
metadata: NativeMediaMetadata | null;
|
|
50
|
+
playbackState: 'none' | 'playing' | 'paused';
|
|
51
|
+
setPositionState(state?: MediaPositionState): void;
|
|
52
|
+
setActionHandler(action: Action, handler: MediaActionHandler | null): void;
|
|
53
|
+
}
|
|
54
|
+
export declare function createMediaSession(native: Pick<NativeBridge, 'mediaSession'>): {
|
|
55
|
+
session: NativeMediaSession;
|
|
56
|
+
receive: (json: string) => void;
|
|
57
|
+
};
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=mediaSession.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mediaSession.d.ts","sourceRoot":"","sources":["../src/mediaSession.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,WAAW,GAAG,eAAe,GAAG,QAAQ,GAAG,aAAa,GAAG,cAAc,GAAG,QAAQ,GAAG,kBAAkB,GAAG,cAAc,GAAG,QAAQ,CAAC;AAchL,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;CACxB;AAED,qCAAqC;AACrC,qBAAa,mBAAmB;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,UAAU,EAAE,CAAC;gBAEV,IAAI,GAAE,iBAAsB;CAMzC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;AAEvE,2EAA2E;AAC3E,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACrC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;IAC7C,gBAAgB,CAAC,KAAK,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACnD,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,IAAI,GAAG,IAAI,CAAC;CAC5E;AASD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,GAAG;IAAE,OAAO,EAAE,kBAAkB,CAAC;IAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,CA0E/I"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `navigator.mediaSession` and `MediaMetadata` for the native app: what an
|
|
3
|
+
* audio app tells the browser about what plays (the lock screen, the media
|
|
4
|
+
* keys) reaches the host's `mediaSession(update)` instead, which sets
|
|
5
|
+
* `MPNowPlayingInfoCenter` and `MPRemoteCommandCenter` (HostBridge.swift,
|
|
6
|
+
* NowPlayingBridge.swift); the commands the viewer gives come back to
|
|
7
|
+
* `__sbMediaSessionCommand(json)` and run the handlers `setActionHandler`
|
|
8
|
+
* registered, with the details the browser would give (`seekTime`,
|
|
9
|
+
* `seekOffset`). The update is the one the web renderer's `mediaSession`
|
|
10
|
+
* request carries (docs/ops-protocol.md, "Now playing"), so an app writes
|
|
11
|
+
* the same code for the page and the native app. In the page (the round
|
|
12
|
+
* trip) the page's own `navigator.mediaSession` is there already and
|
|
13
|
+
* nothing is installed over it.
|
|
14
|
+
*/
|
|
15
|
+
/** The protocol's command each Media Session action is; the rest get no button. */
|
|
16
|
+
const COMMANDS = {
|
|
17
|
+
play: 'play',
|
|
18
|
+
pause: 'pause',
|
|
19
|
+
stop: 'stop',
|
|
20
|
+
nexttrack: 'nextTrack',
|
|
21
|
+
previoustrack: 'previousTrack',
|
|
22
|
+
seekto: 'seekTo',
|
|
23
|
+
seekforward: 'skipForward',
|
|
24
|
+
seekbackward: 'skipBackward',
|
|
25
|
+
};
|
|
26
|
+
/** The browser's `MediaMetadata`. */
|
|
27
|
+
export class NativeMediaMetadata {
|
|
28
|
+
title;
|
|
29
|
+
artist;
|
|
30
|
+
album;
|
|
31
|
+
artwork;
|
|
32
|
+
constructor(init = {}) {
|
|
33
|
+
this.title = init.title ?? '';
|
|
34
|
+
this.artist = init.artist ?? '';
|
|
35
|
+
this.album = init.album ?? '';
|
|
36
|
+
this.artwork = (init.artwork ?? []).map((image) => ({ ...image }));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export function createMediaSession(native) {
|
|
40
|
+
let metadata = null;
|
|
41
|
+
let playbackState = 'none';
|
|
42
|
+
let position = null;
|
|
43
|
+
const handlers = new Map();
|
|
44
|
+
// The whole state each time: the host keeps what it has and changes what differs.
|
|
45
|
+
const sync = () => {
|
|
46
|
+
const commands = [...handlers.keys()].map((action) => COMMANDS[action]).filter((command) => command !== undefined);
|
|
47
|
+
native.mediaSession?.(JSON.stringify({
|
|
48
|
+
metadata: metadata === null ? null : { title: metadata.title, artist: metadata.artist, album: metadata.album, artwork: metadata.artwork[0]?.src },
|
|
49
|
+
playbackState,
|
|
50
|
+
position: position === null
|
|
51
|
+
? null
|
|
52
|
+
: { duration: Number.isFinite(position.duration) ? position.duration : 0, position: position.position ?? 0, rate: position.playbackRate ?? 1 },
|
|
53
|
+
commands,
|
|
54
|
+
}));
|
|
55
|
+
};
|
|
56
|
+
const session = {
|
|
57
|
+
get metadata() {
|
|
58
|
+
return metadata;
|
|
59
|
+
},
|
|
60
|
+
set metadata(value) {
|
|
61
|
+
metadata = value === null || value === undefined ? null : value instanceof NativeMediaMetadata ? value : new NativeMediaMetadata(value);
|
|
62
|
+
sync();
|
|
63
|
+
},
|
|
64
|
+
get playbackState() {
|
|
65
|
+
return playbackState;
|
|
66
|
+
},
|
|
67
|
+
set playbackState(value) {
|
|
68
|
+
if (value !== 'none' && value !== 'playing' && value !== 'paused')
|
|
69
|
+
throw new TypeError(`${String(value)} is not a valid MediaSessionPlaybackState`);
|
|
70
|
+
playbackState = value;
|
|
71
|
+
sync();
|
|
72
|
+
},
|
|
73
|
+
setPositionState(state) {
|
|
74
|
+
if (state === undefined || state.duration === undefined) {
|
|
75
|
+
position = null;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
if (!(state.duration >= 0))
|
|
79
|
+
throw new TypeError('the duration must be a non-negative number');
|
|
80
|
+
if (state.position !== undefined && (state.position < 0 || state.position > state.duration))
|
|
81
|
+
throw new TypeError('the position must be within the duration');
|
|
82
|
+
position = { ...state };
|
|
83
|
+
}
|
|
84
|
+
sync();
|
|
85
|
+
},
|
|
86
|
+
setActionHandler(action, handler) {
|
|
87
|
+
if (!(action in COMMANDS) && !['skipad', 'togglemicrophone', 'togglecamera', 'hangup'].includes(action))
|
|
88
|
+
throw new TypeError(`${String(action)} is not a valid MediaSessionAction`);
|
|
89
|
+
if (handler)
|
|
90
|
+
handlers.set(action, handler);
|
|
91
|
+
else
|
|
92
|
+
handlers.delete(action);
|
|
93
|
+
sync();
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
const receive = (json) => {
|
|
97
|
+
let received;
|
|
98
|
+
try {
|
|
99
|
+
received = JSON.parse(json);
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const action = Object.keys(COMMANDS).find((name) => COMMANDS[name] === received.command);
|
|
105
|
+
if (!action)
|
|
106
|
+
return;
|
|
107
|
+
const handler = handlers.get(action);
|
|
108
|
+
if (!handler)
|
|
109
|
+
return;
|
|
110
|
+
const details = { action };
|
|
111
|
+
if (action === 'seekto' && typeof received.position === 'number')
|
|
112
|
+
details.seekTime = received.position;
|
|
113
|
+
if ((action === 'seekforward' || action === 'seekbackward') && typeof received.interval === 'number')
|
|
114
|
+
details.seekOffset = received.interval;
|
|
115
|
+
handler(details);
|
|
116
|
+
};
|
|
117
|
+
return { session, receive };
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=mediaSession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mediaSession.js","sourceRoot":"","sources":["../src/mediaSession.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,mFAAmF;AACnF,MAAM,QAAQ,GAAoC;IAChD,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,WAAW;IACtB,aAAa,EAAE,eAAe;IAC9B,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,aAAa;IAC1B,YAAY,EAAE,cAAc;CAC7B,CAAC;AAeF,qCAAqC;AACrC,MAAM,OAAO,mBAAmB;IAC9B,KAAK,CAAS;IACd,MAAM,CAAS;IACf,KAAK,CAAS;IACd,OAAO,CAAe;IAEtB,YAAY,OAA0B,EAAE;QACtC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;QAChC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC;IACrE,CAAC;CACF;AA+BD,MAAM,UAAU,kBAAkB,CAAC,MAA0C;IAC3E,IAAI,QAAQ,GAA+B,IAAI,CAAC;IAChD,IAAI,aAAa,GAAwC,MAAM,CAAC;IAChE,IAAI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