Note that there are some explanatory texts on larger screens.

plurals
  1. POAccessing two different web camera in HTML5 and jQuery
    primarykey
    data
    text
    <p>I want to make a simple web cam viewer using HTML5 and jQuery. I find some code for that,this is as under </p> <pre><code> &lt;script src="RecordRTC.js"&gt;&lt;/script&gt; div&gt; &lt;video id="client-video" autoplay loop controls muted&gt;&lt;/video&gt; &lt;button id="record-video"&gt;Record Video&lt;/button&gt; &lt;/div&gt; &lt;script&gt; var video = document.getElementById('client-video'); var videoConstraints = { audio: false, video: { mandatory: {}, optional: [] } }; var videoStream; &lt;/script&gt; &lt;script&gt; function getByID(id) { return document.getElementById(id); } var recordVideo = getByID('record-video'); var recorder; recordVideo.onclick = function () { if (!videoStream) navigator.webkitGetUserMedia(videoConstraints, function (stream) { video.src = window.webkitURL.createObjectURL(stream); videoStream = stream; recorder = RecordRTC({ video: video }); recorder.recordVideo(); }); else { video.src = window.webkitURL.createObjectURL(videoStream); recorder.recordVideo(); } window.isAudio = false; this.disabled = true; stopRecordingVideo.disabled = false; }; &lt;/script&gt; </code></pre> <h2>RecordRTC.js</h2> <pre><code>function RecordRTC(config) { var win = window, requestAnimationFrame = win.webkitRequestAnimationFrame || win.mozRequestAnimationFrame, cancelAnimationFrame = win.webkitCancelAnimationFrame || win.mozCancelAnimationFrame, URL = win.URL || win.webkitURL, canvas = document.createElement('canvas'), context = canvas.getContext('2d'), video = config.video; if (video) { video.width = canvas.width = 320; video.height = canvas.height = 240; } var requestedAnimationFrame, frames = []; function recordVideo() { if (!video) { alert('No video element found.'); return; } console.log('started recording video frames'); var height = canvas.height, width = canvas.width; frames = []; function drawVideoFrame() { requestedAnimationFrame = requestAnimationFrame(drawVideoFrame); context.drawImage(video, 0, 0, width, height); frames.push(canvas.toDataURL('image/webp', 1)); } requestedAnimationFrame = requestAnimationFrame(drawVideoFrame); } var blobURL, blobURL2, fileType; function setBlob(blob, callback) { blobURL = blob; var config = { blob: blobURL, type: fileType === 'webm' ? 'video/webm' : 'audio/wav', fileName: (Math.random() * 1000 &lt;&lt; 1000) + '.' + fileType, size: blobURL.length, onsuccess: function (fileEntry) { console.log(fileEntry); fileSystemURL = fileEntry.toURL(); if (callback) { callback(fileSystemURL); } }, onerror: function (errorMessage) { console.debug('Unabled to write temporary recorded file using FileWriter APIs.'); var url = writer.toURL(); if (url) { return window.open(url); } else { console.debug('Unabled to write temporary recorded file using FileWriter APIs.'); if (callback) callback(blobURL2); } } }; } return { recordVideo: recordVideo, getBlob: function () { return blobURL2; } }; } </code></pre> <p>This code properly working and display single web cam view but i want to display two web cam view in the same page how could i second web cam on my web page. i am new with HTML5 and JQuery . Please help me in this . Thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload