0.0.8 • Published 6 years ago
tntesting v0.0.8
This package is for distribution on npm
.
NanoPlayer - nanoStream h5live player
Description
The H5Live Player Javascript Client for plugin-free low-latency playback in Web Browsers and Apps. It can be include via script tag or requirejs.
Installation
This is a web-based low-latency javascript player client available through the npm registry.
Installation is done using the npm install
command:
$ npm install tntesting
Quick Start
After the installation include the nanoplayer.min.js via script tag:
<div id="playerDiv" class="player"></div>
<script type="text/javascript" src="./node_modules/nanoplayer/lib/nanoplayer.min.js"></script>
<script type="text/JavaScript">
var player;
var config = {
"source": {
"h5live": {
"server": {
"websocket": "wss://h5live.nanocosmos.de:443/h5live/stream",
"hls": "https://h5live.nanocosmos.de:443/h5live/http/playlist.m3u8",
"progressive": "https://h5live.nanocosmos.de:443/h5live/http/stream.mp4"
},
"rtmp": {
"url": "rtmp://your.server.com/live",
"streamname": "yourStream"
}
}
},
"playback": {
"autoplay": true,
"muted": true
},
"style": {
"controls": true
}
};
document.addEventListener('DOMContentLoaded', function () {
player = new NanoPlayer("playerDiv");
player.setup(config).then(function (config) {
console.log("setup success");
console.log("config: " + JSON.stringify(config, undefined, 4));
}, function (error) {
alert(error.message);
});
});
</script>
or via requirejs:
<div id="playerDiv" class="player"></div>
<script type="text/javascript" src="./path/to/require.js"></script>
<script type="text/javascript">
var player;
var config = {
"source": {
"h5live": {
"server": {
"websocket": "wss://h5live.nanocosmos.de:443/h5live/stream",
"hls": "https://h5live.nanocosmos.de:443/h5live/http/playlist.m3u8",
"progressive": "https://h5live.nanocosmos.de:443/h5live/http/stream.mp4"
},
"rtmp": {
"url": "rtmp://your.server.com/live",
"streamname": "yourStream"
}
}
},
"playback": {
"autoplay": true,
"muted": true
},
"style": {
"controls": true
}
};
requirejs.config({
paths: {
// loads the player ...
// for a local copy of the minified player use a relative path e.g. 'js/nanoplayer.min'
// for a online copy of the minified player use a url e.g. '//demo.nanocosmos.de/nanoplayer/api/release/nanoplayer.min'
// if 'baseUrl' is defined this path have to be relative to the base path
nanoplayer: './node_modules/nanoplayer/lib/nanoplayer.min.js'
},
waitSeconds: 20, // timeout for loading modules
});
require(['nanoplayer'], function () {
player = new NanoPlayer('playerDiv');
player.setup(config).then(function (config) {
console.log("setup success");
console.log("config: " + JSON.stringify(config, undefined, 4));
}, function (error) {
alert(error.message);
});
});
</script>