Wireclub
Home
Chat Rooms
Forums
Find People
Places
Search
Join Now!
Log In
Home
Chat Rooms
Forums
Find People
Places
Add as Friend
Private Chat
Send a Message
Give a Badge
Send a Card
Friends
Show All 120 Friends
home15
Offline
35
•
Male
•
from
Zbarazh
•
142
Feed
About
Pictures
Friends
Following
programmergirl220
: When I replace:
video.src = webkitURL.createObjectURL(stream);
with
video.srcObject = webkitURL.MediaStream;
I get no errors in the console. createObjectURL has been deprecated and replaced with MediaStream.
3 years ago
•
Reply
•
Report
•
Link
Collapse
Show Comments (7)
0
home15
: wow thank you very much
3 years ago
•
Reply
•
Report
1
programmergirl220
in reply to
home15
: Does Start button become deactivated when you click it?
3 years ago
•
Reply
•
Report
0
home15
: still doesn't work in the last firefox for win xp, however downloaded chat from github works
3 years ago
•
Reply
•
Report
0
home15
: __ https://github.com/webrtc/samples
3 years ago
•
Reply
•
Report
0
programmergirl220
: Excellent! I'm sure you've got this but give me a shout if you come across anything else, I may be able to help.
3 years ago
•
Reply
•
Report
0
home15
:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base target="_blank">
<title>getUserMedia</title>
</head>
<body>
<div id="container">
<video id="gum-local" autoplay playsinline></video>
<button id="showVideo">Open camera</button>
</div>
<script>
const constraints = window.constraints = {
audio: false,
video: true
};
function handleSuccess(stream) {
const video = document.querySelector('video'
;
const videoTracks = stream.getVideoTracks();
console.log('Got stream with constraints:', constraints);
console.log(`Using video device: ${videoTracks[0].label}`);
window.stream = stream; // make variable available to browser console
video.srcObject = stream;
}
async function init(e) {
try {
const stream = await navigator.mediaDevices.getUserMedia(constraints);
handleSuccess(stream);
e.target.disabled = true;
} catch (e) {
handleError(e);
}
}
document.querySelector('#showVideo'
.addEventListener('click', e => init(e));
</script>
</body>
</html>
3 years ago
•
Reply
•
Report
0
home15
: here working code, it differs much from initial code?
3 years ago
•
Reply
•
Report
0
video.src = webkitURL.createObjectURL(stream);
with
video.srcObject = webkitURL.MediaStream;
I get no errors in the console. createObjectURL has been deprecated and replaced with MediaStream.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base target="_blank">
<title>getUserMedia</title>
</head>
<body>
<div id="container">
<video id="gum-local" autoplay playsinline></video>
<button id="showVideo">Open camera</button>
</div>
<script>
const constraints = window.constraints = {
audio: false,
video: true
};
function handleSuccess(stream) {
const video = document.querySelector('video';
const videoTracks = stream.getVideoTracks();
console.log('Got stream with constraints:', constraints);
console.log(`Using video device: ${videoTracks[0].label}`);
window.stream = stream; // make variable available to browser console
video.srcObject = stream;
}
async function init(e) {
try {
const stream = await navigator.mediaDevices.getUserMedia(constraints);
handleSuccess(stream);
e.target.disabled = true;
} catch (e) {
handleError(e);
}
}
document.querySelector('#showVideo'.addEventListener('click', e => init(e));
</script>
</body>
</html>