Created
May 27, 2012 02:11
-
-
Save tiye/2795955 to your computer and use it in GitHub Desktop.
getUserMedia 捕获摄像头
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body | |
| background hsl(240,90%,90%) | |
| video | |
| background hsl(10,90%,90%) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 这个例子在本地运行需要开启 webRTC 支持以及启用 --allow-file-access-from-files 参数 | |
| window.onload = -> | |
| video = document.getElementById "live" | |
| onSuccess = (stream) -> | |
| video.src = webkitURL.createObjectURL stream | |
| console.log 'success' | |
| onFail = (err) -> | |
| console.log "Unable to get video stream!" | |
| navigator.webkitGetUserMedia {video: true, audio: true}, | |
| onSuccess, onFail | |
| @ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| html | |
| head | |
| title webrtc | |
| link(rel='stylesheet',href='color.css') | |
| script(src='handle.js') | |
| body | |
| video(id='live',autoplay) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment