LTS feature: Added support for setting/overriding the error text for failed streams.
This commit is contained in:
parent
8e3de119b8
commit
ac540cdd1d
2 changed files with 21 additions and 2 deletions
12
src/embed.js
12
src/embed.js
|
@ -214,11 +214,19 @@ function mistembed(streamname) {
|
||||||
|
|
||||||
if(video.error) {
|
if(video.error) {
|
||||||
// there was an error; display it
|
// there was an error; display it
|
||||||
container.innerHTML = ['<strong>Error: ', video.error, '</strong>'].join('');
|
if (video.on_error){
|
||||||
|
container.innerHTML = video.on_error;
|
||||||
|
}else{
|
||||||
|
container.innerHTML = ['<strong>Error: ', video.error, '</strong>'].join('');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ((typeof video.source == 'undefined') || (video.source.length < 1)) {
|
else if ((typeof video.source == 'undefined') || (video.source.length < 1)) {
|
||||||
// no stream sources
|
// no stream sources
|
||||||
container.innerHTML = '<strong>Error: no protocols found</strong>';
|
if (video.on_error){
|
||||||
|
container.innerHTML = video.on_error;
|
||||||
|
}else{
|
||||||
|
container.innerHTML = '<strong>Error: no protocols found</strong>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// no error, and sources found. Check the video types and output the best
|
// no error, and sources found. Check the video types and output the best
|
||||||
|
|
|
@ -50,6 +50,14 @@ namespace Mist {
|
||||||
capa["url_match"].append("/json_$.js");
|
capa["url_match"].append("/json_$.js");
|
||||||
capa["url_match"].append("/embed_$.js");
|
capa["url_match"].append("/embed_$.js");
|
||||||
cfg->addConnectorOptions(8080, capa);
|
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.
|
/// 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";
|
response = "// Generating info code for stream " + streamName + "\n\nif (!mistvideo){var mistvideo = {};}\n";
|
||||||
JSON::Value json_resp;
|
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 configLock("!mistConfLock", O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
||||||
IPC::semaphore metaLocker(std::string("liveMeta@" + streamName).c_str(), O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
IPC::semaphore metaLocker(std::string("liveMeta@" + streamName).c_str(), O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
||||||
bool metaLock = false;
|
bool metaLock = false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue