How to enable logging in the Bitmovin web player
The Bitmovin Web Player supports different log levels and an onLog
callback to capture all log messages.
Enable logging via player config
<script src="https://cdn.bitmovin.com/player/web/8/bitmovinplayer.js"></script>
<div id="player"></div>
<script>
const config = {
key: 'YOUR-PLAYER-KEY',
logs: {
level: bitmovin.player.LogLevel.DEBUG, // DEBUG, LOG, WARN, ERROR, OFF
onLog: (level, message, ...args) => {
console.log(`[${level}]`, message, ...args);
}
}
};
const player = new bitmovin.player.Player(document.getElementById('player'), config);
player.load({ dash: 'https://path/to/manifest.mpd' });
</script>
Listen to error and warning events
player.on(bitmovin.player.PlayerEvent.Error, (e) => {
console.error('[Bitmovin Error]', e);
});
player.on(bitmovin.player.PlayerEvent.Warning, (e) => {
console.warn('[Bitmovin Warning]', e);
});
Recommended usage
- Development:
DEBUG
orLOG
- Production:
WARN
(default) orERROR
References
Updated about 6 hours ago