Feature: adds screen sharing
This commit is contained in:
@@ -53,6 +53,7 @@ export enum ServerEvent {
|
||||
FavoritesUpdate = "favorites_update",
|
||||
MetadataUpdate = "metadata_update",
|
||||
MPDUpdate = "mpd_update",
|
||||
ScreenShare = "screen_share",
|
||||
}
|
||||
|
||||
export const API = {
|
||||
@@ -90,6 +91,10 @@ export const API = {
|
||||
async play(): Promise<void> {
|
||||
await fetch('/api/play', { method: 'POST' });
|
||||
},
|
||||
|
||||
async stop(): Promise<void> {
|
||||
await fetch('/api/stop', { method: 'POST' });
|
||||
},
|
||||
|
||||
async pause(): Promise<void> {
|
||||
await fetch('/api/pause', { method: 'POST' });
|
||||
@@ -168,5 +173,11 @@ export const API = {
|
||||
},
|
||||
body: JSON.stringify({ title }),
|
||||
});
|
||||
},
|
||||
|
||||
startScreenShare(mimeType: string): WebSocket {
|
||||
const protocol = window.location.protocol === 'https:' ? 'wss' : 'ws';
|
||||
const ws = new WebSocket(`${protocol}://${window.location.host}/api/screenshare?mimeType=${mimeType}`);
|
||||
return ws;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user