@touchcastllc/napster-companion-api-dev 1.0.0-alpha.45 → 1.0.0-alpha.47
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/lib/components/Avatar/index.d.ts +1 -2
- package/lib/components/StyledTooltip/index.d.ts +3 -2
- package/lib/components/WaveForm/index.d.ts +0 -1
- package/lib/components/controls/createEndButton.d.ts +2 -0
- package/lib/components/controls/createMuteButton.d.ts +2 -0
- package/lib/components/controls/createScreenShareButton.d.ts +5 -0
- package/lib/components/controls/createVolumeButton.d.ts +2 -0
- package/lib/components/controls/index.d.ts +6 -0
- package/lib/components/controls/styles.d.ts +2 -0
- package/lib/components/controls/types.d.ts +4 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.esm.js +1 -1
- package/lib/index.js +1 -1
- package/lib/index.standalone.js +1 -1
- package/lib/services/microphoneManager.d.ts +26 -0
- package/lib/services/webrtc.d.ts +0 -1
- package/lib/stores/index.d.ts +1 -1
- package/lib/stores/selectors.d.ts +4 -0
- package/lib/stores/slices/avatarSlice.d.ts +5 -1
- package/lib/types/documentPiP.d.ts +17 -0
- package/lib/types/index.d.ts +14 -0
- package/lib/utils/PiPManager.d.ts +19 -0
- package/package.json +2 -2
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type MicManagerEventMap = {
|
|
2
|
+
stream: MediaStream | null;
|
|
3
|
+
muted: boolean;
|
|
4
|
+
device: string | undefined;
|
|
5
|
+
error: Error;
|
|
6
|
+
};
|
|
7
|
+
export type MicManagerEvent = keyof MicManagerEventMap;
|
|
8
|
+
type Handler<E extends MicManagerEvent> = (payload: MicManagerEventMap[E]) => void;
|
|
9
|
+
export interface MicrophoneStartOptions {
|
|
10
|
+
deviceId?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface MicrophoneManager {
|
|
13
|
+
start(options?: MicrophoneStartOptions): Promise<MediaStream>;
|
|
14
|
+
stop(): void;
|
|
15
|
+
switchDevice(deviceId: string): Promise<MediaStream>;
|
|
16
|
+
setMuted(muted: boolean): void;
|
|
17
|
+
isMuted(): boolean;
|
|
18
|
+
getStream(): MediaStream | null;
|
|
19
|
+
getTrack(): MediaStreamTrack | null;
|
|
20
|
+
getAnalyser(): AnalyserNode | null;
|
|
21
|
+
getCurrentDeviceId(): string | undefined;
|
|
22
|
+
on<E extends MicManagerEvent>(event: E, handler: Handler<E>): () => void;
|
|
23
|
+
}
|
|
24
|
+
export declare const DEFAULT_AUDIO_CONSTRAINTS: MediaTrackConstraints;
|
|
25
|
+
export declare function getMicrophoneManager(): MicrophoneManager;
|
|
26
|
+
export {};
|
package/lib/services/webrtc.d.ts
CHANGED
|
@@ -19,7 +19,6 @@ interface WebRTCParams {
|
|
|
19
19
|
onStreams?: (streams: {
|
|
20
20
|
videoStream?: MediaStream | null;
|
|
21
21
|
audioStream?: MediaStream | null;
|
|
22
|
-
userMicrophoneStream?: MediaStream | null;
|
|
23
22
|
}) => void;
|
|
24
23
|
onDataChannel?: (dc: RTCDataChannel) => void;
|
|
25
24
|
maxReconnectAttempts?: number;
|
package/lib/stores/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { store } from "./store";
|
|
|
2
2
|
export type { RootState, AppDispatch } from "./store";
|
|
3
3
|
export { setOnFeaturesUpdateCallback } from "./middleware/featuresUpdateMiddleware";
|
|
4
4
|
export * from "./selectors";
|
|
5
|
-
export { setSessionId, setAvatarReady, setDataChannel, setAvatarId, setVideoId, setStopInteraction, setMuted, addTranscript, setCustomVoiceId, setDefaultVoiceId, setConnectionToken, setCloseConnectionHandler, avatarReducer, } from "./slices/avatarSlice";
|
|
5
|
+
export { setSessionId, setAvatarReady, setDataChannel, setAvatarId, setVideoId, setStopInteraction, setMuted, setVolume, setAvatarSpeaking, setScreenSharing, setUserTalking, addTranscript, setCustomVoiceId, setDefaultVoiceId, setConnectionToken, setCloseConnectionHandler, avatarReducer, } from "./slices/avatarSlice";
|
|
6
6
|
export type { WebRTCStatus, AvatarState, Transcript, } from "./slices/avatarSlice";
|
|
7
7
|
export { appReducer, setFeatures, resetFeatures, setPosition, setShowExperience, setDebugMode, } from "./slices/appSlice";
|
|
8
8
|
export type { AppState } from "./slices/appSlice";
|
|
@@ -10,6 +10,10 @@ export declare const selectDataChannel: (state: RootState) => RTCDataChannel | n
|
|
|
10
10
|
export declare const selectAvatarId: (state: RootState) => string | undefined;
|
|
11
11
|
export declare const selectVideoId: (state: RootState) => string | undefined;
|
|
12
12
|
export declare const selectMuted: (state: RootState) => boolean;
|
|
13
|
+
export declare const selectVolume: (state: RootState) => number;
|
|
14
|
+
export declare const selectAvatarSpeaking: (state: RootState) => boolean;
|
|
15
|
+
export declare const selectScreenSharing: (state: RootState) => boolean;
|
|
16
|
+
export declare const selectUserTalking: (state: RootState) => boolean;
|
|
13
17
|
export declare const selectTranscript: (state: RootState) => Transcript | undefined;
|
|
14
18
|
export declare const selectCustomVoiceId: (state: RootState) => string | undefined;
|
|
15
19
|
export declare const selectDefaultVoiceId: (state: RootState) => string | undefined;
|
|
@@ -15,6 +15,10 @@ export interface AvatarState {
|
|
|
15
15
|
videoId?: string;
|
|
16
16
|
stopInteraction: boolean;
|
|
17
17
|
muted: boolean;
|
|
18
|
+
volume: number;
|
|
19
|
+
avatarSpeaking: boolean;
|
|
20
|
+
isScreenSharing: boolean;
|
|
21
|
+
isUserTalking: boolean;
|
|
18
22
|
transcript?: Transcript;
|
|
19
23
|
customVoiceId: string | undefined;
|
|
20
24
|
defaultVoiceId: string | undefined;
|
|
@@ -22,5 +26,5 @@ export interface AvatarState {
|
|
|
22
26
|
companionId?: string;
|
|
23
27
|
closeConnectionHandler?: () => void;
|
|
24
28
|
}
|
|
25
|
-
export declare const setSessionId: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "avatar/setSessionId">, setAvatarReady: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setAvatarReady">, setDataChannel: import("@reduxjs/toolkit").ActionCreatorWithPayload<RTCDataChannel | null, "avatar/setDataChannel">, setAvatarId: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "avatar/setAvatarId">, setVideoId: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "avatar/setVideoId">, setStopInteraction: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setStopInteraction">, setMuted: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setMuted">, addTranscript: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<Transcript | undefined, "avatar/addTranscript">, setCustomVoiceId: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "avatar/setCustomVoiceId">, setDefaultVoiceId: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "avatar/setDefaultVoiceId">, setConnectionToken: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "avatar/setConnectionToken">, setCloseConnectionHandler: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<(() => void) | undefined, "avatar/setCloseConnectionHandler">;
|
|
29
|
+
export declare const setSessionId: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "avatar/setSessionId">, setAvatarReady: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setAvatarReady">, setDataChannel: import("@reduxjs/toolkit").ActionCreatorWithPayload<RTCDataChannel | null, "avatar/setDataChannel">, setAvatarId: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "avatar/setAvatarId">, setVideoId: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "avatar/setVideoId">, setStopInteraction: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setStopInteraction">, setMuted: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setMuted">, setVolume: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, "avatar/setVolume">, setAvatarSpeaking: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setAvatarSpeaking">, setScreenSharing: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setScreenSharing">, setUserTalking: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setUserTalking">, addTranscript: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<Transcript | undefined, "avatar/addTranscript">, setCustomVoiceId: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "avatar/setCustomVoiceId">, setDefaultVoiceId: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "avatar/setDefaultVoiceId">, setConnectionToken: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "avatar/setConnectionToken">, setCloseConnectionHandler: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<(() => void) | undefined, "avatar/setCloseConnectionHandler">;
|
|
26
30
|
export declare const avatarReducer: import("redux").Reducer<AvatarState>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface DocumentPictureInPicture {
|
|
2
|
+
requestWindow(options?: {
|
|
3
|
+
width?: number;
|
|
4
|
+
height?: number;
|
|
5
|
+
disallowReturnToOpener?: boolean;
|
|
6
|
+
}): Promise<Window>;
|
|
7
|
+
readonly window: Window | null;
|
|
8
|
+
}
|
|
9
|
+
declare global {
|
|
10
|
+
interface Window {
|
|
11
|
+
documentPictureInPicture?: DocumentPictureInPicture;
|
|
12
|
+
}
|
|
13
|
+
interface MediaSession {
|
|
14
|
+
setActionHandler(action: "enterpictureinpicture", handler: (() => void) | null): void;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export {};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -133,6 +133,15 @@ export interface FeatureConfig {
|
|
|
133
133
|
/** Optional loader animation type. */
|
|
134
134
|
type?: "spinner" | "pulse";
|
|
135
135
|
};
|
|
136
|
+
/** Document Picture-in-Picture. When enabled, the avatar automatically
|
|
137
|
+
* opens in a PiP window when the user switches browser tabs (Chrome/Edge 116+). */
|
|
138
|
+
pictureInPicture?: {
|
|
139
|
+
enabled: boolean;
|
|
140
|
+
/** PiP window width in pixels. Default: 400. */
|
|
141
|
+
width?: number;
|
|
142
|
+
/** PiP window height in pixels. Default: 300. */
|
|
143
|
+
height?: number;
|
|
144
|
+
};
|
|
136
145
|
/** Screen sharing feature. When enabled, users can share their screen during a session. */
|
|
137
146
|
screenShare?: {
|
|
138
147
|
enabled: boolean;
|
|
@@ -295,6 +304,11 @@ export interface NapsterCompanionApiInstance {
|
|
|
295
304
|
avatarIsVisible: () => boolean;
|
|
296
305
|
/** Tear down the SDK, remove DOM nodes and clean up resources. */
|
|
297
306
|
destroy: () => void;
|
|
307
|
+
/**
|
|
308
|
+
* The current session identifier. Available after a connection is established
|
|
309
|
+
* and reset to `undefined` once the connection is closed.
|
|
310
|
+
*/
|
|
311
|
+
readonly sessionId: string | undefined;
|
|
298
312
|
/** Update the inline style object applied to the SDK root container. */
|
|
299
313
|
updateStyles: (styles: NapsterCompanionApiConfig["style"]) => void;
|
|
300
314
|
/** Set the position of the SDK on screen (see `Position`). */
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface PiPController {
|
|
2
|
+
destroy: () => void;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Creates a PiP controller that opens a Document Picture-in-Picture window
|
|
6
|
+
* via Media Session API when the user switches tabs, and closes it on return.
|
|
7
|
+
* Chrome/Edge 116+.
|
|
8
|
+
*
|
|
9
|
+
* Requirements for auto-PiP trigger:
|
|
10
|
+
* - Secure context (HTTPS) — https://developer.mozilla.org/en-US/docs/Web/API/Document_Picture-in-Picture_API
|
|
11
|
+
* - Active media playback with audio — https://developer.chrome.com/blog/automatic-picture-in-picture-media-playback
|
|
12
|
+
* - Media Engagement Index threshold met (user frequently consumes media on the site)
|
|
13
|
+
* - enterpictureinpicture Media Session action handler registered
|
|
14
|
+
*/
|
|
15
|
+
export declare function createPiPManager(handlers: {
|
|
16
|
+
onEnd: () => void;
|
|
17
|
+
onScreenShareToggle: () => void;
|
|
18
|
+
isScreenShareSupported: () => boolean;
|
|
19
|
+
}): PiPController;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@touchcastllc/napster-companion-api-dev",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.47",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"napster",
|
|
6
6
|
"companion-api",
|
|
@@ -51,6 +51,6 @@
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"publishConfig": {
|
|
54
|
-
"access": "
|
|
54
|
+
"access": "public"
|
|
55
55
|
}
|
|
56
56
|
}
|