Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Combinando y grabando ⏺ video 🎥 y audio 🎙 en el...
Search
Lupo Montero
February 28, 2019
Programming
40
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
More Decks by Lupo Montero
See All by Lupo Montero
Trigonometría Bella
lupomontero
0
47
Analizadores sintácticos funcionales en JavaScript
lupomontero
0
110
Manejo de memoria en Rust: Ownership
lupomontero
0
49
Hola Rust! Aprendiendo con rustlings
lupomontero
1
340
WebThing: construyamos una lámpara 💡
lupomontero
1
99
Reduzco, reuso y reciclo
lupomontero
0
45
Web Assembly, Rust y el futuro de JavaScript
lupomontero
0
64
Primeros pasos con Rust y WebAssembly
lupomontero
0
560
Paralelizando promesas
lupomontero
0
370
Other Decks in Programming
See All in Programming
AWS DevOps AgentのAzure接続機能を検証して見えた活用法/Use Cases Verified for the AWS DevOps Agent's Azure Connectivity Feature
masakiokuda
1
260
変わらないものが、変わるものを決める — 意図駆動開発 × イベントソーシング × イミュータブル | What Doesn't Change Decides What Can — IDD × Event Sourcing × Immutability
tomohisa
0
1.8k
jsmini JavaScript Engine を作ってみた話
yosuke_furukawa
PRO
0
350
言葉の格闘技のススメ~紙とペンと言葉から始める、キャリアの描き方~
progresscicada
2
170
VibeCodingからAgenticWorkflowへ
starfish719
0
730
What's New in Android 2026
veronikapj
0
270
リアルな遅延を測る仕様
kota_yata
1
120
Dockerfile CMD for Node.js
grazie1999
0
110
メールのエイリアス機能を履き違えない
isshinfunada
0
250
20260722_microCMSで考える、AI時代のコンテンツ運用設計
yosh1
0
450
いまどきの Codex で開発する visionOS アプリの開発スタイルについて
karad
0
150
AIと壁打ちしながら進めるコスト管理
fufuhu
1
1.3k
Featured
See All Featured
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
390
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
420
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
210
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
280
What's in a price? How to price your products and services
michaelherold
247
13k
Everyday Curiosity
cassininazir
0
290
RailsConf 2023
tenderlove
30
1.5k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
350
Building a Scalable Design System with Sketch
lauravandoore
463
34k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Transcript
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!!!