Skip to content

mastashake08/youtube-dash

Repository files navigation

youtube-dash

NPM

NPM version Build Status Coverage Status

NPM package for managing broadcasts and livestreaming from the browser using the Youtube Livestreaming API via DASH. Created and maintained by Jyrone Parker

Installation

Clone repository with Git:

git clone https://github.com/mastashake08/youtube-dash.git
cd youtube-dash

Use via NPM

npm i @mastashake08/youtube-dash

Usage

Import the package in your Javascript application.

import { YoutubeDash } from '@mastashake08/youtube-dash'

const yt = new YoutubeDash(api_token)

const title = "Getting Started With Screen Recorder"
yt.createNewLiveStream(title)

//readable video stream
readable.pipeThru(yt.uploadStream()).pipeTo(writable)

//using sync blobs with MediaRecorder gathering data every 2 seconds
mediaRecorder.start(2000);
mediaRecorder.ondataavailable = (e) => {
    const file = new File([e.data], "video.webm");
    yt.uploadDashData(file)
};

Release

Only collaborators with credentials can release and publish:

npm run release
git push --follow-tags && npm publish

To see what files are going to be published, run the command:

npm pack --dry-run
# tar tvf $(npm pack)

Support

License

MIT