Created — forked from 140bytes/LICENSE.txt

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Photo Booth (140byt.es)

View LICENSE.txt
1 2 3 4 5 6 7 8 9 10 11 12 13
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
 
Copyright (C) 2012 Sindre Sorhus <http://sindresorhus.com>
 
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
 
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 
0. You just DO WHAT THE FUCK YOU WANT TO.
View LICENSE.txt

Photo Booth (140byt.es)

109 bytes

Currently requires Chrome Canary

Working prefixed version (121 bytes):

Just copy paste into Dev Tools in Chrome Canary and hit enter:

!function f(a){a?document.write('<video src='+webkitURL.createObjectURL(a)+'>'):navigator.webkitGetUserMedia({video:1},f)}()

screenshot

View LICENSE.txt
1 2 3 4 5
function f(a){
a?
document.write('<video src='+URL.createObjectURL(a)+'>'):
navigator.getUserMedia({video:1},f)
}
View LICENSE.txt
1
function f(a){a?document.write('<video src='+URL.createObjectURL(a)+'>'):navigator.getUserMedia({video:1},f)}
View LICENSE.txt
1 2 3 4 5 6 7 8 9 10 11 12
{
"name": "photoBooth",
"description": "Photo Booth with JS",
"keywords": [
"photo",
"camera",
"webcam",
"getusermedia",
"html",
"webrtc"
]
}
View LICENSE.txt
1 2 3
<script>
!function f(a){a?document.write('<video src='+webkitURL.createObjectURL(a)+'>'):navigator.webkitGetUserMedia({video:1},f)}()
</script>
atk commented

Great Scott! That's a fun idea and splendid use of the new usermedia-API.

Save some bytes:
function f(a){a?document.body.innerHTML='<video src='+webkitURL.createObjectURL(a)+'>':navigator.webkitGetUserMedia({video:1},f)}

Owner

@tsaniel amazing! I would never have thought of doing that :)

This effectively shrunk the unprefixed one down to 117 bytes and the prefixed one to 129 bytes.

aemkei commented

In this case there is no need to close the tag. Your browser will fix the invalid syntax:

Save 4 bytes:

function f(a){a?document.body.innerHTML='<video src='+webkitURL.createObjectURL(a):navigator.webkitGetUserMedia({video:1},f)}
Owner

@aemkei Didn't work

aemkei commented

Your right: My fault! Sorry!

aemkei commented

But how about document.write to get it down to 121 bytes?:

function f(a){a?document.write('<video src='+webkitURL.createObjectURL(a)+'>'):navigator.webkitGetUserMedia({video:1},f)}
Owner

@aemkei YES! :D

The original 140byte Photobooth: https://gist.github.com/2727513

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.