html5demos/demos/gum.html

41 lines
1.2 KiB
HTML
Raw Normal View History

2012-03-26 18:39:59 +02:00
<title>getUserMedia streamed to a video element</title>
2012-03-24 11:13:41 +01:00
<style>
2012-11-01 18:04:09 +01:00
audio, video {
2012-03-26 18:39:59 +02:00
max-width: 100%;
margin: 0;
}
2012-11-01 18:04:09 +01:00
.supported video,
.supported audio {
width: 100%;
2012-03-26 18:39:59 +02:00
/* I'm using CSS3 to translate the video on the X axis to give it a mirror effect */
2012-03-24 11:13:41 +01:00
-webkit-transform: rotateY(180deg) rotate3d(1, 0, 0, 0deg);
-o-transform: rotateY(180deg) rotate3d(1, 0, 0, 0deg);
-moz-transform: rotateY(180deg) rotate3d(1, 0, 0, 0deg);
-ms-transform: rotateY(180deg) rotate3d(1, 0, 0, 0deg);
transform: rotateY(180deg) rotate3d(1, 0, 0, 0deg);
2012-03-26 18:39:59 +02:00
}
#gum {
background: #c00;
color: #fff;
padding: 10px;
2012-03-24 11:13:41 +01:00
}
</style>
<article>
2012-03-26 18:39:59 +02:00
<video id="video" muted loop autoplay>
<source src="/assets/remy-and-ellis2.mp4"></source>
<source src="/assets/remy-and-ellis2.webm"></source>
</video>
<p id="gum">getUserMeda either not supported or not allowed - so instead here's me and my son headbanging.</p>
2012-03-24 11:13:41 +01:00
</article>
<script src="/js/gum.js"></script>
2012-03-24 11:13:41 +01:00
<script>
var article = video.parentNode,
2012-03-26 18:39:59 +02:00
gum = document.getElementById('gum');
2012-03-24 11:13:41 +01:00
if (navigator.getUserMedia) {
2012-03-26 18:39:59 +02:00
article.removeChild(gum);
article.className = 'supported';
}
</script>