cycjimmy / jsmpeg-player

MPEG1 Video Player Based On JSMpeg.
https://www.npmjs.com/package/@cycjimmy/jsmpeg-player
MIT License
161 stars 38 forks source link
jsmpeg ts video

JSMpeg Player(TS Player)

libraries dependency status libraries sourcerank Release date rollup semantic-release npm license

How to use

Install

NPM version NPM bundle size npm download

$ npm install @cycjimmy/jsmpeg-player --save
# or
$ yarn add @cycjimmy/jsmpeg-player

Usage

import JSMpeg from '@cycjimmy/jsmpeg-player';
# OR
const JSMpeg = require('@cycjimmy/jsmpeg-player');
new JSMpeg.VideoElement(videoWrapper, videoUrl [, options] [, overlayOptions])

Use in browser

jsdelivr

<div id="videoWrapper"></div>
<script src="https://github.com/cycjimmy/jsmpeg-player/raw/main/jsmpeg-player.umd.min.js"></script>
<script>
  var videoUrl = '../static/media/test_video.ts';
  new JSMpeg.VideoElement('#videoWrapper', videoUrl);
</script>

CDN

To use via a CDN include this in your HTML:

<script src="https://cdn.jsdelivr.net/npm/@cycjimmy/jsmpeg-player@6/dist/jsmpeg-player.umd.min.js"></script>

Encoding Video/Audio for jsmpeg by ffmpeg. E.g:

$ ffmpeg -i input.mp4 -f mpegts \
         -codec:v mpeg1video -s 640x360 -b:v 700k -r 25 -bf 0 \
         -codec:a mp2 -ar 44100 -ac 1 -b:a 64k \
         output.ts