tntesting2

1.0.2 • Public • Published

This package is for distribution on npm.

Nanocosmos Logo

NanoCore - nanoStream h5live player

H5Live Scheme

NPM Version NPM Downloads

Description

The Core of the H5Live Player Javascript Client for plugin-free low-latency playback in Web Browsers and Apps. It can be included via script tag or requirejs.

This package contains the nanocore.min.js (including a flash fallback functionality) and the nanocore.h5live.min.js (h5live only).

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 tntesting2

Quick Start

After the installation include the nanocore.min.js via script tag:

<div id="playerDiv" class="player"></div>
<script type="text/javascript" src="./node_modules/nanocore/nanocore.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
        }
    };
    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
        }
    };
    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/nanocore/nanocore.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>

Release History

Docs (NanoPlayer)

This docs are for the whole NanoPlayer. They match also for the NanoCore excluding the view (config.style is not present).

License

Dependents (0)

Package Sidebar

Install

npm i tntesting2

Weekly Downloads

5

Version

1.0.2

License

SEE LICENSE IN LICENSE.TXT

Last publish

Collaborators

  • tniedergesaess