simplemedia
TypeScript icon, indicating that this package has built-in type declarations

0.3.17 • Public • Published

Node.js CI FOSSA Status

Prerequisites

on Ubuntu

apt install libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libsdl2-dev

on macOS

brew install ffmpeg sdl2

You may need to install cmake-js and typescript

npm i -g cmake-js
npm i -g typescript

Install

npm i simplemedia

Example

See example/

const {Window, MediaPlayer} = require('simplemedia');


let window = new Window({
  title: "simplemedia nodejs",
  width: 640,
  height: 480,
});
let renderer = window.createRenderer();

let player = new MediaPlayer({
  renderer: renderer,
  trace: true,
});
player.datasource = media_uri;
player.prepare().then(resolve => {
  console.log('duration: ' + player.duration);
  player.start();
}).catch(err => {
  console.log(err);
});

player.onend = (() => {
  console.log('end-of-stream!');
});

readAndDispatch();

(Optional) Native only build

cd native;
mkdir build; cd build
cmake .. && make

You'll probably get a binary named mediaplayer try to run it with a media file

./mediaplayer /path/to/file

License

FOSSA Status

Dependents (1)

Package Sidebar

Install

npm i simplemedia

Weekly Downloads

11

Version

0.3.17

License

MIT

Unpacked Size

228 kB

Total Files

106

Last publish

Collaborators

  • buttonfly