SlideShare a Scribd company logo
1 of 16
Hosting Video
JavaScript Friends Meetup
June 30, 2021
Becky Peltz
Bio
Linked In: Rebecca Peltz
MBA University of Washington
Database Programming
Application Development
Web Engineering
Bootcamp & University Web Developer Certificate Instruction
Developer Instructional Designer @Cloudinary
Video Hosting: Why?
“if a picture is worth a thousand words, then a video has to be worth at least 1.8 million words” - Dr.
James McQuivey, Forester Study
1000/words per picture x 30 frames(pictures)/second x 60 seconds/minute = 1,800,000 pictures
_____________________________________________________________________________
______
“74% of marketers say video has a better return on investment than static imagery.”
Biteable.com Video Marketing Stats
_____________________________________________________________________________
______
“Globally, IP video will be 82% of all IP traffic in 2021, up from 73% in 2016”
Cisco 2021
Video Hosting
Terminology & Concepts
● Size and Duration
● Codecs, Containers and Browsers
● Advanced Bitrate Streaming (ABR)
Code
● Video Tag
● Video Embed Element
● Video Player
● React and Video
● Processing and delivery of ABR (Advanced Bitrate Streaming)
Video Hosting: File Size and Duration
file size (bytes) = bitrate (bytes per sec) * duration (sec) * compression ratio
bitrate (bytes per sec) = frame size * frames per second (fps)
frame size (bytes) = width (px) * height (px) * color depth (bytes)
● compression ratio depends on codec, h264 baseline is about 1000:1, so 1 GBS can
be compressed to 1 MBS
● frames per second can vary depending on how recorded, but 30 fps is common
● width and height make up the resolution as in an image
Video Hosting: Codecs, Containers and Browsers
Video Hosting: Code
Single Video Source https://replit.com/@rpeltz/VideoSingleSource
HTML5 Video Embed Element
https://replit.com/@rpeltz/HTML5VideoEmbedElement
Cloudinary JavaScript SDK Video Embed Element
Cloudinary Video Player https://replit.com/@rpeltz/CloudinaryVideoPlayer
Cloudinary React Component
https://codesandbox.io/s/cld-advanced-concepts-
training-video-player-6h3k3
Cloudinary React Video Player
Video Processing add HD Profile for ABR Backend https://replit.com/@rpeltz/ABR-hd-profile
Cloudinary Video Player with ABR Frontend https://replit.com/@rpeltz/ABRCloudinaryVideoPlayer
Code: .mov/h264 in Chrome
How do you expect an .mov/h264 file to behave in Chrome?
https://replit.com/@rpeltz/VideoSingleSource
Code: Video Tag Single Source
<video controls src="myvideo" width="300"></video>
<video controls poster="myposter" width="620">
<source src="myvideo" type="video/mp4">
Sorry,your browser doesn't support embedded videos.
</video>
https://replit.com/@rpeltz/VideoSingleSource#index.html
Code: HTML5 Video Embed Element and Cloudinary
JavaScript VideoTag
<video controls="" height="349" poster="myposterimage.jpg" width="620">
<source src="myvideo.webm" type="video/webm">
<source src="myvideo.mp4" type="video/mp4">
<source src="myvideo.ogv" type="video/ogg">
Your browser does not support HTML5 video tags.
</video>
https://replit.com/@rpeltz/HTML5VideoEmbedElement
Code: Cloudinary Video Player
// instantiate cloudinary to set config
const cloudinary = cloudinary.Cloudinary.new({ cloud_name:"cloudinary-training"});
// wait for the player id element to load
document.addEventListener("DOMContentLoaded",e=>{
const media = cloudinary.videoPlayer("player");
media.source("video-hosting/goats");
})
<video id="player" controls class="cld-video-player cld-fluid"></video>
HTML
JavaScript
https://replit.com/@rpeltz/CloudinaryVideoPlayer
Code: React
React SDK v Cloudinary Video Player
https://cloudinary.com/documentation/react_integration
https://codesandbox.io/s/cld-advanced-concepts-training-video-player-6h3k3
1. Libraries from npmjs.org
2. Create components for the Video Embed and the Player
3. Parameters are Cloudinary “cloudName” and “publicId”
4. Use the “useEffect” React hook to “wait” for DOM elements to be
rendered for Video Player
Adaptive Bitrate Streaming
https://cloudinary.com/documentation/adaptive_bitrate_streaming
➢ Chunk the video data
➢ Browser receives list of chunks
➢ Detect user bandwidth real time
➢ Browser requests chunks with different resolutions based on network
➢ HTTP layer
➢ Use Cloudinary transformations to create chunks before requested
Large Video Better User Experience
Adaptive Bitrate Streaming: Formats
Containers for ABR
● HLS : h264 (Universal)
● MPEG-DASH: VP9
.mp4
Cloudinary Transformation:
transcode and create different
resolutions to support
different bandwidths
.m3u8
.m3u8
.ts
master
playlist
list of
“chunks”
a “chunk”
Code: Adaptive Bitrate Streaming using just HLS/h264
require('dotenv').config()
const cloudinary = require('cloudinary').v2
const options =
{
resource_type: "video",
type: "upload",
eager: [
{ streaming_profile: "hd", format: "m3u8" },
{
format: "mp4",
transformation: [{ quality: "auto" }],
}],
eager_async: true,
eager_notification_url:
"https://webhook.site/20d13ebe-105c-4f04-9719-
7e1e55f6ad94"
};
cloudinary.uploader.explicit("myvideo", options)
.then(result => console.log(JSON.stringify(result,
null, 2)))
.catch(error => console.log.log(error))
// instantiate cloudinary to set config
const cloudinaryCld = cloudinary.Cloudinary.new({ cloud_name:
"cloudinary-training" });
// wait for the player id element to load
document.addEventListener("DOMContentLoaded", e => {
const options = {
sourceTypes: ["hls", "mp4"],
muted: true,
controls: true,
width: 800,
sourceTransformation: {
hls: [{ streaming_profile: "hd" }],
mp4: [{ quality: "auto" }],
},
playbackRates: [0.5, 1, 1.5, 2],
};
const media = cloudinaryCld.videoPlayer("player", options);
media.source("myvideo");
})
Backend processing Frontend delivery
Node.js Browser JavaScript
https://replit.com/@rpeltz/ABR-hd-profile https://replit.com/@rpeltz/ABRCloudinaryVideoPlayer
Summary
Single source
video tag
Video Embed
Element
Video Player
Video in React
Adaptive Bitrate
Streaming

More Related Content

Similar to Hosting video js friends (2)

Bitmovin LIVE Tech Talks: Data Driven Video Workflows
Bitmovin LIVE Tech Talks: Data Driven Video WorkflowsBitmovin LIVE Tech Talks: Data Driven Video Workflows
Bitmovin LIVE Tech Talks: Data Driven Video WorkflowsBitmovin Inc
 
Windows 7 and Windows Server 2008 R2 SP1 Overview
Windows 7 and Windows Server 2008 R2 SP1 OverviewWindows 7 and Windows Server 2008 R2 SP1 Overview
Windows 7 and Windows Server 2008 R2 SP1 OverviewAmit Gatenyo
 
Virtual STB / Cloud UI Streaming revisited
Virtual STB / Cloud UI Streaming revisitedVirtual STB / Cloud UI Streaming revisited
Virtual STB / Cloud UI Streaming revisitedDr. Randolph Nikutta
 
Cloudbridge video delivery
Cloudbridge video deliveryCloudbridge video delivery
Cloudbridge video deliveryNuno Alves
 
JS Days HTML5 Flash and the Battle for Faster Cat Videos
JS Days HTML5 Flash and the Battle for Faster Cat VideosJS Days HTML5 Flash and the Battle for Faster Cat Videos
JS Days HTML5 Flash and the Battle for Faster Cat VideosGreg Schechter
 
[refreshaustin] Adaptive Images in Responsive Web Design
[refreshaustin] Adaptive Images in Responsive Web Design[refreshaustin] Adaptive Images in Responsive Web Design
[refreshaustin] Adaptive Images in Responsive Web DesignChristopher Schmitt
 
Build end-to-end video experiences with Azure Media Services
Build end-to-end video experiences with Azure Media ServicesBuild end-to-end video experiences with Azure Media Services
Build end-to-end video experiences with Azure Media ServicesresponsiveX
 
Building video applications on Windows 8 with Windows Azure Media Services
Building video applications on Windows 8 with Windows Azure Media ServicesBuilding video applications on Windows 8 with Windows Azure Media Services
Building video applications on Windows 8 with Windows Azure Media ServicesMingfei Yan
 
Building video application on windows 8 with Windows Azure Media Services
Building video application on windows 8 with Windows Azure Media ServicesBuilding video application on windows 8 with Windows Azure Media Services
Building video application on windows 8 with Windows Azure Media ServicesMingfei Yan
 
Adobe Session on Flash Online Conference #12
Adobe Session on Flash Online Conference #12Adobe Session on Flash Online Conference #12
Adobe Session on Flash Online Conference #12Flash Conference
 
[rwdsummit2012] Adaptive Images in Responsive Web Design
[rwdsummit2012] Adaptive Images in Responsive Web Design[rwdsummit2012] Adaptive Images in Responsive Web Design
[rwdsummit2012] Adaptive Images in Responsive Web DesignChristopher Schmitt
 
Introduction to HTML5 & CSS3
Introduction to HTML5 & CSS3Introduction to HTML5 & CSS3
Introduction to HTML5 & CSS3Pravasini Sahoo
 
Altitude San Francisco 2018: Preparing for Video Streaming Events at Scale
Altitude San Francisco 2018: Preparing for Video Streaming Events at ScaleAltitude San Francisco 2018: Preparing for Video Streaming Events at Scale
Altitude San Francisco 2018: Preparing for Video Streaming Events at ScaleFastly
 
Streaming multimedia application for mobile devices for audio & video
Streaming multimedia application for mobile devices for audio & videoStreaming multimedia application for mobile devices for audio & video
Streaming multimedia application for mobile devices for audio & videoMike Taylor
 
GDD HTML5, Flash, and the Battle for Faster Cat Videos
GDD HTML5, Flash, and the Battle for Faster Cat VideosGDD HTML5, Flash, and the Battle for Faster Cat Videos
GDD HTML5, Flash, and the Battle for Faster Cat VideosGreg Schechter
 
[cssdevconf] Adaptive Images in RWD
[cssdevconf] Adaptive Images in RWD[cssdevconf] Adaptive Images in RWD
[cssdevconf] Adaptive Images in RWDChristopher Schmitt
 
SMX Milan - Supercharge Responsive Design | Idea Evolver
SMX Milan - Supercharge Responsive Design | Idea EvolverSMX Milan - Supercharge Responsive Design | Idea Evolver
SMX Milan - Supercharge Responsive Design | Idea EvolverIdea Evolver
 
Silverlight Briefing Deck
Silverlight  Briefing  DeckSilverlight  Briefing  Deck
Silverlight Briefing Deckllangit
 
[html5tx] Adaptive Images in Responsive Web Design
[html5tx] Adaptive Images in Responsive Web Design[html5tx] Adaptive Images in Responsive Web Design
[html5tx] Adaptive Images in Responsive Web DesignChristopher Schmitt
 
RICOH THETA x IoT Developers Contest : Cloud API Seminar
 RICOH THETA x IoT Developers Contest : Cloud API Seminar RICOH THETA x IoT Developers Contest : Cloud API Seminar
RICOH THETA x IoT Developers Contest : Cloud API Seminarcontest-theta360
 

Similar to Hosting video js friends (2) (20)

Bitmovin LIVE Tech Talks: Data Driven Video Workflows
Bitmovin LIVE Tech Talks: Data Driven Video WorkflowsBitmovin LIVE Tech Talks: Data Driven Video Workflows
Bitmovin LIVE Tech Talks: Data Driven Video Workflows
 
Windows 7 and Windows Server 2008 R2 SP1 Overview
Windows 7 and Windows Server 2008 R2 SP1 OverviewWindows 7 and Windows Server 2008 R2 SP1 Overview
Windows 7 and Windows Server 2008 R2 SP1 Overview
 
Virtual STB / Cloud UI Streaming revisited
Virtual STB / Cloud UI Streaming revisitedVirtual STB / Cloud UI Streaming revisited
Virtual STB / Cloud UI Streaming revisited
 
Cloudbridge video delivery
Cloudbridge video deliveryCloudbridge video delivery
Cloudbridge video delivery
 
JS Days HTML5 Flash and the Battle for Faster Cat Videos
JS Days HTML5 Flash and the Battle for Faster Cat VideosJS Days HTML5 Flash and the Battle for Faster Cat Videos
JS Days HTML5 Flash and the Battle for Faster Cat Videos
 
[refreshaustin] Adaptive Images in Responsive Web Design
[refreshaustin] Adaptive Images in Responsive Web Design[refreshaustin] Adaptive Images in Responsive Web Design
[refreshaustin] Adaptive Images in Responsive Web Design
 
Build end-to-end video experiences with Azure Media Services
Build end-to-end video experiences with Azure Media ServicesBuild end-to-end video experiences with Azure Media Services
Build end-to-end video experiences with Azure Media Services
 
Building video applications on Windows 8 with Windows Azure Media Services
Building video applications on Windows 8 with Windows Azure Media ServicesBuilding video applications on Windows 8 with Windows Azure Media Services
Building video applications on Windows 8 with Windows Azure Media Services
 
Building video application on windows 8 with Windows Azure Media Services
Building video application on windows 8 with Windows Azure Media ServicesBuilding video application on windows 8 with Windows Azure Media Services
Building video application on windows 8 with Windows Azure Media Services
 
Adobe Session on Flash Online Conference #12
Adobe Session on Flash Online Conference #12Adobe Session on Flash Online Conference #12
Adobe Session on Flash Online Conference #12
 
[rwdsummit2012] Adaptive Images in Responsive Web Design
[rwdsummit2012] Adaptive Images in Responsive Web Design[rwdsummit2012] Adaptive Images in Responsive Web Design
[rwdsummit2012] Adaptive Images in Responsive Web Design
 
Introduction to HTML5 & CSS3
Introduction to HTML5 & CSS3Introduction to HTML5 & CSS3
Introduction to HTML5 & CSS3
 
Altitude San Francisco 2018: Preparing for Video Streaming Events at Scale
Altitude San Francisco 2018: Preparing for Video Streaming Events at ScaleAltitude San Francisco 2018: Preparing for Video Streaming Events at Scale
Altitude San Francisco 2018: Preparing for Video Streaming Events at Scale
 
Streaming multimedia application for mobile devices for audio & video
Streaming multimedia application for mobile devices for audio & videoStreaming multimedia application for mobile devices for audio & video
Streaming multimedia application for mobile devices for audio & video
 
GDD HTML5, Flash, and the Battle for Faster Cat Videos
GDD HTML5, Flash, and the Battle for Faster Cat VideosGDD HTML5, Flash, and the Battle for Faster Cat Videos
GDD HTML5, Flash, and the Battle for Faster Cat Videos
 
[cssdevconf] Adaptive Images in RWD
[cssdevconf] Adaptive Images in RWD[cssdevconf] Adaptive Images in RWD
[cssdevconf] Adaptive Images in RWD
 
SMX Milan - Supercharge Responsive Design | Idea Evolver
SMX Milan - Supercharge Responsive Design | Idea EvolverSMX Milan - Supercharge Responsive Design | Idea Evolver
SMX Milan - Supercharge Responsive Design | Idea Evolver
 
Silverlight Briefing Deck
Silverlight  Briefing  DeckSilverlight  Briefing  Deck
Silverlight Briefing Deck
 
[html5tx] Adaptive Images in Responsive Web Design
[html5tx] Adaptive Images in Responsive Web Design[html5tx] Adaptive Images in Responsive Web Design
[html5tx] Adaptive Images in Responsive Web Design
 
RICOH THETA x IoT Developers Contest : Cloud API Seminar
 RICOH THETA x IoT Developers Contest : Cloud API Seminar RICOH THETA x IoT Developers Contest : Cloud API Seminar
RICOH THETA x IoT Developers Contest : Cloud API Seminar
 

More from Rebecca Peltz

Intro chrome extensions
Intro chrome extensionsIntro chrome extensions
Intro chrome extensionsRebecca Peltz
 
Make an html validator extension
Make an html validator extensionMake an html validator extension
Make an html validator extensionRebecca Peltz
 
Make an language translator with voice extension
Make an language translator with voice extensionMake an language translator with voice extension
Make an language translator with voice extensionRebecca Peltz
 

More from Rebecca Peltz (7)

Gitbook FAQs
Gitbook FAQsGitbook FAQs
Gitbook FAQs
 
Gitbook Publish FAQ
Gitbook Publish FAQGitbook Publish FAQ
Gitbook Publish FAQ
 
Meetup gitbook
Meetup gitbookMeetup gitbook
Meetup gitbook
 
Intro chrome extensions
Intro chrome extensionsIntro chrome extensions
Intro chrome extensions
 
Make an html validator extension
Make an html validator extensionMake an html validator extension
Make an html validator extension
 
Make an language translator with voice extension
Make an language translator with voice extensionMake an language translator with voice extension
Make an language translator with voice extension
 
Ado Presentation
Ado PresentationAdo Presentation
Ado Presentation
 

Recently uploaded

W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...software pro Development
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 

Recently uploaded (20)

W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 

Hosting video js friends (2)

  • 1. Hosting Video JavaScript Friends Meetup June 30, 2021 Becky Peltz
  • 2. Bio Linked In: Rebecca Peltz MBA University of Washington Database Programming Application Development Web Engineering Bootcamp & University Web Developer Certificate Instruction Developer Instructional Designer @Cloudinary
  • 3. Video Hosting: Why? “if a picture is worth a thousand words, then a video has to be worth at least 1.8 million words” - Dr. James McQuivey, Forester Study 1000/words per picture x 30 frames(pictures)/second x 60 seconds/minute = 1,800,000 pictures _____________________________________________________________________________ ______ “74% of marketers say video has a better return on investment than static imagery.” Biteable.com Video Marketing Stats _____________________________________________________________________________ ______ “Globally, IP video will be 82% of all IP traffic in 2021, up from 73% in 2016” Cisco 2021
  • 4. Video Hosting Terminology & Concepts ● Size and Duration ● Codecs, Containers and Browsers ● Advanced Bitrate Streaming (ABR) Code ● Video Tag ● Video Embed Element ● Video Player ● React and Video ● Processing and delivery of ABR (Advanced Bitrate Streaming)
  • 5. Video Hosting: File Size and Duration file size (bytes) = bitrate (bytes per sec) * duration (sec) * compression ratio bitrate (bytes per sec) = frame size * frames per second (fps) frame size (bytes) = width (px) * height (px) * color depth (bytes) ● compression ratio depends on codec, h264 baseline is about 1000:1, so 1 GBS can be compressed to 1 MBS ● frames per second can vary depending on how recorded, but 30 fps is common ● width and height make up the resolution as in an image
  • 6. Video Hosting: Codecs, Containers and Browsers
  • 7. Video Hosting: Code Single Video Source https://replit.com/@rpeltz/VideoSingleSource HTML5 Video Embed Element https://replit.com/@rpeltz/HTML5VideoEmbedElement Cloudinary JavaScript SDK Video Embed Element Cloudinary Video Player https://replit.com/@rpeltz/CloudinaryVideoPlayer Cloudinary React Component https://codesandbox.io/s/cld-advanced-concepts- training-video-player-6h3k3 Cloudinary React Video Player Video Processing add HD Profile for ABR Backend https://replit.com/@rpeltz/ABR-hd-profile Cloudinary Video Player with ABR Frontend https://replit.com/@rpeltz/ABRCloudinaryVideoPlayer
  • 8. Code: .mov/h264 in Chrome How do you expect an .mov/h264 file to behave in Chrome? https://replit.com/@rpeltz/VideoSingleSource
  • 9. Code: Video Tag Single Source <video controls src="myvideo" width="300"></video> <video controls poster="myposter" width="620"> <source src="myvideo" type="video/mp4"> Sorry,your browser doesn't support embedded videos. </video> https://replit.com/@rpeltz/VideoSingleSource#index.html
  • 10. Code: HTML5 Video Embed Element and Cloudinary JavaScript VideoTag <video controls="" height="349" poster="myposterimage.jpg" width="620"> <source src="myvideo.webm" type="video/webm"> <source src="myvideo.mp4" type="video/mp4"> <source src="myvideo.ogv" type="video/ogg"> Your browser does not support HTML5 video tags. </video> https://replit.com/@rpeltz/HTML5VideoEmbedElement
  • 11. Code: Cloudinary Video Player // instantiate cloudinary to set config const cloudinary = cloudinary.Cloudinary.new({ cloud_name:"cloudinary-training"}); // wait for the player id element to load document.addEventListener("DOMContentLoaded",e=>{ const media = cloudinary.videoPlayer("player"); media.source("video-hosting/goats"); }) <video id="player" controls class="cld-video-player cld-fluid"></video> HTML JavaScript https://replit.com/@rpeltz/CloudinaryVideoPlayer
  • 12. Code: React React SDK v Cloudinary Video Player https://cloudinary.com/documentation/react_integration https://codesandbox.io/s/cld-advanced-concepts-training-video-player-6h3k3 1. Libraries from npmjs.org 2. Create components for the Video Embed and the Player 3. Parameters are Cloudinary “cloudName” and “publicId” 4. Use the “useEffect” React hook to “wait” for DOM elements to be rendered for Video Player
  • 13. Adaptive Bitrate Streaming https://cloudinary.com/documentation/adaptive_bitrate_streaming ➢ Chunk the video data ➢ Browser receives list of chunks ➢ Detect user bandwidth real time ➢ Browser requests chunks with different resolutions based on network ➢ HTTP layer ➢ Use Cloudinary transformations to create chunks before requested Large Video Better User Experience
  • 14. Adaptive Bitrate Streaming: Formats Containers for ABR ● HLS : h264 (Universal) ● MPEG-DASH: VP9 .mp4 Cloudinary Transformation: transcode and create different resolutions to support different bandwidths .m3u8 .m3u8 .ts master playlist list of “chunks” a “chunk”
  • 15. Code: Adaptive Bitrate Streaming using just HLS/h264 require('dotenv').config() const cloudinary = require('cloudinary').v2 const options = { resource_type: "video", type: "upload", eager: [ { streaming_profile: "hd", format: "m3u8" }, { format: "mp4", transformation: [{ quality: "auto" }], }], eager_async: true, eager_notification_url: "https://webhook.site/20d13ebe-105c-4f04-9719- 7e1e55f6ad94" }; cloudinary.uploader.explicit("myvideo", options) .then(result => console.log(JSON.stringify(result, null, 2))) .catch(error => console.log.log(error)) // instantiate cloudinary to set config const cloudinaryCld = cloudinary.Cloudinary.new({ cloud_name: "cloudinary-training" }); // wait for the player id element to load document.addEventListener("DOMContentLoaded", e => { const options = { sourceTypes: ["hls", "mp4"], muted: true, controls: true, width: 800, sourceTransformation: { hls: [{ streaming_profile: "hd" }], mp4: [{ quality: "auto" }], }, playbackRates: [0.5, 1, 1.5, 2], }; const media = cloudinaryCld.videoPlayer("player", options); media.source("myvideo"); }) Backend processing Frontend delivery Node.js Browser JavaScript https://replit.com/@rpeltz/ABR-hd-profile https://replit.com/@rpeltz/ABRCloudinaryVideoPlayer
  • 16. Summary Single source video tag Video Embed Element Video Player Video in React Adaptive Bitrate Streaming

Editor's Notes

  1. https://idearocketanimation.com/4293-video-worth-1-million-words/ https://www.cisco.com/c/dam/m/en_us/solutions/service-provider/vni-forecast-highlights/pdf/Global_2021_Forecast_Highlights.pdf https://biteable.com/blog/video-marketing-statistics/
  2. https://www.circlehd.com/blog/how-to-calculate-video-file-size https://youtu.be/DDcYvesZsnw https://www.rgb.com/h264-profiles
  3. working with mov in chrome https://replit.com/@rpeltz/VideoSingleSource
  4. https://replit.com/@rpeltz/VideoSingleSource
  5. https://replit.com/@rpeltz/HTML5VideoEmbedElement https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video https://peach.blender.org/about/ https://download.blender.org/peach/bigbuckbunny_movies/
  6. https://replit.com/@rpeltz/CloudinaryVideoPlayer Load libraries Render a video tag Wait for all DOM elements to render Create Cloudinary object and capture Cloud name Attach player to DOM element Supply Cloudinary public id as source
  7. https://codesandbox.io/s/cld-advanced-concepts-training-video-player-6h3k3