mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-29 17:51:46 +00:00
HLS.js: Add support for custom logger object in debug option
This commit is contained in:
@@ -23,7 +23,14 @@ class pLoader extends Hls.DefaultConfig.loader {
|
||||
|
||||
if (Hls.isSupported()) {
|
||||
const video = <HTMLVideoElement> document.getElementById('video');
|
||||
const hls = new Hls({ pLoader, startFragPrefetch: true });
|
||||
const hls = new Hls({
|
||||
pLoader,
|
||||
startFragPrefetch: true,
|
||||
debug: {
|
||||
log: (...args: any[]) => console.log(...args)
|
||||
}
|
||||
});
|
||||
|
||||
const version: string = Hls.version;
|
||||
hls.loadSource('http://www.streambox.fr/playlists/test_001/stream.m3u8');
|
||||
hls.attachMedia(video);
|
||||
|
||||
Vendored
+13
-2
@@ -1,8 +1,9 @@
|
||||
// Type definitions for hls.js 0.10
|
||||
// Project: https://github.com/video-dev/hls.js
|
||||
// Definitions by: John G. Gainfort, Jr. <https://github.com/jgainfort>
|
||||
// Johan Brook <https://github.com/brookback>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
// Event Keys
|
||||
type K_MEDIA_ATTACHING = "hlsMediaAttaching";
|
||||
@@ -307,6 +308,16 @@ declare namespace Hls {
|
||||
|
||||
// interface SubtitleTracks {}
|
||||
|
||||
type CustomLogger = (...args: any[]) => void;
|
||||
|
||||
interface CustomLoggerObject {
|
||||
warn?: CustomLogger;
|
||||
info?: CustomLogger;
|
||||
log?: CustomLogger;
|
||||
debug?: CustomLogger;
|
||||
error?: CustomLogger;
|
||||
}
|
||||
|
||||
interface Config {
|
||||
/**
|
||||
* (default: false)
|
||||
@@ -319,7 +330,7 @@ declare namespace Hls {
|
||||
* setting config.debug = true; will turn on debug logs on JS console.
|
||||
* a logger object could also be provided for custom logging: config.debug = customLogger;
|
||||
*/
|
||||
debug: boolean;
|
||||
debug: boolean | CustomLoggerObject;
|
||||
/**
|
||||
* (default: true)
|
||||
* if set to true, start level playlist and first fragments will be loaded automatically, after triggering of Hls.Events.MANIFEST_PARSED event
|
||||
|
||||
Reference in New Issue
Block a user