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
|
@ -214,12 +214,20 @@ function mistembed(streamname) {
|
|||
|
||||
if(video.error) {
|
||||
// there was an error; display it
|
||||
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)) {
|
||||
// no stream sources
|
||||
if (video.on_error){
|
||||
container.innerHTML = video.on_error;
|
||||
}else{
|
||||
container.innerHTML = '<strong>Error: no protocols found</strong>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
// no error, and sources found. Check the video types and output the best
|
||||
// available video player.
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue