ChatRoom no video

djuka

Member
Hello, I tried VideoChat code from client2 on my local environment and I can't get video in the application. Connection is established but no local video in the frame.
Then I used your demo.flashphoner.com and section VideoChat to try my server and I found that does not work even on your demo page. I think my WCS server is not configured for VideoChat.
Can you help me and explain are there some additional configurations for video Chat on server?
Just to notice, all Rest methods are available for the roomChatApp.
 

Max

Administrator
Staff member
Hello

How did you test video chat sample?

webrtc-video-chat-demo-page-two-users.png


This is how we test video chat and how it works step by step:

0. Open page

1. Enter unique nickname "123"
2. Click "Join"
3. Copy invite link
4. Open your invite link in new browser tab or page
5. Enter unique nickname "555"
6. Click "Join"
7. See two way video chat from user 123
8. See two way video chat from user 555

Chrome 94, Windows 10

See also video instructions on our website:
 

djuka

Member
1) I click Join button
2) ESTABLISHED writes for status but Join button not goes to Leave
3) Both video windows, local (small) and remote (big) are empty
4) Message boxes displays NONE
5) Publish button is disabled

I think WCS server is not configured for chat. Just to mention Stream recording works.
 

djuka

Member
Hi Max, thank you for your support. I didn't found what was the problem and it was sure some issue with the server. I did reinstall the server application and now it works as expected.
 

Max

Administrator
Staff member
Pleas note: if you are using custom backend replacing default RoomApp
1633481610117.png

your custom application must forward all the queries to the standard http://wcs:8081/apps/RoomApp and must return all the responses from it to client. For example:
PHP:
$api_method = array_pop(explode("/", $_SERVER['REQUEST_URI']));
$body = file_get_contents('php://input');
$incoming_data = json_decode($body, true);
$response_data = json_decode("{}");

error_log($api_method);
//process method
switch($api_method) {
    case"connect":
        ...
        // 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();
}
Maybe that was the problem.
 
Top