aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-client/src/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-client/src/main.js')
-rw-r--r--packages/meshbay-client/src/main.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/packages/meshbay-client/src/main.js b/packages/meshbay-client/src/main.js
index f201a21..122a302 100644
--- a/packages/meshbay-client/src/main.js
+++ b/packages/meshbay-client/src/main.js
@@ -1770,9 +1770,17 @@ function registerBridge() {
return castRelay.start({
codec: opts.codec,
initSegment: opts.initSegment ? Buffer.from(opts.initSegment) : null,
+ subtitle: opts.subtitle || null,
});
});
+ // Carried separately from `cast:start` for the viewer who turns subtitles on
+ // without seeking: the relay keeps serving the same video while the receiver
+ // is told to load again with the new track.
+ ipcMain.handle('cast:subtitle', async (_e, sub) => {
+ return castRelay.setSubtitle(sub || null);
+ });
+
ipcMain.handle('cast:push', async (_e, data) => {
castRelay.pushSegment(Buffer.from(data));
return true;
@@ -1791,6 +1799,7 @@ function registerBridge() {
ipcMain.handle('cast:status', async () => ({
active: castRelay.active,
url: castRelay.url,
+ subtitle: castRelay.subtitle,
chromecast: castChromecast.getStatus(),
}));
@@ -1800,12 +1809,14 @@ function registerBridge() {
return castChromecast.discover();
});
- ipcMain.handle('cast:chromecast:connect', async (_e, { deviceId, mediaUrl }) => {
- return castChromecast.connect(deviceId, mediaUrl);
+ ipcMain.handle('cast:chromecast:connect', async (_e, { deviceId, mediaUrl, subtitle }) => {
+ return castChromecast.connect(deviceId, mediaUrl,
+ subtitle === undefined ? castRelay.subtitle : subtitle);
});
- ipcMain.handle('cast:chromecast:reload', async (_e, { mediaUrl }) => {
- return castChromecast.reload(mediaUrl);
+ ipcMain.handle('cast:chromecast:reload', async (_e, { mediaUrl, subtitle }) => {
+ return castChromecast.reload(mediaUrl,
+ subtitle === undefined ? castRelay.subtitle : subtitle);
});
ipcMain.handle('cast:chromecast:disconnect', async () => {