我想咨询一下,我能把准备就绪的videoStream推送到服务器吗? #464
yaomoshen520
started this conversation in
Ideas
Replies: 1 comment 4 replies
-
Interesting usage. You can serialize the For example, you can do this: + // Say you already has a WebSocket connected
+ const ws: WebSocket = new WebSocket('ws://localhost:8080');
+
client.videoStream
.pipeThrough(new InspectStream(action((packet: ScrcpyVideoStreamPacket) => {
if (packet.type === 'configuration') {
@@ -832,10 +835,18 @@ class ScrcpyPageState {
this.width = croppedWidth;
this.height = croppedHeight;
+
+ ws.send(JSON.stringify(packet));
+ } else {
+ ws.send(JSON.stringify({ ...packet, data: undefined }));
+ ws.send(packet.data);
}
})))
.pipeTo(decoder.writable)
- .catch(() => { });
+ .catch(() => { })
+ .finally(() => {
+ ws.close();
+ }); |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
问题是这样的,在创建完成client实例后,我是否可以通过 client.videoStream这个方法把流通过WebSockets,把这个流推送到服务器,进行远程控制和现实呢?如果可以应该是怎么推送,
Beta Was this translation helpful? Give feedback.
All reactions