@tak-ps/cloudtak 13.77.0 → 13.78.0

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.
@@ -1,3 +1,5 @@
1
+ import 'video.js/dist/video-js.css';
2
+ import { type PlaybackProtocol } from './video/protocol.ts';
1
3
  export type VideoPlayerMetadata = {
2
4
  name: string;
3
5
  active: boolean;
@@ -12,9 +14,11 @@ type __VLS_Props = {
12
14
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
15
  metadata: (metadata: VideoPlayerMetadata) => any;
14
16
  error: (error: Error) => any;
17
+ protocol: (protocol: PlaybackProtocol) => any;
15
18
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
16
19
  onMetadata?: ((metadata: VideoPlayerMetadata) => any) | undefined;
17
20
  onError?: ((error: Error) => any) | undefined;
21
+ onProtocol?: ((protocol: PlaybackProtocol) => any) | undefined;
18
22
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
23
  declare const _default: typeof __VLS_export;
20
24
  export default _default;
@@ -0,0 +1,80 @@
1
+ /**
2
+ * WhepReader - WebRTC/WHEP reader for MediaMTX streams.
3
+ *
4
+ * A TypeScript port of the MediaMTX `reader.js` (MediaMTXWebRTCReader) shipped
5
+ * with the MediaMTX web player, retaining its behaviour:
6
+ * - ICE servers are discovered via an OPTIONS request (Link headers)
7
+ * - The SDP offer is edited to enable stereo Opus & non-advertised codecs
8
+ * - ICE candidates are trickled via PATCH (application/trickle-ice-sdpfrag)
9
+ * - Failures tear the session down and restart after a short pause
10
+ *
11
+ * Credentials are sent via the Authorization header (never in the URL).
12
+ */
13
+ export type WhepReaderConfig = {
14
+ /** Absolute URL of the WHEP endpoint */
15
+ url: string;
16
+ user?: string;
17
+ pass?: string;
18
+ token?: string;
19
+ /** Pause between restarts after an error (ms) */
20
+ retryPause?: number;
21
+ /** Abort a connection attempt that has not produced a track in this time (ms) */
22
+ connectTimeout?: number;
23
+ onError?: (err: string) => void;
24
+ onTrack?: (evt: RTCTrackEvent) => void;
25
+ onDataChannel?: (evt: RTCDataChannelEvent) => void;
26
+ /** Called once the peer connection reaches the connected state */
27
+ onConnected?: () => void;
28
+ };
29
+ type OfferData = {
30
+ iceUfrag: string;
31
+ icePwd: string;
32
+ medias: string[];
33
+ };
34
+ export default class WhepReader {
35
+ static DEFAULT_RETRY_PAUSE: number;
36
+ static DEFAULT_CONNECT_TIMEOUT: number;
37
+ private static nonAdvertisedCodecsProbe;
38
+ static isSupported(): boolean;
39
+ private conf;
40
+ private state;
41
+ private restartTimeout;
42
+ private connectTimeout;
43
+ private pc;
44
+ private offerData;
45
+ private sessionUrl;
46
+ private queuedCandidates;
47
+ private nonAdvertisedCodecs;
48
+ constructor(conf: WhepReaderConfig);
49
+ close(): void;
50
+ private static supportsNonAdvertisedCodec;
51
+ private static unquoteCredential;
52
+ static linkToIceServers(links: string | null): RTCIceServer[];
53
+ static parseOffer(sdp: string): OfferData;
54
+ private static reservePayloadType;
55
+ private static addCodec;
56
+ private static enableStereoPcmau;
57
+ private static enableMultichannelOpus;
58
+ private static enableL16;
59
+ private static enableStereoOpus;
60
+ static editOffer(sdp: string, nonAdvertisedCodecs: string[]): string;
61
+ static generateSdpFragment(od: OfferData, candidates: RTCIceCandidate[]): string;
62
+ private handleError;
63
+ private restart;
64
+ private static probeNonAdvertisedCodecs;
65
+ private getNonAdvertisedCodecs;
66
+ private start;
67
+ private armConnectTimeout;
68
+ private clearConnectTimeout;
69
+ private authHeader;
70
+ private requestICEServers;
71
+ private setupPeerConnection;
72
+ private sendOffer;
73
+ private setAnswer;
74
+ private onLocalCandidate;
75
+ private sendLocalCandidates;
76
+ private onConnectionState;
77
+ private onTrack;
78
+ private onDataChannel;
79
+ }
80
+ export {};
@@ -0,0 +1,26 @@
1
+ import type { VideoLeaseProtocols } from '../../../types.ts';
2
+ export type PlaybackProtocol = 'webrtc' | 'hls';
3
+ /**
4
+ * Leases proxying an existing HTTP(S) source are HLS streams being re-served
5
+ * by MediaMTX - keep HLS as their default. Everything else (RTSP/RTMP/SRT/etc)
6
+ * is served over WebRTC with HLS as the fallback.
7
+ */
8
+ export declare function isHlsSource(source?: string | null): boolean;
9
+ /**
10
+ * Ordered list of protocols to attempt for playback - the first entry is the
11
+ * default and each subsequent entry is a fallback
12
+ */
13
+ export declare function playbackOrder(protocols: VideoLeaseProtocols | undefined, source?: string | null, webrtcSupported?: boolean): PlaybackProtocol[];
14
+ /**
15
+ * Split embedded basic-auth credentials out of a stream URL so they can be
16
+ * sent via the Authorization header instead of being exposed in the URL
17
+ */
18
+ export declare function splitCredentials(input: string): {
19
+ url: string;
20
+ username: string;
21
+ password: string;
22
+ };
23
+ /**
24
+ * MediaMTX serves WHEP at `<webrtc path url>/whep`
25
+ */
26
+ export declare function whepUrl(webrtc: string): string;
@@ -1,5 +1,16 @@
1
1
  import type { Position } from '@capacitor/geolocation';
2
2
  import type { DevicePermissionContext } from './types.ts';
3
+ /**
4
+ * When set, the native layer POSTs each fix to `url` directly, independent of
5
+ * the WebView - iOS suspends the WebContent process in the background, so
6
+ * bridge-delivered fixes stop flowing while native delivery keeps working.
7
+ */
8
+ export type NativeDeliveryOptions = {
9
+ url: string;
10
+ headers?: Record<string, string>;
11
+ /** Minimum ms between native POSTs (and the Android update interval). */
12
+ minIntervalMs?: number;
13
+ };
3
14
  export declare class GeolocationPermission {
4
15
  private readonly context;
5
16
  constructor(context: DevicePermissionContext);
@@ -7,16 +18,22 @@ export declare class GeolocationPermission {
7
18
  private watchGeneration;
8
19
  private lastLocationTimestamp;
9
20
  private locationCallback;
10
- private static readonly DISTANCE_FILTER_M;
11
21
  private static readonly SEED_TIMEOUT_MS;
12
22
  private static readonly SEED_MAX_AGE_MS;
13
23
  static supportsLocationRequests(): boolean;
14
24
  refreshStatus(): Promise<void>;
25
+ private refreshBackgroundStatus;
15
26
  request(onGranted?: () => void): Promise<void>;
16
27
  initializeSubscription(onGranted?: () => void): Promise<void>;
17
- startWatch(onLocation: (position: Position) => void): Promise<void>;
28
+ startWatch(onLocation: (position: Position) => void, native?: NativeDeliveryOptions): Promise<void>;
18
29
  private seedImmediateFix;
19
30
  stopWatch(): Promise<void>;
20
31
  private startBackgroundWatch;
32
+ /**
33
+ * Point native POST delivery at a rotated auth token. Best-effort: the
34
+ * watch restarts with fresh headers on the next app boot regardless.
35
+ */
36
+ static updateNativeHeaders(headers: Record<string, string>): Promise<void>;
37
+ openNativeSettings(): Promise<void>;
21
38
  private static backgroundLocationToPosition;
22
39
  }
@@ -1,5 +1,5 @@
1
- export type BrowserPermissionState = PermissionState | 'unsupported' | 'unknown';
2
- export type BrowserPermissionType = 'location' | 'notification' | 'orientation' | 'storage' | 'camera' | 'wakeLock' | 'fileSystem';
1
+ export type BrowserPermissionState = PermissionState | 'when_in_use' | 'unsupported' | 'unknown';
2
+ export type BrowserPermissionType = 'location' | 'backgroundLocation' | 'notification' | 'orientation' | 'storage' | 'camera' | 'wakeLock' | 'fileSystem';
3
3
  export type FileSystemAccessHandle = FileSystemHandle & {
4
4
  queryPermission?: (descriptor?: {
5
5
  mode?: 'read' | 'readwrite';
@@ -13,6 +13,7 @@ export type { BrowserPermissionState, BrowserPermissionType } from './device/typ
13
13
  export { CameraPermission } from './device/camera.ts';
14
14
  export { FileSystemPermission } from './device/file-system.ts';
15
15
  export { GeolocationPermission } from './device/geolocation.ts';
16
+ export type { NativeDeliveryOptions } from './device/geolocation.ts';
16
17
  export { BrowserNotificationPermission } from './device/notification.ts';
17
18
  export type { PushNotificationData } from './device/notification.ts';
18
19
  export { OrientationPermission } from './device/orientation.ts';
@@ -27,6 +28,7 @@ export declare const useDeviceStore: import("pinia").SetupStoreDefinition<"devic
27
28
  storage: BrowserPermissionState;
28
29
  orientation: BrowserPermissionState;
29
30
  location: BrowserPermissionState;
31
+ backgroundLocation: BrowserPermissionState;
30
32
  camera: BrowserPermissionState;
31
33
  wakeLock: BrowserPermissionState;
32
34
  fileSystem: BrowserPermissionState;
@@ -13,7 +13,6 @@ import * as mapgl from 'maplibre-gl';
13
13
  import type Atlas from '../workers/atlas.ts';
14
14
  import type { Feature } from '../types.ts';
15
15
  import type { LngLat, Point, MapGeoJSONFeature } from 'maplibre-gl';
16
- import type { Position } from '@capacitor/geolocation';
17
16
  export type TAKNotification = {
18
17
  type: string;
19
18
  name: string;
@@ -37,7 +36,6 @@ export declare const useMapStore: import("pinia").StoreDefinition<"cloudtak", {
37
36
  };
38
37
  _overlayReconcile?: Promise<void>;
39
38
  _overlayReconcileQueued?: boolean;
40
- _lastLocationHttpSubmit?: number;
41
39
  channel: BroadcastChannel;
42
40
  toImport: Feature[];
43
41
  locked: Array<string>;
@@ -159,7 +157,6 @@ export declare const useMapStore: import("pinia").StoreDefinition<"cloudtak", {
159
157
  */
160
158
  resumeFromBackground: () => Promise<void>;
161
159
  init: (container: HTMLElement) => Promise<void>;
162
- submitLocationHttp: (position: Position) => Promise<void>;
163
160
  initOverlays: () => Promise<void>;
164
161
  /**
165
162
  * Reconcile the loaded map overlays against the local overlay
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tak-ps/cloudtak",
3
3
  "type": "module",
4
- "version": "13.77.0",
4
+ "version": "13.78.0",
5
5
  "types": "dist/types/plugin.d.ts",
6
6
  "files": [
7
7
  "dist/types"
@@ -100,6 +100,7 @@
100
100
  "terra-draw-route-snap-mode": "^0.4.1",
101
101
  "terra-route": "^0.0.18",
102
102
  "uuid": "^14.0.0",
103
+ "video.js": "^8.24.0",
103
104
  "vue": "^3.2.31",
104
105
  "vue-component-type-helpers": "^3.0.7",
105
106
  "vue-eslint-parser": "^10.4.1",