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

英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 

Recently uploaded (20)

英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 

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