diff --git a/src/embed.js b/src/embed.js index 99b213dd..b162e5e5 100644 --- a/src/embed.js +++ b/src/embed.js @@ -214,11 +214,19 @@ function mistembed(streamname) { if(video.error) { // there was an error; display it - container.innerHTML = ['Error: ', video.error, ''].join(''); + if (video.on_error){ + container.innerHTML = video.on_error; + }else{ + container.innerHTML = ['Error: ', video.error, ''].join(''); + } } else if ((typeof video.source == 'undefined') || (video.source.length < 1)) { // no stream sources - container.innerHTML = 'Error: no protocols found'; + if (video.on_error){ + container.innerHTML = video.on_error; + }else{ + container.innerHTML = 'Error: no protocols found'; + } } else { // no error, and sources found. Check the video types and output the best diff --git a/src/output/output_http_internal.cpp b/src/output/output_http_internal.cpp index ad8ca03a..3632230d 100644 --- a/src/output/output_http_internal.cpp +++ b/src/output/output_http_internal.cpp @@ -50,6 +50,14 @@ namespace Mist { capa["url_match"].append("/json_$.js"); capa["url_match"].append("/embed_$.js"); cfg->addConnectorOptions(8080, capa); + /*LTS-START*/ + cfg->addOption("nostreamtext", JSON::fromString("{\"arg\":\"string\", \"default\":\"\", \"short\":\"t\",\"long\":\"nostreamtext\",\"help\":\"Text or HTML to display when streams are unavailable.\"}")); + capa["optional"]["nostreamtext"]["name"] = "Stream unavailable text"; + capa["optional"]["nostreamtext"]["help"] = "Text or HTML to display when streams are unavailable."; + capa["optional"]["nostreamtext"]["default"] = ""; + capa["optional"]["nostreamtext"]["type"] = "str"; + capa["optional"]["nostreamtext"]["option"] = "--nostreamtext"; + /*LTS-END*/ } /// Sorts the JSON::Value objects that hold source information by preference. @@ -260,6 +268,9 @@ namespace Mist { } response = "// Generating info code for stream " + streamName + "\n\nif (!mistvideo){var mistvideo = {};}\n"; JSON::Value json_resp; + if (config->getString("nostreamtext") != ""){ + json_resp["on_error"] = config->getString("nostreamtext"); + } IPC::semaphore configLock("!mistConfLock", O_CREAT | O_RDWR, ACCESSPERMS, 1); IPC::semaphore metaLocker(std::string("liveMeta@" + streamName).c_str(), O_CREAT | O_RDWR, ACCESSPERMS, 1); bool metaLock = false;