Move http media server to separate class

This commit is contained in:
hensm
2019-05-01 23:20:39 +01:00
committed by Matt Hensman
parent fc1dd28254
commit b44056a255
7 changed files with 104 additions and 54 deletions

View File

@@ -18,7 +18,7 @@ const mediaElement = browser.menus.getTargetElement(targetElementId);
window.addEventListener("beforeunload", () => {
browser.runtime.sendMessage({
subject: "bridge:/stopHttpServer"
subject: "bridge:/mediaServer/stop"
});
if (options.mediaStopOnUnload) {
@@ -58,7 +58,7 @@ async function onRequestSessionSuccess (session_) {
if (isLocalFile) {
await new Promise((resolve, reject) => {
browser.runtime.sendMessage({
subject: "bridge:/startHttpServer"
subject: "bridge:/mediaServer/start"
, data: {
filePath: decodeURI(mediaUrl.pathname)
, port
@@ -66,7 +66,7 @@ async function onRequestSessionSuccess (session_) {
});
browser.runtime.onMessage.addListener(function onMessage (message) {
if (message.subject === "mediaCast:/httpServerStarted") {
if (message.subject === "mediaCast:/mediaServer/started") {
browser.runtime.onMessage.removeListener(onMessage);
resolve();
}