On Conference input camera and mic switching and output audio switching

sandeep

New Member
Hi,

For conference we are using canvas media stream, Once conference started we want to give the option to our user to switch input camera / mic and output audio device switching feature.
Is there any way to switch the media device on conference canvas streaming.

Regards,
Sandeep
 

sandeep

New Member
Hi Max,

In conference is there any way to block the particular participant, for preventing the rejoin the conference.

Regards,
Sandeep
 

Max

Administrator
Staff member
In conference is there any way to block the particular participant, for preventing the rejoin the conference.
You can use REST hook /connect. See the example of REST hook backend script in this post. You may restrict user by login like this;
Code:
$body = file_get_contents('php://input');
$incoming_data = json_decode($body, true);

switch($api_method) {
    case"connect":
        // Check user login
        if ($incoming_data['custom']['login'] == "bad_user") {
            ubnormalResponse(403);
        }
        // POST /connect query to WCS default RoomApp
        $response_data = json_decode(postToRoomApp($api_method, $body), true);
    break;
    default:
        // POST any query to WCS default RoomApp
        $response_data = json_decode(postToRoomApp($api_method, $body), true);
    break;
}
header('HTTP/1.1 200 OK', true, 200);
header('Content-Type: application/json');
echo json_encode($response_data);

// Passing query to WCS default RoomApp
function postToRoomApp($method, $data_string) {
    // Here should be your WSC RoomApp address
    $wcs_url="http://wcs:8081/apps/RoomApp/" . $method;

    $response="";
    if( $curl = curl_init() ) {
        curl_setopt($curl, CURLOPT_URL, $wcs_url);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
        curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);
        curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json',                                                                           
                               'Content-Length: ' . strlen($data_string)));  
        $response = curl_exec($curl);
        $http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
        if($http_code != 200) {
            ubnormalResponse($http_code);
        }
        error_log($response);
        curl_close($curl);
    }
    return($response);
}

function ubnormalResponse($code) {
    if ($code == 403) {
        header('HTTP/1.1 403 Forbidden', true, $code);
    } else {
        header(':', true, $code);
    }
    die();
}
 
Top