@volorio/live-streaming-player 0.2.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.
- package/README.md +7 -0
- package/dist/src/index.d.ts +18 -0
- package/dist/src/index.js +32 -0
- package/dist/src/index.js.map +1 -0
- package/package.json +27 -0
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { VolorioBrowserSession, VolorioRoomClient } from "@volorio/rtc";
|
|
2
|
+
export declare const volorioLiveStreamingProductId = "live_streaming";
|
|
3
|
+
export declare const volorioLiveStreamingSessionFeatures: {
|
|
4
|
+
readonly liveStreaming: true;
|
|
5
|
+
};
|
|
6
|
+
export interface VolorioLiveStreamingPlayerState {
|
|
7
|
+
status: "idle" | "joining" | "playing" | "stopped" | "error";
|
|
8
|
+
streamId?: string;
|
|
9
|
+
lastError?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class VolorioLiveStreamingPlayer {
|
|
12
|
+
private readonly room;
|
|
13
|
+
private state;
|
|
14
|
+
constructor(room: Pick<VolorioRoomClient, "join" | "disconnect">);
|
|
15
|
+
getState(): VolorioLiveStreamingPlayerState;
|
|
16
|
+
play(streamId: string, session: VolorioBrowserSession): Promise<void>;
|
|
17
|
+
stop(): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VolorioLiveStreamingPlayer = exports.volorioLiveStreamingSessionFeatures = exports.volorioLiveStreamingProductId = void 0;
|
|
4
|
+
exports.volorioLiveStreamingProductId = "live_streaming";
|
|
5
|
+
exports.volorioLiveStreamingSessionFeatures = { liveStreaming: true };
|
|
6
|
+
class VolorioLiveStreamingPlayer {
|
|
7
|
+
room;
|
|
8
|
+
state = { status: "idle" };
|
|
9
|
+
constructor(room) {
|
|
10
|
+
this.room = room;
|
|
11
|
+
}
|
|
12
|
+
getState() {
|
|
13
|
+
return { ...this.state };
|
|
14
|
+
}
|
|
15
|
+
async play(streamId, session) {
|
|
16
|
+
this.state = { status: "joining", streamId };
|
|
17
|
+
try {
|
|
18
|
+
await this.room.join(session);
|
|
19
|
+
this.state = { status: "playing", streamId };
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
this.state = { status: "error", streamId, lastError: error instanceof Error ? error.message : String(error) };
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
stop() {
|
|
27
|
+
this.room.disconnect();
|
|
28
|
+
this.state = { status: "stopped", streamId: this.state.streamId };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.VolorioLiveStreamingPlayer = VolorioLiveStreamingPlayer;
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAEa,QAAA,6BAA6B,GAAG,gBAAgB,CAAC;AACjD,QAAA,mCAAmC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAW,CAAC;AAQpF,MAAa,0BAA0B;IAGR;IAFrB,KAAK,GAAoC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAEpE,YAA6B,IAAoD;QAApD,SAAI,GAAJ,IAAI,CAAgD;IAAG,CAAC;IAErF,QAAQ;QACN,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,QAAgB,EAAE,OAA8B;QACzD,IAAI,CAAC,KAAK,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;QAC7C,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC9B,IAAI,CAAC,KAAK,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;QAC/C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9G,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED,IAAI;QACF,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IACpE,CAAC;CACF;AAxBD,gEAwBC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@volorio/live-streaming-player",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Volorio live streaming player helpers built on Volorio RTC sessions.",
|
|
6
|
+
"main": "dist/src/index.js",
|
|
7
|
+
"types": "dist/src/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/src/index.d.ts",
|
|
11
|
+
"default": "./dist/src/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": ["dist/src", "README.md"],
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public",
|
|
17
|
+
"registry": "https://registry.npmjs.org/"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc -p tsconfig.build.json",
|
|
21
|
+
"test": "pnpm build",
|
|
22
|
+
"pack:local": "pnpm build && npm pack --pack-destination dist"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@volorio/rtc": "^0.2.0"
|
|
26
|
+
}
|
|
27
|
+
}
|