Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Combinando y grabando ⏺ video 🎥 y audio 🎙 en el...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Lupo Montero
February 28, 2019
Programming
46
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Combinando y grabando ⏺ video 🎥 y audio 🎙 en el navegador
Mozilla Perú 28 Feb 2019
Lupo Montero
February 28, 2019
Transcript
14 slides
Combinando y grabando ⏺ video 🎥 y audio 🎙 en
el navegador @lupomontero - Mozilla Perú 28 Feb 2019
@Laboratoriala @LimaJSorg @NodeSchool @lupomontero @mozillaperu
WTF @!#$!! https://support.useloom.com/faqs-and-troubleshooting/general-faq/can-i-use-loo m-with-firefox-safari-etc
Estándares al rescate • MediaDevices • MediaStream • <video> •
<canvas> • Blob • ...
navigator.mediaDevices.getUserMedia navigator.mediaDevices.getUserMedia({ camera: { video: true }, }) .then((stream) =>
{ // `stream` is a `MediaStream` }) .catch(console.error);
MediaStream const track = stream.getVideoTracks()[0]; console.log(track.getSettings());
<video> const streamSettings = stream.getVideoTracks()[0].getSettings(); const video = document.createElement('video'); video.setAttribute('width',
streamSettings.width); video.setAttribute('height', streamSettings.height); video.srcObject = stream; video.play();
<canvas> const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); ctx.drawImage(
image, dx, dy, dWidth, dHeight, ); https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage
<canvas> const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); ctx.drawImage(
video, dx, dy, dWidth, dHeight, ); https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage
canvas.captureStream() const outputStream = new MediaStream(); const inputStreams = [audioStream,
canvas.captureStream()]; inputStreams.forEach( stream => stream.getTracks().forEach( track => outputStream.addTrack(track), ), );
window.requestAnimationFrame const update = () => { // redraw frame
... window.requestAnimationFrame(update); }; update();
MediaRecorder const recordedBlobs = []; const recorder = new MediaRecorder(outputStream,
{ mimeType: 'video/webm', }); recorder.addEventListener('dataavailable', (e) => { if (e.data && e.data.size > 0) { recordedBlobs.push(e.data); } }); recorder.start(1000);
Blob y window.URL recorder.stop(); const blob = new Blob(recordedBlobs, {
type: 'video/webm' }); const url = window.URL.createObjectURL(blob); const a = document.createElement('a'); a.style.display = 'none'; a.href = url; a.download = 'test.webm'; document.body.appendChild(a); a.click(); setTimeout(() => { document.body.removeChild(a); window.URL.revokeObjectURL(url); }, 100);
Demo time!!!
More Decks by Lupo Montero
See All by Lupo Montero
Trigonometría Bella
lupomontero
0
52
Analizadores sintácticos funcionales en JavaScript
lupomontero
0
110
Manejo de memoria en Rust: Ownership
lupomontero
0
56
Hola Rust! Aprendiendo con rustlings
lupomontero
1
350
WebThing: construyamos una lámpara 💡
lupomontero
1
110
Reduzco, reuso y reciclo
lupomontero
0
49
Web Assembly, Rust y el futuro de JavaScript
lupomontero
0
71
Primeros pasos con Rust y WebAssembly
lupomontero
0
560
Paralelizando promesas
lupomontero
0
380
Other Decks in Programming
See All in Programming
疎結合とは何か?ソフトウェア設計における結合バランスについて考える #phpcon_niigata
kajitack
2
420
imagewebp()の向こう側: WebPはなぜ JPEG・PNGより軽いのか
yuzneri
0
150
AI Augmentation Techniques with Liberty
ivargrimstad
1
570
Rails初心者がパスキーを実装してみて大変だったこと
ktombow
0
240
Claude Code ハーネスDeep Dive – 君はどこまで制御する? -
takateeen_knj
6
6.3k
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
360
作れるエンジニアから、価値を届けるエンジニアへ
ryunakayama
1
860
眠らない開発チームの作り方
biwakonbu
0
110
Goコンパイラを作ってGoをもっと理解する / Build a Go compiler to better understand Go
ikura_hamu
0
140
AI駆動TDD ― 2026年10月版
hrmstrsmgs
0
110
動画プレイヤーはなぜカクつくのか 〜Flutterのレンダリングとネイティブの境界を解剖する〜
naruogram
0
340
Skills Are the New npm [AAIF Bengaluru, Nov 2026]
shivamsaraswat
0
130
Featured
See All Featured
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.3k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
The Cost Of JavaScript in 2023
addyosmani
56
10k
KATA
mclloyd
PRO
35
16k
Paper Plane (Part 1)
katiecoart
PRO
3
12k
Being A Developer After 40
akosma
PRO
92
590k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
790
How to Ace a Technical Interview
jacobian
280
24k
The Pragmatic Product Professional
lauravandoore
37
7.5k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
1k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Speed Design
sergeychernyshev
33
2.3k