Software Archive
Read-only legacy content
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
17065 Discussions

How to create video chat app (video streaming) using WebRTC concept in intel XDK

Anjali_P_
Beginner
98 Views

Hii..

I want to create a video chat app using WebRTC concept in intel XDK. I have done sample of video streaming. I have created two buttons : One button will take the video and other will paused the video. This sample works well in the emulator but neither testing nor after building the app. Please help me as soon as possible.

The following is the code : 

JAVASCRIPT CODE :

main.js

function playVideo()
{
    var media = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || null;
    var video_audio_properties = {video: true, audio: true};
    if(media !== null)
          media(video_audio_properties, onSuccess, onError);
    else
        alert("not supported");
    function onSuccess(stream)
    {
        document.getElementById("videoID").src = window.URL.createObjectURL(stream);
        document.getElementById("videoID").play();
    }
    function onError(error)
    {
        console.log("Video capture error: ", error.code);
    }
}
function pauseVideo()
{
    document.getElementById("videoID").pause();

HTML CODE :

<!DOCTYPE html>
<html>
<head>
    <title>Blank Cordova Mobile App Project Template (Lite)</title>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <style>
        @-ms-viewport { width: 100vw ; zoom: 100% ; }  @viewport { width: 100vw ; zoom: 100% ; }
        @-ms-viewport { user-zoom: fixed ; }           @viewport { user-zoom: fixed ; }
    </style>
    <script src="cordova.js"></script>         
    <script src="js/app.js"></script>          
    <script src="xdk/init-dev.js"></script>     
    <script src="js/main.js"></script>
</head>
<body>
    <div>
        <video id = "videoID" style="height:200px; width:200px; border : solid 1px aqua;"></video>
    </div><br>
    <button id="btn1" onclick = "playVideo();">Play Video</button>
    <button id="btn2" onclick = "pauseVideo();">Pause Video</button>
</body>
</html>

 

0 Kudos
2 Replies
Anusha_M_Intel1
Employee
98 Views

We have a WebRTC chat sample app you can check out. It ships with the XDK and is called 'WebRTCSDK Video Chat Sample'. 

Or here is the git repo: https://github.com/gomobile/sample-webrtc-chat

Arif_B_
Beginner
98 Views

Hi,

I have built the webRTC sample app, however once I am logged in with my Yahoo account it is asking for a Connectto Friend ID, how should I create the IDs?

Pls assist

Arif

Reply