mirror of
https://github.com/owncast/owncast.git
synced 2024-12-24 18:18:24 +03:00
04dc0796d8
* New video transcoder * Set a smaller max muxing size + logging tweaks * No need to return an err since it wiill panic anyway * Use a default encoder preset if one is not supplied * Rename to NewTranscoder. Add comments. * Rename Bitrate to VideoBitrate. Config file changes required with this rename. * Allow overrides of segment length. Allow offline stream to live in a single segment * Append offline state video to existin HLS stream instead of overwriting because players do not like that * Make properties private as they do not need to be exported
71 lines
No EOL
1.6 KiB
JavaScript
71 lines
No EOL
1.6 KiB
JavaScript
const streamURL = '/hls/stream.m3u8';
|
|
// const streamURL = 'https://goth.land/hls/stream.m3u8'; // Uncomment me to point to remote video
|
|
|
|
// style hackings
|
|
window.VIDEOJS_NO_DYNAMIC_STYLE = true;
|
|
|
|
// Create the player for the first time
|
|
const player = videojs('video', null, function () {
|
|
getStatus();
|
|
setInterval(getStatus, 5000);
|
|
setupPlayerEventHandlers();
|
|
})
|
|
|
|
player.ready(function () {
|
|
console.log('Player ready.')
|
|
player.reset();
|
|
player.src({ type: 'application/x-mpegURL', src: streamURL });
|
|
player.poster('/thumbnail.jpg');
|
|
});
|
|
|
|
function setupPlayerEventHandlers() {
|
|
const player = videojs('video');
|
|
|
|
player.on('error', function (e) {
|
|
console.log("Player error: ", e);
|
|
})
|
|
|
|
// player.on('loadeddata', function (e) {
|
|
// console.log("loadeddata");
|
|
// })
|
|
|
|
// player.on('ended', function (e) {
|
|
// console.log("ended");
|
|
// })
|
|
//
|
|
// player.on('abort', function (e) {
|
|
// console.log("abort");
|
|
// })
|
|
//
|
|
// player.on('durationchange', function (e) {
|
|
// console.log("durationchange");
|
|
// })
|
|
//
|
|
// player.on('stalled', function (e) {
|
|
// console.log("stalled");
|
|
// })
|
|
//
|
|
player.on('playing', function (e) {
|
|
if (playerRestartTimer) {
|
|
clearTimeout(playerRestartTimer);
|
|
}
|
|
})
|
|
//
|
|
// player.on('waiting', function (e) {
|
|
// // console.log("waiting");
|
|
// })
|
|
}
|
|
|
|
function restartPlayer() {
|
|
try {
|
|
console.log('restarting')
|
|
const player = videojs('video');
|
|
player.pause();
|
|
player.src(player.src()); // Reload the same video
|
|
player.load();
|
|
player.play();
|
|
} catch (e) {
|
|
console.log(e)
|
|
}
|
|
|
|
} |