av/cmd/mjpeg-player/hlsjs/loader/level-key.js

25 lines
586 B
JavaScript
Raw Normal View History

2020-01-24 06:48:26 +03:00
import { buildAbsoluteURL } from 'url-toolkit';
export default class LevelKey {
private _uri: string | null = null;
public baseuri: string;
public reluri: string;
public method: string | null = null;
public key: Uint8Array | null = null;
public iv: Uint8Array | null = null;
constructor (baseURI: string, relativeURI: string) {
this.baseuri = baseURI;
this.reluri = relativeURI;
}
get uri () {
if (!this._uri && this.reluri) {
this._uri = buildAbsoluteURL(this.baseuri, this.reluri, { alwaysNormalize: true });
}
return this._uri;
}
}