46 lines
1.4 KiB
Plaintext
46 lines
1.4 KiB
Plaintext
<div>
|
|
<div id="playerDiv"></div>
|
|
<script type="text/javascript" src="https://demo.nanocosmos.de/nanoplayer/api/release/nanoplayer.4.min.js"></script>
|
|
<%= javascript_tag nonce: true do %>
|
|
var urlParams = new URLSearchParams(window.location.search);
|
|
var streamName = urlParams.get('stream_name');
|
|
console.log("streamName", streamName);
|
|
var player;
|
|
var config = {
|
|
"source": {
|
|
"entries": [
|
|
{
|
|
"h5live": {
|
|
// your rtmp stream
|
|
"rtmp": {
|
|
"url": "rtmp://bintu-play.nanocosmos.de/play",
|
|
"streamname": streamName,
|
|
},
|
|
"server": {
|
|
"websocket": "wss://bintu-h5live.nanocosmos.de:443/h5live/stream.mp4",
|
|
"hls": "https://bintu-h5live.nanocosmos.de:443/h5live/http/playlist.m3u8",
|
|
"progressive": "https://bintu-h5live.nanocosmos.de:443/h5live/http/stream.mp4"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"style": {
|
|
"width": "auto",
|
|
}
|
|
};
|
|
function initPlayer() {
|
|
player = new NanoPlayer('playerDiv');
|
|
player.setup(config).then(function (config) {
|
|
console.log('setup ok with config: ' + JSON.stringify(config));
|
|
}, function (error) {
|
|
console.log(error);
|
|
});
|
|
}
|
|
// load player from playerDiv
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
initPlayer();
|
|
});
|
|
<% end %>
|
|
</div>
|