Loading Media

This document will guide you on how the `src` prop can be set for any package or player you choose.

File

Empty

player.src = null;

Media Stream

player.src = new MediaStream();

Relative Path

player.src = '/media/audio.mp3';

URL

player.src = 'https://mysite.com/video.mp4';

Object

player.src = { src: '/media/video.mp4', type: 'video/mp4' };

Array

player.src = [
'/media/video.mp4',
'/media/video.ogg'
];

Array of Objects

This also demonstrates how to pass in qualities which are optional.

player.src = [{
src: '/media/video-1080.mp4',
type: 'video/mp4',
quality: 1080
}, {
src: '/media/video-1080.ogg',
type: 'video/ogg',
quality: 1080
}, {
src: '/media/video-720.mp4',
type: 'video/mp4',
quality: 720
}, {
src: '/media/video-720.ogg',
type: 'video/ogg',
quality: 720
}];

YouTube

Empty

player.src = null;

Shorthand

player.src = 'youtube/{videoId}';

URL

https://, www and .com are optional.

player.src = 'https://www.youtube.com/{videoId}';

Shortened URL

https:// and www are optional.

player.src = 'https://www.youtu.be/{videoId}';

Watch URL

https://, www and .com are optional.

player.src = 'https://www.youtube.com/watch?v={videoId}';

Embed URL

https://, www and .com are optional.

player.src = 'https://www.youtube.com/embed/{videoId}';

Vimeo

Empty

player.src = null;

Shorthand

player.src = 'vimeo/{videoId}';

URL

https://, www and .com are optional.

player.src = 'https://www.vimeo.com/{videoId}';

Embed URL

player.src = 'player.vimeo.com/video/{videoId}';

Dailymotion

Empty

player.src = null;

Shorthand

player.src = 'dailymotion/{videoId}';

URL

https://, www and .com are optional.

player.src = 'https://www.dailymotion.com/{videoId}';

Shortened URL

https:// and www are optional.

player.src = 'https://www.dai.ly/{videoId}';

Watch URL

https://, www and .com are optional.

player.src = 'https://www.dailymotion.com/video/{videoId}';

Embed URL

https://, www and .com are optional.

player.src = 'https://www.dailymotion.com/embed/video/{videoId}';