vue-streaming 0.1.4 → 0.1.5
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/dist/index.cjs +109 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +87 -1
- package/dist/index.d.ts +87 -1
- package/dist/index.global.js +98442 -3
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +107 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,113 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var vue = require('vue');
|
|
4
|
+
var jsStreaming = require('js-streaming');
|
|
5
|
+
|
|
6
|
+
// src/components/StreamPlayer.ts
|
|
7
|
+
var StreamPlayer_default = vue.defineComponent({
|
|
8
|
+
name: "StreamPlayer",
|
|
9
|
+
props: {
|
|
10
|
+
type: { type: String, required: true },
|
|
11
|
+
config: { type: Object, required: true },
|
|
12
|
+
autoOpen: { type: Boolean, default: false },
|
|
13
|
+
autoplay: { type: Boolean, default: false },
|
|
14
|
+
controls: { type: Boolean, default: true },
|
|
15
|
+
playsInline: { type: Boolean, default: true },
|
|
16
|
+
muted: { type: Boolean, default: false },
|
|
17
|
+
logLimit: { type: Number, default: 500 }
|
|
18
|
+
},
|
|
19
|
+
emits: ["open", "close", "status", "error", "message"],
|
|
20
|
+
setup(props, { emit, expose }) {
|
|
21
|
+
const status = vue.ref("idle");
|
|
22
|
+
const isOpen = vue.ref(false);
|
|
23
|
+
const error = vue.ref(null);
|
|
24
|
+
const messages = vue.shallowRef([]);
|
|
25
|
+
const videoRef = vue.ref(null);
|
|
26
|
+
let api = null;
|
|
27
|
+
let unsubs = [];
|
|
28
|
+
function destroyAPI() {
|
|
29
|
+
try {
|
|
30
|
+
api?.close();
|
|
31
|
+
} catch {
|
|
32
|
+
}
|
|
33
|
+
for (const off of unsubs) off();
|
|
34
|
+
unsubs = [];
|
|
35
|
+
api = null;
|
|
36
|
+
isOpen.value = false;
|
|
37
|
+
}
|
|
38
|
+
function bindAPI(a) {
|
|
39
|
+
const onOpen = () => {
|
|
40
|
+
isOpen.value = true;
|
|
41
|
+
emit("open");
|
|
42
|
+
};
|
|
43
|
+
const onClose = () => {
|
|
44
|
+
isOpen.value = false;
|
|
45
|
+
emit("close");
|
|
46
|
+
};
|
|
47
|
+
const onStatus = (s) => {
|
|
48
|
+
status.value = s;
|
|
49
|
+
emit("status", s);
|
|
50
|
+
};
|
|
51
|
+
const onError = (e) => {
|
|
52
|
+
error.value = e;
|
|
53
|
+
emit("error", e);
|
|
54
|
+
};
|
|
55
|
+
const onMessage = (m) => {
|
|
56
|
+
const next = messages.value.slice();
|
|
57
|
+
next.push(m);
|
|
58
|
+
messages.value = next.slice(-props.logLimit);
|
|
59
|
+
emit("message", m);
|
|
60
|
+
};
|
|
61
|
+
unsubs.push(a.on("open", onOpen));
|
|
62
|
+
unsubs.push(a.on("close", onClose));
|
|
63
|
+
unsubs.push(a.on("status", onStatus));
|
|
64
|
+
unsubs.push(a.on("error", onError));
|
|
65
|
+
unsubs.push(a.on("message", onMessage));
|
|
66
|
+
if (a.off) {
|
|
67
|
+
unsubs.push(() => {
|
|
68
|
+
a.off("open", onOpen);
|
|
69
|
+
a.off("close", onClose);
|
|
70
|
+
a.off("status", onStatus);
|
|
71
|
+
a.off("error", onError);
|
|
72
|
+
a.off("message", onMessage);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async function instantiate(openNow = false) {
|
|
77
|
+
destroyAPI();
|
|
78
|
+
const opts = { type: props.type, ...props.config, video: videoRef.value };
|
|
79
|
+
api = jsStreaming.createStream(opts);
|
|
80
|
+
bindAPI(api);
|
|
81
|
+
if (openNow) await api.open();
|
|
82
|
+
}
|
|
83
|
+
expose({
|
|
84
|
+
open: instantiate,
|
|
85
|
+
close: () => api?.close(),
|
|
86
|
+
send: (d) => api?.send?.(d)
|
|
87
|
+
});
|
|
88
|
+
vue.onMounted(() => props.autoOpen && instantiate(true));
|
|
89
|
+
vue.onBeforeUnmount(destroyAPI);
|
|
90
|
+
vue.watch(
|
|
91
|
+
() => [props.type, props.config],
|
|
92
|
+
() => {
|
|
93
|
+
props.autoOpen ? instantiate(true) : destroyAPI();
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
return () => props.type === "hls" || props.type === "webrtc" ? vue.h("video", {
|
|
97
|
+
ref: videoRef,
|
|
98
|
+
autoplay: props.autoplay,
|
|
99
|
+
controls: props.controls
|
|
100
|
+
}) : vue.h(
|
|
101
|
+
"div",
|
|
102
|
+
{},
|
|
103
|
+
messages.value.map(
|
|
104
|
+
(m, i) => vue.h("div", { key: i }, JSON.stringify(m))
|
|
105
|
+
)
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
exports.StreamPlayer = StreamPlayer_default;
|
|
111
|
+
exports.StreamingPlayer = StreamPlayer_default;
|
|
3
112
|
//# sourceMappingURL=index.cjs.map
|
|
4
113
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
|
1
|
+
{"version":3,"sources":["../src/components/StreamPlayer.ts"],"names":["defineComponent","ref","shallowRef","createStream","onMounted","onBeforeUnmount","watch","h"],"mappings":";;;;;;AAcA,IAAO,uBAAQA,mBAAA,CAAgB;AAAA,EAC7B,IAAA,EAAM,cAAA;AAAA,EACN,KAAA,EAAO;AAAA,IACL,IAAA,EAAM,EAAE,IAAA,EAAM,MAAA,EAAgC,UAAU,IAAA,EAAK;AAAA,IAC7D,MAAA,EAAQ,EAAE,IAAA,EAAM,MAAA,EAAyC,UAAU,IAAA,EAAK;AAAA,IACxE,QAAA,EAAU,EAAE,IAAA,EAAM,OAAA,EAAS,SAAS,KAAA,EAAM;AAAA,IAC1C,QAAA,EAAU,EAAE,IAAA,E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AY,IAAI,CAAA,GAAI,UAAA,EAAW;AAAA,MAClD;AAAA,KACF;AAEA,IAAA,OAAO,MACL,MAAM,IAAA,KAAS,KAAA,IAAS,MAAM,IAAA,KAAS,QAAA,GACnCC,MAAE,OAAA,EAAS;AAAA,MACT,GAAA,EAAK,QAAA;AAAA,MACL,UAAU,KAAA,CAAM,QAAA;AAAA,MAChB,UAAU,KAAA,CAAM;AAAA,KACjB,CAAA,GACDA,KAAA;AAAA,MACE,KAAA;AAAA,MACA,EAAC;AAAA,MACD,SAAS,KAAA,CAAM,GAAA;AAAA,QAAI,CAAC,CAAA,EAAG,CAAA,KACrBA,KAAA,CAAE,KAAA,EAAO,EAAE,GAAA,EAAK,CAAA,EAAE,EAAG,IAAA,CAAK,SAAA,CAAU,CAAC,CAAC;AAAA;AACxC,KACF;AAAA,EACR;AACF,CAAC","file":"index.cjs","sourcesContent":["import {\r\n defineComponent,\r\n h,\r\n ref,\r\n shallowRef,\r\n watch,\r\n onMounted,\r\n onBeforeUnmount,\r\n type PropType,\r\n} from \"vue\";\r\n\r\nimport { createStream, type StreamAPI } from \"js-streaming\";\r\nimport type { StreamStatus, StreamType } from \"../types\";\r\n\r\nexport default defineComponent({\r\n name: \"StreamPlayer\",\r\n props: {\r\n type: { type: String as PropType<StreamType>, required: true },\r\n config: { type: Object as PropType<Record<string, any>>, required: true },\r\n autoOpen: { type: Boolean, default: false },\r\n autoplay: { type: Boolean, default: false },\r\n controls: { type: Boolean, default: true },\r\n playsInline: { type: Boolean, default: true },\r\n muted: { type: Boolean, default: false },\r\n logLimit: { type: Number, default: 500 },\r\n },\r\n emits: [\"open\", \"close\", \"status\", \"error\", \"message\"],\r\n setup(props, { emit, expose }) {\r\n const status = ref<StreamStatus>(\"idle\");\r\n const isOpen = ref(false);\r\n const error = ref<Error | null>(null);\r\n const messages = shallowRef<unknown[]>([]);\r\n const videoRef = ref<HTMLVideoElement | null>(null);\r\n\r\n let api: StreamAPI | null = null;\r\n let unsubs: Array<() => void> = [];\r\n\r\n function destroyAPI() {\r\n try {\r\n api?.close();\r\n } catch {}\r\n for (const off of unsubs) off();\r\n unsubs = [];\r\n api = null;\r\n isOpen.value = false;\r\n }\r\n\r\n function bindAPI(a: StreamAPI) {\r\n const onOpen = () => {\r\n isOpen.value = true;\r\n emit(\"open\");\r\n };\r\n const onClose = () => {\r\n isOpen.value = false;\r\n emit(\"close\");\r\n };\r\n const onStatus = (s: StreamStatus) => {\r\n status.value = s;\r\n emit(\"status\", s);\r\n };\r\n const onError = (e: Error) => {\r\n error.value = e;\r\n emit(\"error\", e);\r\n };\r\n const onMessage = (m: unknown) => {\r\n const next = messages.value.slice();\r\n next.push(m);\r\n messages.value = next.slice(-props.logLimit);\r\n emit(\"message\", m);\r\n };\r\n\r\n unsubs.push(a.on(\"open\", onOpen));\r\n unsubs.push(a.on(\"close\", onClose));\r\n unsubs.push(a.on(\"status\", onStatus));\r\n unsubs.push(a.on(\"error\", onError));\r\n unsubs.push(a.on(\"message\", onMessage));\r\n\r\n if ((a as any).off) {\r\n unsubs.push(() => {\r\n (a as any).off(\"open\", onOpen);\r\n (a as any).off(\"close\", onClose);\r\n (a as any).off(\"status\", onStatus);\r\n (a as any).off(\"error\", onError);\r\n (a as any).off(\"message\", onMessage);\r\n });\r\n }\r\n }\r\n\r\n async function instantiate(openNow = false) {\r\n destroyAPI();\r\n const opts = { type: props.type, ...props.config, video: videoRef.value };\r\n api = createStream(opts) as StreamAPI;\r\n bindAPI(api);\r\n if (openNow) await api.open();\r\n }\r\n\r\n expose({\r\n open: instantiate,\r\n close: () => api?.close(),\r\n send: (d: any) => api?.send?.(d),\r\n });\r\n\r\n onMounted(() => props.autoOpen && instantiate(true));\r\n onBeforeUnmount(destroyAPI);\r\n\r\n watch(\r\n () => [props.type, props.config],\r\n () => {\r\n props.autoOpen ? instantiate(true) : destroyAPI();\r\n }\r\n );\r\n\r\n return () =>\r\n props.type === \"hls\" || props.type === \"webrtc\"\r\n ? h(\"video\", {\r\n ref: videoRef,\r\n autoplay: props.autoplay,\r\n controls: props.controls,\r\n })\r\n : h(\r\n \"div\",\r\n {},\r\n messages.value.map((m, i) =>\r\n h(\"div\", { key: i }, JSON.stringify(m))\r\n )\r\n );\r\n },\r\n});\r\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { PropType } from 'vue';
|
|
3
|
+
|
|
1
4
|
type StreamType = "websocket" | "sse" | "http" | "long-polling" | "hls" | "webrtc" | "socketio";
|
|
2
5
|
type StreamStatus = "idle" | "connecting" | "open" | "closing" | "closed" | "error";
|
|
3
6
|
type AnyConfig = Record<string, unknown>;
|
|
@@ -46,4 +49,87 @@ interface StreamAPI {
|
|
|
46
49
|
readonly state: Readonly<StreamState>;
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
|
|
52
|
+
declare const _default: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
53
|
+
type: {
|
|
54
|
+
type: PropType<StreamType>;
|
|
55
|
+
required: true;
|
|
56
|
+
};
|
|
57
|
+
config: {
|
|
58
|
+
type: PropType<Record<string, any>>;
|
|
59
|
+
required: true;
|
|
60
|
+
};
|
|
61
|
+
autoOpen: {
|
|
62
|
+
type: BooleanConstructor;
|
|
63
|
+
default: boolean;
|
|
64
|
+
};
|
|
65
|
+
autoplay: {
|
|
66
|
+
type: BooleanConstructor;
|
|
67
|
+
default: boolean;
|
|
68
|
+
};
|
|
69
|
+
controls: {
|
|
70
|
+
type: BooleanConstructor;
|
|
71
|
+
default: boolean;
|
|
72
|
+
};
|
|
73
|
+
playsInline: {
|
|
74
|
+
type: BooleanConstructor;
|
|
75
|
+
default: boolean;
|
|
76
|
+
};
|
|
77
|
+
muted: {
|
|
78
|
+
type: BooleanConstructor;
|
|
79
|
+
default: boolean;
|
|
80
|
+
};
|
|
81
|
+
logLimit: {
|
|
82
|
+
type: NumberConstructor;
|
|
83
|
+
default: number;
|
|
84
|
+
};
|
|
85
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
86
|
+
[key: string]: any;
|
|
87
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("open" | "error" | "close" | "message" | "status")[], "open" | "error" | "close" | "message" | "status", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
88
|
+
type: {
|
|
89
|
+
type: PropType<StreamType>;
|
|
90
|
+
required: true;
|
|
91
|
+
};
|
|
92
|
+
config: {
|
|
93
|
+
type: PropType<Record<string, any>>;
|
|
94
|
+
required: true;
|
|
95
|
+
};
|
|
96
|
+
autoOpen: {
|
|
97
|
+
type: BooleanConstructor;
|
|
98
|
+
default: boolean;
|
|
99
|
+
};
|
|
100
|
+
autoplay: {
|
|
101
|
+
type: BooleanConstructor;
|
|
102
|
+
default: boolean;
|
|
103
|
+
};
|
|
104
|
+
controls: {
|
|
105
|
+
type: BooleanConstructor;
|
|
106
|
+
default: boolean;
|
|
107
|
+
};
|
|
108
|
+
playsInline: {
|
|
109
|
+
type: BooleanConstructor;
|
|
110
|
+
default: boolean;
|
|
111
|
+
};
|
|
112
|
+
muted: {
|
|
113
|
+
type: BooleanConstructor;
|
|
114
|
+
default: boolean;
|
|
115
|
+
};
|
|
116
|
+
logLimit: {
|
|
117
|
+
type: NumberConstructor;
|
|
118
|
+
default: number;
|
|
119
|
+
};
|
|
120
|
+
}>> & Readonly<{
|
|
121
|
+
onOpen?: ((...args: any[]) => any) | undefined;
|
|
122
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
123
|
+
onClose?: ((...args: any[]) => any) | undefined;
|
|
124
|
+
onMessage?: ((...args: any[]) => any) | undefined;
|
|
125
|
+
onStatus?: ((...args: any[]) => any) | undefined;
|
|
126
|
+
}>, {
|
|
127
|
+
autoOpen: boolean;
|
|
128
|
+
autoplay: boolean;
|
|
129
|
+
controls: boolean;
|
|
130
|
+
playsInline: boolean;
|
|
131
|
+
muted: boolean;
|
|
132
|
+
logLimit: number;
|
|
133
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
134
|
+
|
|
135
|
+
export { type AnyConfig, type BaseOptions, type HLSConfig, type ListenerMap, type Message, type StreamAPI, type StreamAdapter, _default as StreamPlayer, type StreamState, type StreamStatus, type StreamType, _default as StreamingPlayer, type WebRTCConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { PropType } from 'vue';
|
|
3
|
+
|
|
1
4
|
type StreamType = "websocket" | "sse" | "http" | "long-polling" | "hls" | "webrtc" | "socketio";
|
|
2
5
|
type StreamStatus = "idle" | "connecting" | "open" | "closing" | "closed" | "error";
|
|
3
6
|
type AnyConfig = Record<string, unknown>;
|
|
@@ -46,4 +49,87 @@ interface StreamAPI {
|
|
|
46
49
|
readonly state: Readonly<StreamState>;
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
|
|
52
|
+
declare const _default: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
53
|
+
type: {
|
|
54
|
+
type: PropType<StreamType>;
|
|
55
|
+
required: true;
|
|
56
|
+
};
|
|
57
|
+
config: {
|
|
58
|
+
type: PropType<Record<string, any>>;
|
|
59
|
+
required: true;
|
|
60
|
+
};
|
|
61
|
+
autoOpen: {
|
|
62
|
+
type: BooleanConstructor;
|
|
63
|
+
default: boolean;
|
|
64
|
+
};
|
|
65
|
+
autoplay: {
|
|
66
|
+
type: BooleanConstructor;
|
|
67
|
+
default: boolean;
|
|
68
|
+
};
|
|
69
|
+
controls: {
|
|
70
|
+
type: BooleanConstructor;
|
|
71
|
+
default: boolean;
|
|
72
|
+
};
|
|
73
|
+
playsInline: {
|
|
74
|
+
type: BooleanConstructor;
|
|
75
|
+
default: boolean;
|
|
76
|
+
};
|
|
77
|
+
muted: {
|
|
78
|
+
type: BooleanConstructor;
|
|
79
|
+
default: boolean;
|
|
80
|
+
};
|
|
81
|
+
logLimit: {
|
|
82
|
+
type: NumberConstructor;
|
|
83
|
+
default: number;
|
|
84
|
+
};
|
|
85
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
86
|
+
[key: string]: any;
|
|
87
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("open" | "error" | "close" | "message" | "status")[], "open" | "error" | "close" | "message" | "status", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
88
|
+
type: {
|
|
89
|
+
type: PropType<StreamType>;
|
|
90
|
+
required: true;
|
|
91
|
+
};
|
|
92
|
+
config: {
|
|
93
|
+
type: PropType<Record<string, any>>;
|
|
94
|
+
required: true;
|
|
95
|
+
};
|
|
96
|
+
autoOpen: {
|
|
97
|
+
type: BooleanConstructor;
|
|
98
|
+
default: boolean;
|
|
99
|
+
};
|
|
100
|
+
autoplay: {
|
|
101
|
+
type: BooleanConstructor;
|
|
102
|
+
default: boolean;
|
|
103
|
+
};
|
|
104
|
+
controls: {
|
|
105
|
+
type: BooleanConstructor;
|
|
106
|
+
default: boolean;
|
|
107
|
+
};
|
|
108
|
+
playsInline: {
|
|
109
|
+
type: BooleanConstructor;
|
|
110
|
+
default: boolean;
|
|
111
|
+
};
|
|
112
|
+
muted: {
|
|
113
|
+
type: BooleanConstructor;
|
|
114
|
+
default: boolean;
|
|
115
|
+
};
|
|
116
|
+
logLimit: {
|
|
117
|
+
type: NumberConstructor;
|
|
118
|
+
default: number;
|
|
119
|
+
};
|
|
120
|
+
}>> & Readonly<{
|
|
121
|
+
onOpen?: ((...args: any[]) => any) | undefined;
|
|
122
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
123
|
+
onClose?: ((...args: any[]) => any) | undefined;
|
|
124
|
+
onMessage?: ((...args: any[]) => any) | undefined;
|
|
125
|
+
onStatus?: ((...args: any[]) => any) | undefined;
|
|
126
|
+
}>, {
|
|
127
|
+
autoOpen: boolean;
|
|
128
|
+
autoplay: boolean;
|
|
129
|
+
controls: boolean;
|
|
130
|
+
playsInline: boolean;
|
|
131
|
+
muted: boolean;
|
|
132
|
+
logLimit: number;
|
|
133
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
134
|
+
|
|
135
|
+
export { type AnyConfig, type BaseOptions, type HLSConfig, type ListenerMap, type Message, type StreamAPI, type StreamAdapter, _default as StreamPlayer, type StreamState, type StreamStatus, type StreamType, _default as StreamingPlayer, type WebRTCConfig };
|