Feature Request - Mixer Caption & Voice Activity Color Picker

Hello Max,

We would like to request a feature:

Actually we know is possible to display stream name on mixer, but we use stream name as ID to identify the user.
Due some "special chars" we preffer do not use stream name as username.

We would like to add a CAPTION text for each stream on mixer.
Also, if is possible, select the font and color of font and background - caption padding also will be nice.

Another item, is to define voice activity color instead green.

Thanks!
 

Max

Administrator
Staff member
Good day, Rafael
Actually we know is possible to display stream name on mixer, but we use stream name as ID to identify the user.
Due some "special chars" we preffer do not use stream name as username.

We would like to add a CAPTION text for each stream on mixer.
You can use REST hook /publishStream to change a stream name right before it is added to mixer.
To do this, you should return the following restClientConfig object in response to /connect REST hook
JavaScript:
  "publishStream" :
  {
    "clientExclude" : "",
    "restExclude" : "",
    "restOnError" : "LOG",
    "restPolicy" : "OVERWRITE",
    "restOverwrite" : "name"
  }
Then, on /publishStream hook you can change stream name (and leave mixer name intouch). The following example just adds a random part to stream name
PHP:
switch($api_method) {
    ...
    case"publishStream":
        if(strpos($incoming_data['name'],"#") !== false) {
            list($user, $mixer) = explode("#",$incoming_data['name']);
            $incoming_data['name'] = $user . "_" . rand() . '#' . $mixer;
        }
    break;
}
header('HTTP/1.1 200 OK', true, 200);
header('Content-Type: application/json');
echo json_encode($incoming_data);
The full php script code
PHP:
<?php

$api_method = array_pop(explode("/", $_SERVER['REQUEST_URI']));
$incoming_data = json_decode(file_get_contents('php://input'), true);

//process method
switch($api_method) {
    case"connect":    
        $rest_client_config = json_decode(file_get_contents('rest_client_config.json'), true); 
        $incoming_data['restClientConfig'] = $rest_client_config;
    break;
    case"publishStream":
        if(strpos($incoming_data['name'],"#") !== false) {
            list($user, $mixer) = explode("#",$incoming_data['name']);
            $incoming_data['name'] = $user . "_" . rand() . '#' . $mixer;
        }
    break;
}
header('HTTP/1.1 200 OK', true, 200);
header('Content-Type: application/json');
echo json_encode($incoming_data);

function ubnormalResponse($code) {
    if ($code == 403) {
    header('HTTP/1.1 403 Forbidden', true, $code);
    } else {
    header(':', true, $code);
    }
    die();
}
?>
Also, if is possible, select the font and color of font and background - caption padding also will be nice.

Another item, is to define voice activity color instead green.
We raised the ticket WCS-2846 to implement those settings.
 
Thanks Max,

One question:

If we use hooks to change the stream name, will lost the original one?
In our case using the API, to add and remove users from MCU, we can still using the original streamname - vinculated to our database?
 

Max

Administrator
Staff member
If we use hooks to change the stream name, will lost the original one?
In our case using the API, to add and remove users from MCU, we can still using the original streamname - vinculated to our database?
When stream name is changed via REST hook, the stream will be published on server with new name.
The server itself does not remember the original name, so yuo should keep the pair {"original_name": "aaaabbbbccccdddd", "readable_name": "user1"} in your backend database to remember while the session is active.
 

Max

Administrator
Staff member
Good day.
Since build 5.2.741 caption text colour, backgroung colour and speech indicator frame colour can be changed with the following parameters
Code:
mixer_text_colour=0xFFFF00
mixer_text_background_colour=0x006666
mixer_voice_activity_colour=#FF0000
A colour can be set as hexadecimal value with # or 0x prefix, in #RRGGBB form. Using the settings above, yellow text will be displayed on cian background with red speech indicator frame:
1597746666935.png
 
Top