Add Logging singleton to manually control Mediabunny's console output (fixes #415)

This commit is contained in:
Vanilagy
2026-06-18 19:32:18 +02:00
parent 92a384f418
commit cdc2ef63dd
28 changed files with 324 additions and 65 deletions
+4 -3
View File
@@ -7,6 +7,7 @@
*/
import { MediaCodec, validateAudioChunkMetadata, validateVideoChunkMetadata } from '../codec';
import { Logging } from '../logging';
import { EncodedAudioPacketSource, EncodedVideoPacketSource } from '../media-source';
import {
arrayArgmax,
@@ -197,7 +198,7 @@ export class HlsMuxer extends Muxer {
if (track.type === otherTrack.type) {
if (!illegalPairingDetected) {
console.warn(
Logging._warn(
`Illegal pairing of two ${track.type} tracks detected, which is not possible in HLS;`
+ ` treating them as unpaired.`,
);
@@ -213,7 +214,7 @@ export class HlsMuxer extends Muxer {
|| (otherTrack.isVideoTrack() && otherTrack.metadata.hasOnlyKeyPackets)
) {
if (!keyPacketsOnlyPairingWarned) {
console.warn(
Logging._warn(
`A key-packets-only video track is pairable with another track, which is not`
+ ` possible in HLS; treating them as unpaired.`,
);
@@ -1370,7 +1371,7 @@ export class HlsMuxer extends Muxer {
masterPlaylistText += `#EXT-X-MEDIA:TYPE=${type.toUpperCase()},GROUP-ID="${decl.groupId}"`;
if (name !== null && /[\n\r"]/.test(name)) {
console.warn(
Logging._warn(
'Dropping track name since it includes a line feed, carriage return, or double quote'
+ ' character, which are not allowed in HLS playlist attributes.',
);