code stringlengths 24 2.07M | docstring stringlengths 25 85.3k | func_name stringlengths 1 92 | language stringclasses 1
value | repo stringlengths 5 64 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
utf8ArrayToStr = function utf8ArrayToStr(array, exitOnNull) {
if (exitOnNull === void 0) {
exitOnNull = false;
}
var decoder = getTextDecoder();
if (decoder) {
var decoded = decoder.decode(array);
if (exitOnNull) {
// grab up to the first null
var idx = decoded.indexOf('\0');
re... | Returns an array of ID3 frames found in all the ID3 tags in the id3Data
@param {Uint8Array} id3Data - The ID3 data containing one or more ID3 tags
@return {ID3.Frame[]} - Array of ID3 frame objects | utf8ArrayToStr | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function getTextDecoder() {
if (!decoder && typeof self.TextDecoder !== 'undefined') {
decoder = new self.TextDecoder('utf-8');
}
return decoder;
} | Returns an array of ID3 frames found in all the ID3 tags in the id3Data
@param {Uint8Array} id3Data - The ID3 data containing one or more ID3 tags
@return {ID3.Frame[]} - Array of ID3 frame objects | getTextDecoder | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function TSDemuxer(observer, config, typeSupported) {
this.observer = void 0;
this.config = void 0;
this.typeSupported = void 0;
this.sampleAes = null;
this.pmtParsed = false;
this.audioCodec = void 0;
this.videoCodec = void 0;
this._duration = 0;
this.aacLastPTS = null;
this._in... | highly optimized TS demuxer:
parse PAT, PMT
extract PES packet from audio and video PIDs
extract AVC/H264 NAL units and AAC/ADTS samples from PES packet
trigger the remuxer upon parsing completion
it also tries to workaround as best as it can audio codec switch (HE-AAC to AAC and vice versa), without having to restart ... | TSDemuxer | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function createAVCSample(key, pts, dts, debug) {
return {
key: key,
frame: false,
pts: pts,
dts: dts,
units: [],
debug: debug,
length: 0
};
} | Initializes a new init segment on the demuxer/remuxer interface. Needed for discontinuities/track-switches (or at stream start)
Resets all internal track instances of the demuxer. | createAVCSample | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function parsePAT(data, offset) {
// skip the PSI header and parse the first PMT entry
return (data[offset + 10] & 0x1f) << 8 | data[offset + 11]; // logger.log('PMT PID:' + this._pmtId);
} | Initializes a new init segment on the demuxer/remuxer interface. Needed for discontinuities/track-switches (or at stream start)
Resets all internal track instances of the demuxer. | parsePAT | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function parsePMT(data, offset, mpegSupported, isSampleAes) {
var result = {
audio: -1,
avc: -1,
id3: -1,
isAAC: true
};
var sectionLength = (data[offset + 1] & 0x0f) << 8 | data[offset + 2];
var tableEnd = offset + 3 + sectionLength - 4; // to determine where the table is, we have to figure out... | Initializes a new init segment on the demuxer/remuxer interface. Needed for discontinuities/track-switches (or at stream start)
Resets all internal track instances of the demuxer. | parsePMT | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function parsePES(stream) {
var i = 0;
var frag;
var pesLen;
var pesHdrLen;
var pesPts;
var pesDts;
var data = stream.data; // safety check
if (!stream || stream.size === 0) {
return null;
} // we might need up to 19 bytes to read PES header
// if first chunk of data is less than 19 bytes, let'... | Initializes a new init segment on the demuxer/remuxer interface. Needed for discontinuities/track-switches (or at stream start)
Resets all internal track instances of the demuxer. | parsePES | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function pushAccessUnit(avcSample, avcTrack) {
if (avcSample.units.length && avcSample.frame) {
// if sample does not have PTS/DTS, patch with last sample PTS/DTS
if (avcSample.pts === undefined) {
var samples = avcTrack.samples;
var nbSamples = samples.length;
if (nbSamples) {
var ... | Initializes a new init segment on the demuxer/remuxer interface. Needed for discontinuities/track-switches (or at stream start)
Resets all internal track instances of the demuxer. | pushAccessUnit | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function insertSampleInOrder(arr, data) {
var len = arr.length;
if (len > 0) {
if (data.pts >= arr[len - 1].pts) {
arr.push(data);
} else {
for (var pos = len - 1; pos >= 0; pos--) {
if (data.pts < arr[pos].pts) {
arr.splice(pos, 0, data);
break;
}
}
... | Initializes a new init segment on the demuxer/remuxer interface. Needed for discontinuities/track-switches (or at stream start)
Resets all internal track instances of the demuxer. | insertSampleInOrder | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function discardEPB(data) {
var length = data.byteLength;
var EPBPositions = [];
var i = 1; // Find all `Emulation Prevention Bytes`
while (i < length - 2) {
if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) {
EPBPositions.push(i + 2);
i += 2;
} else {
i++;
}
} // ... | remove Emulation Prevention bytes from a RBSP | discardEPB | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function Hls(userConfig) {
if (userConfig === void 0) {
userConfig = {};
}
this.config = void 0;
this.userConfig = void 0;
this.coreComponents = void 0;
this.networkControllers = void 0;
this._emitter = new eventemitter3__WEBPACK_IMPORTED_MODULE_11__["EventEmitter"]();
this._autoL... | Creates an instance of an HLS client that can attach to exactly one `HTMLMediaElement`.
@constructs Hls
@param {HlsConfig} config | Hls | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function Part(partAttrs, frag, baseurl, index, previous) {
var _this2;
_this2 = _BaseSegment2.call(this, baseurl) || this;
_this2.fragOffset = 0;
_this2.duration = 0;
_this2.gap = false;
_this2.independent = false;
_this2.relurl = void 0;
_this2.fragment = void 0;
_this2.index = voi... | Utility method for parseLevelPlaylist to get a fragment's decryption data from the currently parsed encryption key data
@param levelkey - a playlist's encryption info
@param segmentNumber - the fragment's segment number
@returns {LevelKey} - an object to be applied as a fragment's decryptdata | Part | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function setCodecs(codecs, level) {
['video', 'audio', 'text'].forEach(function (type) {
var filtered = codecs.filter(function (codec) {
return Object(_utils_codecs__WEBPACK_IMPORTED_MODULE_7__["isCodecType"])(codec, type);
});
if (filtered.length) {
var preferred = filtered.filter(function (... | Backfill any missing PDT values
"If the first EXT-X-PROGRAM-DATE-TIME tag in a Playlist appears after
one or more Media Segment URIs, the client SHOULD extrapolate
backward from that tag (using EXTINF durations and/or media
timestamps) to associate dates with those segments."
We have already extrapolated forward, but a... | setCodecs | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function assignCodec(media, groupItem, codecProperty) {
var codecValue = groupItem[codecProperty];
if (codecValue) {
media[codecProperty] = codecValue;
}
} | Backfill any missing PDT values
"If the first EXT-X-PROGRAM-DATE-TIME tag in a Playlist appears after
one or more Media Segment URIs, the client SHOULD extrapolate
backward from that tag (using EXTINF durations and/or media
timestamps) to associate dates with those segments."
We have already extrapolated forward, but a... | assignCodec | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function backfillProgramDateTimes(fragments, firstPdtIndex) {
var fragPrev = fragments[firstPdtIndex];
for (var i = firstPdtIndex; i--;) {
var frag = fragments[i]; // Exit on delta-playlist skipped segments
if (!frag) {
return;
}
frag.programDateTime = fragPrev.programDateTime - frag.durati... | Backfill any missing PDT values
"If the first EXT-X-PROGRAM-DATE-TIME tag in a Playlist appears after
one or more Media Segment URIs, the client SHOULD extrapolate
backward from that tag (using EXTINF durations and/or media
timestamps) to associate dates with those segments."
We have already extrapolated forward, but a... | backfillProgramDateTimes | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function assignProgramDateTime(frag, prevFrag) {
if (frag.rawProgramDateTime) {
frag.programDateTime = Date.parse(frag.rawProgramDateTime);
} else if (prevFrag !== null && prevFrag !== void 0 && prevFrag.programDateTime) {
frag.programDateTime = prevFrag.endProgramDateTime;
}
if (!Object(_home_runner_w... | Backfill any missing PDT values
"If the first EXT-X-PROGRAM-DATE-TIME tag in a Playlist appears after
one or more Media Segment URIs, the client SHOULD extrapolate
backward from that tag (using EXTINF durations and/or media
timestamps) to associate dates with those segments."
We have already extrapolated forward, but a... | assignProgramDateTime | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function mapContextToLevelType(context) {
var type = context.type;
switch (type) {
case _types_loader__WEBPACK_IMPORTED_MODULE_6__["PlaylistContextType"].AUDIO_TRACK:
return _types_loader__WEBPACK_IMPORTED_MODULE_6__["PlaylistLevelType"].AUDIO;
case _types_loader__WEBPACK_IMPORTED_MODULE_6__["Playli... | PlaylistLoader - delegate for media manifest/playlist loading tasks. Takes care of parsing media to internal data-models.
Once loaded, dispatches events with parsed data-models of manifest/levels/audio/subtitle tracks.
Uses loader(s) set in config to do actual internal loading of resource tasks.
@module | mapContextToLevelType | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function getResponseUrl(response, context) {
var url = response.url; // responseURL not supported on some browsers (it is used to detect URL redirection)
// data-uri mode also not supported (but no need to detect redirection)
if (url === undefined || url.indexOf('data:') === 0) {
// fallback to initial URL
... | PlaylistLoader - delegate for media manifest/playlist loading tasks. Takes care of parsing media to internal data-models.
Once loaded, dispatches events with parsed data-models of manifest/levels/audio/subtitle tracks.
Uses loader(s) set in config to do actual internal loading of resource tasks.
@module | getResponseUrl | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function PlaylistLoader(hls) {
this.hls = void 0;
this.loaders = Object.create(null);
this.hls = hls;
this.registerListeners();
} | PlaylistLoader - delegate for media manifest/playlist loading tasks. Takes care of parsing media to internal data-models.
Once loaded, dispatches events with parsed data-models of manifest/levels/audio/subtitle tracks.
Uses loader(s) set in config to do actual internal loading of resource tasks.
@module | PlaylistLoader | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function StyledUnicodeChar(uchar, foreground, underline, italics, background, flash) {
this.uchar = void 0;
this.penState = void 0;
this.uchar = uchar || ' '; // unicode character
this.penState = new PenState(foreground, underline, italics, background, flash);
} | Unicode character with styling and background.
@constructor | StyledUnicodeChar | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function Row(logger) {
this.chars = void 0;
this.pos = void 0;
this.currPenState = void 0;
this.cueStartTime = void 0;
this.logger = void 0;
this.chars = [];
for (var i = 0; i < NR_COLS; i++) {
this.chars.push(new StyledUnicodeChar());
}
this.logger = logger;
this.pos = 0... | CEA-608 row consisting of NR_COLS instances of StyledUnicodeChar.
@constructor | Row | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function CaptionScreen(logger) {
this.rows = void 0;
this.currRow = void 0;
this.nrRollUpRows = void 0;
this.lastOutputScreen = void 0;
this.logger = void 0;
this.rows = [];
for (var i = 0; i < NR_ROWS; i++) {
this.rows.push(new Row(logger));
} // Note that we use zero-based numbe... | Keep a CEA-608 screen of 32x15 styled characters
@constructor | CaptionScreen | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function Cea608Channel(channelNumber, outputFilter, logger) {
this.chNr = void 0;
this.outputFilter = void 0;
this.mode = void 0;
this.verbose = void 0;
this.displayedMemory = void 0;
this.nonDisplayedMemory = void 0;
this.lastOutputScreen = void 0;
this.currRollUpRow = void 0;
this.... | Get all non-empty rows with as unicode text. | Cea608Channel | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function Cea608Parser(field, out1, out2) {
this.channels = void 0;
this.currentChannel = 0;
this.cmdHistory = void 0;
this.logger = void 0;
var logger = new CaptionsLogger();
this.channels = [null, new Cea608Channel(field, out1, logger), new Cea608Channel(field + 1, out2, logger)];
this.cmdH... | Get all non-empty rows with as unicode text. | Cea608Parser | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function setLastCmd(a, b, cmdHistory) {
cmdHistory.a = a;
cmdHistory.b = b;
} | Trigger the generation of a cue, and the start of a new one if displayScreens are not empty. | setLastCmd | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function hasCmdRepeated(a, b, cmdHistory) {
return cmdHistory.a === a && cmdHistory.b === b;
} | Trigger the generation of a cue, and the start of a new one if displayScreens are not empty. | hasCmdRepeated | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function createCmdHistory() {
return {
a: null,
b: null
};
} | Trigger the generation of a cue, and the start of a new one if displayScreens are not empty. | createCmdHistory | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function alignStream(lastFrag, lastLevel, details) {
if (!lastLevel) {
return;
}
alignDiscontinuities(lastFrag, details, lastLevel);
if (!details.alignedSliding && lastLevel.details) {
// If the PTS wasn't figured out via discontinuity sequence that means there was no CC increase within the level.
... | Using the parameters of the last level, this function computes PTS' of the new fragments so that they form a
contiguous stream with the last fragments.
The PTS of a fragment lets Hls.js know where it fits into a stream - by knowing every PTS, we know which fragment to
download at any given time. PTS is normally compute... | alignStream | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function alignDiscontinuities(lastFrag, details, lastLevel) {
if (shouldAlignOnDiscontinuities(lastFrag, lastLevel, details)) {
var referenceFrag = findDiscontinuousReferenceFrag(lastLevel.details, details);
if (referenceFrag && Object(_home_runner_work_hls_js_hls_js_src_polyfills_number__WEBPACK_IMPORTED_MO... | Computes the PTS if a new level's fragments using the PTS of a fragment in the last level which shares the same
discontinuity sequence.
@param lastFrag - The last Fragment which shares the same discontinuity sequence
@param lastLevel - The details of the last loaded level
@param details - The details of the new level | alignDiscontinuities | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function alignPDT(details, lastDetails) {
// This check protects the unsafe "!" usage below for null program date time access.
if (!lastDetails.fragments.length || !details.hasProgramDateTime || !lastDetails.hasProgramDateTime) {
return;
} // if last level sliding is 1000 and its first frag PROGRAM-DATE-TIME ... | Computes the PTS of a new level's fragments using the difference in Program Date Time from the last level.
@param details - The details of the new level
@param lastDetails - The details of the last loaded level | alignPDT | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function alignFragmentByPDTDelta(frag, delta) {
var programDateTime = frag.programDateTime;
if (!programDateTime) return;
var start = (programDateTime - delta) / 1000;
frag.start = frag.startPTS = start;
frag.endPTS = start + frag.duration;
} | Computes the PTS of a new level's fragments using the difference in Program Date Time from the last level.
@param details - The details of the new level
@param lastDetails - The details of the last loaded level | alignFragmentByPDTDelta | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function alignMediaPlaylistByPDT(details, refDetails) {
// This check protects the unsafe "!" usage below for null program date time access.
if (!refDetails.fragments.length || !details.hasProgramDateTime || !refDetails.hasProgramDateTime) {
return;
}
var refPDT = refDetails.fragments[0].programDateTime; /... | Ensures appropriate time-alignment between renditions based on PDT. Unlike `alignPDT`, which adjusts
the timeline based on the delta between PDTs of the 0th fragment of two playlists/`LevelDetails`,
this function assumes the timelines represented in `refDetails` are accurate, including the PDTs,
and uses the "wallclock... | alignMediaPlaylistByPDT | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function parseInitSegment(initSegment) {
var result = [];
var traks = findBox(initSegment, ['moov', 'trak']);
for (var i = 0; i < traks.length; i++) {
var trak = traks[i];
var tkhd = findBox(trak, ['tkhd'])[0];
if (tkhd) {
var version = tkhd.data[tkhd.start];
var _index = version === 0 ... | Parses an MP4 initialization segment and extracts stream type and
timescale values for any declared tracks. Timescale values indicate the
number of clock ticks per second to assume for time-based values
elsewhere in the MP4.
To determine the start time of an MP4, you need two pieces of
information: the timescale unit ... | parseInitSegment | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function getStartDTS(initData, fmp4) {
// we need info from two children of each track fragment box
return findBox(fmp4, ['moof', 'traf']).reduce(function (result, traf) {
var tfdt = findBox(traf, ['tfdt'])[0];
var version = tfdt.data[tfdt.start];
var start = findBox(traf, ['tfhd']).reduce(function (res... | Determine the base media decode start time, in seconds, for an MP4
fragment. If multiple fragments are specified, the earliest time is
returned.
The base media decode time can be parsed from track fragment
metadata:
```
moof > traf > tfdt.baseMediaDecodeTime
```
It requires the timescale value from the mdhd to interpr... | getStartDTS | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function getDuration(data, initData) {
var rawDuration = 0;
var videoDuration = 0;
var audioDuration = 0;
var trafs = findBox(data, ['moof', 'traf']);
for (var i = 0; i < trafs.length; i++) {
var traf = trafs[i]; // There is only one tfhd & trun per traf
// This is true for CMAF style content, and we... | Determine the base media decode start time, in seconds, for an MP4
fragment. If multiple fragments are specified, the earliest time is
returned.
The base media decode time can be parsed from track fragment
metadata:
```
moof > traf > tfdt.baseMediaDecodeTime
```
It requires the timescale value from the mdhd to interpr... | getDuration | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function computeRawDurationFromSamples(trun) {
var flags = readUint32(trun, 0); // Flags are at offset 0, non-optional sample_count is at offset 4. Therefore we start 8 bytes in.
// Each field is an int32, which is 4 bytes
var offset = 8; // data-offset-present flag
if (flags & 0x000001) {
offset += 4;
... | Determine the base media decode start time, in seconds, for an MP4
fragment. If multiple fragments are specified, the earliest time is
returned.
The base media decode time can be parsed from track fragment
metadata:
```
moof > traf > tfdt.baseMediaDecodeTime
```
It requires the timescale value from the mdhd to interpr... | computeRawDurationFromSamples | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function offsetStartDTS(initData, fmp4, timeOffset) {
findBox(fmp4, ['moof', 'traf']).forEach(function (traf) {
findBox(traf, ['tfhd']).forEach(function (tfhd) {
// get the track id from the tfhd
var id = readUint32(tfhd, 4);
var track = initData[id];
if (!track) {
return;
}... | Determine the base media decode start time, in seconds, for an MP4
fragment. If multiple fragments are specified, the earliest time is
returned.
The base media decode time can be parsed from track fragment
metadata:
```
moof > traf > tfdt.baseMediaDecodeTime
```
It requires the timescale value from the mdhd to interpr... | offsetStartDTS | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function segmentValidRange(data) {
var segmentedRange = {
valid: null,
remainder: null
};
var moofs = findBox(data, ['moof']);
if (!moofs) {
return segmentedRange;
} else if (moofs.length < 2) {
segmentedRange.remainder = data;
return segmentedRange;
}
var last = moofs[moofs.length -... | Determine the base media decode start time, in seconds, for an MP4
fragment. If multiple fragments are specified, the earliest time is
returned.
The base media decode time can be parsed from track fragment
metadata:
```
moof > traf > tfdt.baseMediaDecodeTime
```
It requires the timescale value from the mdhd to interpr... | segmentValidRange | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function appendUint8Array(data1, data2) {
var temp = new Uint8Array(data1.length + data2.length);
temp.set(data1);
temp.set(data2, data1.length);
return temp;
} | Determine the base media decode start time, in seconds, for an MP4
fragment. If multiple fragments are specified, the earliest time is
returned.
The base media decode time can be parsed from track fragment
metadata:
```
moof > traf > tfdt.baseMediaDecodeTime
```
It requires the timescale value from the mdhd to interpr... | appendUint8Array | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.js | MIT |
function EE(fn, context, once) {
this.fn = fn;
this.context = context;
this.once = once || false;
} | Representation of a single event listener.
@param {Function} fn The listener function.
@param {*} context The context to invoke the listener with.
@param {Boolean} [once=false] Specify if the listener is a one-time listener.
@constructor
@private | EE | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function findFragmentByPDT(fragments, PDTValue, maxFragLookUpTolerance) {
if (PDTValue === null || !Array.isArray(fragments) || !fragments.length || !Object(_home_runner_work_hls_js_hls_js_src_polyfills_number__WEBPACK_IMPORTED_MODULE_0__["isFiniteNumber"])(PDTValue)) {
return null;
} // if less than start
... | Returns first fragment whose endPdt value exceeds the given PDT.
@param {Array<Fragment>} fragments - The array of candidate fragments
@param {number|null} [PDTValue = null] - The PDT value which must be exceeded
@param {number} [maxFragLookUpTolerance = 0] - The amount of time that a fragment's start/end can be within... | findFragmentByPDT | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function findFragmentByPTS(fragPrevious, fragments, bufferEnd, maxFragLookUpTolerance) {
if (bufferEnd === void 0) {
bufferEnd = 0;
}
if (maxFragLookUpTolerance === void 0) {
maxFragLookUpTolerance = 0;
}
var fragNext = null;
if (fragPrevious) {
fragNext = fragments[fragPrevious.sn - fragment... | Finds a fragment based on the SN of the previous fragment; or based on the needs of the current buffer.
This method compensates for small buffer gaps by applying a tolerance to the start of any candidate fragment, thus
breaking any traps which would cause the same fragment to be continuously selected within a small ran... | findFragmentByPTS | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function pdtWithinToleranceTest(pdtBufferEnd, maxFragLookUpTolerance, candidate) {
var candidateLookupTolerance = Math.min(maxFragLookUpTolerance, candidate.duration + (candidate.deltaPTS ? candidate.deltaPTS : 0)) * 1000; // endProgramDateTime can be null, default to zero
var endProgramDateTime = candidate.endPro... | The test function used by the findFragmentByPdt's BinarySearch to look for the best match to the current buffer conditions.
This function tests the candidate's program date time values, as represented in Unix time
@param {*} candidate - The fragment to test
@param {number} [pdtBufferEnd = 0] - The Unix time representin... | pdtWithinToleranceTest | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function findFragWithCC(fragments, cc) {
return _utils_binary_search__WEBPACK_IMPORTED_MODULE_1__["default"].search(fragments, function (candidate) {
if (candidate.cc < cc) {
return 1;
} else if (candidate.cc > cc) {
return -1;
} else {
return 0;
}
});
} | The test function used by the findFragmentByPdt's BinarySearch to look for the best match to the current buffer conditions.
This function tests the candidate's program date time values, as represented in Unix time
@param {*} candidate - The fragment to test
@param {number} [pdtBufferEnd = 0] - The Unix time representin... | findFragWithCC | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function isPartial(fragmentEntity) {
var _fragmentEntity$range, _fragmentEntity$range2;
return fragmentEntity.buffered && (((_fragmentEntity$range = fragmentEntity.range.video) === null || _fragmentEntity$range === void 0 ? void 0 : _fragmentEntity$range.partial) || ((_fragmentEntity$range2 = fragmentEntity.range.... | Gets the partial fragment for a certain time | isPartial | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function getFragmentKey(fragment) {
return fragment.type + "_" + fragment.level + "_" + fragment.urlId + "_" + fragment.sn;
} | Gets the partial fragment for a certain time | getFragmentKey | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
filterLevelAndGroupByIdIndex = function filterLevelAndGroupByIdIndex(url, id) {
return id !== urlId;
} | Switch to a redundant stream if any available.
If redundant stream is not available, emergency switch down if ABR mode is enabled. | filterLevelAndGroupByIdIndex | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function addGroupId(level, type, id) {
switch (type) {
case 'audio':
if (!level.audioGroupIds) {
level.audioGroupIds = [];
}
level.audioGroupIds.push(id);
break;
case 'text':
if (!level.textGroupIds) {
level.textGroupIds = [];
}
level.textGroupIds.p... | @module LevelHelper
Providing methods dealing with playlist sliding and drift | addGroupId | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function assignTrackIdsByGroup(tracks) {
var groups = {};
tracks.forEach(function (track) {
var groupId = track.groupId || '';
track.id = groups[groupId] = groups[groupId] || 0;
groups[groupId]++;
});
} | @module LevelHelper
Providing methods dealing with playlist sliding and drift | assignTrackIdsByGroup | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function updatePTS(fragments, fromIdx, toIdx) {
var fragFrom = fragments[fromIdx];
var fragTo = fragments[toIdx];
updateFromToPTS(fragFrom, fragTo);
} | @module LevelHelper
Providing methods dealing with playlist sliding and drift | updatePTS | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function updateFromToPTS(fragFrom, fragTo) {
var fragToPTS = fragTo.startPTS; // if we know startPTS[toIdx]
if (Object(_home_runner_work_hls_js_hls_js_src_polyfills_number__WEBPACK_IMPORTED_MODULE_0__["isFiniteNumber"])(fragToPTS)) {
// update fragment duration.
// it helps to fix drifts between playlist r... | @module LevelHelper
Providing methods dealing with playlist sliding and drift | updateFromToPTS | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function updateFragPTSDTS(details, frag, startPTS, endPTS, startDTS, endDTS) {
var parsedMediaDuration = endPTS - startPTS;
if (parsedMediaDuration <= 0) {
_utils_logger__WEBPACK_IMPORTED_MODULE_1__["logger"].warn('Fragment should have a positive duration', frag);
endPTS = startPTS + frag.duration;
end... | @module LevelHelper
Providing methods dealing with playlist sliding and drift | updateFragPTSDTS | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function mergeDetails(oldDetails, newDetails) {
// Track the last initSegment processed. Initialize it to the last one on the timeline.
var currentInitSegment = null;
var oldFragments = oldDetails.fragments;
for (var i = oldFragments.length - 1; i >= 0; i--) {
var oldInit = oldFragments[i].initSegment;
... | @module LevelHelper
Providing methods dealing with playlist sliding and drift | mergeDetails | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function mapPartIntersection(oldParts, newParts, intersectionFn) {
if (oldParts && newParts) {
var delta = 0;
for (var i = 0, len = oldParts.length; i <= len; i++) {
var _oldPart = oldParts[i];
var _newPart = newParts[i + delta];
if (_oldPart && _newPart && _oldPart.index === _newPart.inde... | @module LevelHelper
Providing methods dealing with playlist sliding and drift | mapPartIntersection | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function mapFragmentIntersection(oldDetails, newDetails, intersectionFn) {
var skippedSegments = newDetails.skippedSegments;
var start = Math.max(oldDetails.startSN, newDetails.startSN) - newDetails.startSN;
var end = (oldDetails.fragmentHint ? 1 : 0) + (skippedSegments ? newDetails.endSN : Math.min(oldDetails.en... | @module LevelHelper
Providing methods dealing with playlist sliding and drift | mapFragmentIntersection | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function adjustSliding(oldDetails, newDetails) {
var delta = newDetails.startSN + newDetails.skippedSegments - oldDetails.startSN;
var oldFragments = oldDetails.fragments;
if (delta < 0 || delta >= oldFragments.length) {
return;
}
addSliding(newDetails, oldFragments[delta].start);
} | @module LevelHelper
Providing methods dealing with playlist sliding and drift | adjustSliding | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function addSliding(details, start) {
if (start) {
var fragments = details.fragments;
for (var i = details.skippedSegments; i < fragments.length; i++) {
fragments[i].start += start;
}
if (details.fragmentHint) {
details.fragmentHint.start += start;
}
}
} | @module LevelHelper
Providing methods dealing with playlist sliding and drift | addSliding | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function computeReloadInterval(newDetails, stats) {
var reloadInterval = 1000 * newDetails.levelTargetDuration;
var reloadIntervalAfterMiss = reloadInterval / 2;
var timeSinceLastModified = newDetails.age;
var useLastModified = timeSinceLastModified > 0 && timeSinceLastModified < reloadInterval * 3;
var round... | @module LevelHelper
Providing methods dealing with playlist sliding and drift | computeReloadInterval | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function getFragmentWithSN(level, sn, fragCurrent) {
if (!level || !level.details) {
return null;
}
var levelDetails = level.details;
var fragment = levelDetails.fragments[sn - levelDetails.startSN];
if (fragment) {
return fragment;
}
fragment = levelDetails.fragmentHint;
if (fragment && fra... | @module LevelHelper
Providing methods dealing with playlist sliding and drift | getFragmentWithSN | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function getPartWith(level, sn, partIndex) {
if (!level || !level.details) {
return null;
}
var partList = level.details.partList;
if (partList) {
for (var i = partList.length; i--;) {
var part = partList[i];
if (part.index === partIndex && part.fragment.sn === sn) {
return part;
... | @module LevelHelper
Providing methods dealing with playlist sliding and drift | getPartWith | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function isHeaderPattern(data, offset) {
return data[offset] === 0xff && (data[offset + 1] & 0xf6) === 0xf0;
} | ADTS parser helper
@link https://wiki.multimedia.cx/index.php?title=ADTS | isHeaderPattern | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function getHeaderLength(data, offset) {
return data[offset + 1] & 0x01 ? 7 : 9;
} | ADTS parser helper
@link https://wiki.multimedia.cx/index.php?title=ADTS | getHeaderLength | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function getFullFrameLength(data, offset) {
return (data[offset + 3] & 0x03) << 11 | data[offset + 4] << 3 | (data[offset + 5] & 0xe0) >>> 5;
} | ADTS parser helper
@link https://wiki.multimedia.cx/index.php?title=ADTS | getFullFrameLength | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function canGetFrameLength(data, offset) {
return offset + 5 < data.length;
} | ADTS parser helper
@link https://wiki.multimedia.cx/index.php?title=ADTS | canGetFrameLength | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function isHeader(data, offset) {
// Look for ADTS header | 1111 1111 | 1111 X00X | where X can be either 0 or 1
// Layer bits (position 14 and 15) in header should be always 0 for ADTS
// More info https://wiki.multimedia.cx/index.php?title=ADTS
return offset + 1 < data.length && isHeaderPattern(data, offset);... | ADTS parser helper
@link https://wiki.multimedia.cx/index.php?title=ADTS | isHeader | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function canParse(data, offset) {
return canGetFrameLength(data, offset) && isHeaderPattern(data, offset) && getFullFrameLength(data, offset) <= data.length - offset;
} | ADTS parser helper
@link https://wiki.multimedia.cx/index.php?title=ADTS | canParse | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function probe(data, offset) {
// same as isHeader but we also check that ADTS frame follows last ADTS frame
// or end of data is reached
if (isHeader(data, offset)) {
// ADTS header Length
var headerLength = getHeaderLength(data, offset);
if (offset + headerLength >= data.length) {
return fals... | ADTS parser helper
@link https://wiki.multimedia.cx/index.php?title=ADTS | probe | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function initTrackConfig(track, observer, data, offset, audioCodec) {
if (!track.samplerate) {
var config = getAudioConfig(observer, data, offset, audioCodec);
if (!config) {
return;
}
track.config = config.config;
track.samplerate = config.samplerate;
track.channelCount = config.chann... | ADTS parser helper
@link https://wiki.multimedia.cx/index.php?title=ADTS | initTrackConfig | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function getFrameDuration(samplerate) {
return 1024 * 90000 / samplerate;
} | ADTS parser helper
@link https://wiki.multimedia.cx/index.php?title=ADTS | getFrameDuration | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function parseFrameHeader(data, offset, pts, frameIndex, frameDuration) {
// The protection skip bit tells us if we have 2 bytes of CRC data at the end of the ADTS header
var headerLength = getHeaderLength(data, offset); // retrieve frame size
var frameLength = getFullFrameLength(data, offset);
frameLength -= ... | ADTS parser helper
@link https://wiki.multimedia.cx/index.php?title=ADTS | parseFrameHeader | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function appendFrame(track, data, offset, pts, frameIndex) {
var frameDuration = getFrameDuration(track.samplerate);
var header = parseFrameHeader(data, offset, pts, frameIndex, frameDuration);
if (header) {
var frameLength = header.frameLength,
headerLength = header.headerLength,
stamp = hea... | ADTS parser helper
@link https://wiki.multimedia.cx/index.php?title=ADTS | appendFrame | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
initPTSFn = function initPTSFn(timestamp, timeOffset) {
return Object(_home_runner_work_hls_js_hls_js_src_polyfills_number__WEBPACK_IMPORTED_MODULE_0__["isFiniteNumber"])(timestamp) ? timestamp * 90 : timeOffset * 90000;
} | Initialize PTS
<p>
use timestamp unless it is undefined, NaN or Infinity
</p> | initPTSFn | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function ExpGolomb(data) {
this.data = void 0;
this.bytesAvailable = void 0;
this.word = void 0;
this.bitsAvailable = void 0;
this.data = data; // the number of bytes left to examine in this.data
this.bytesAvailable = data.byteLength; // the current word being examined
this.word = 0; // :u... | Parser for exponential Golomb codes, a variable-bitwidth number encoding scheme used by h264. | ExpGolomb | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
isHeader = function isHeader(data, offset) {
/*
* http://id3.org/id3v2.3.0
* [0] = 'I'
* [1] = 'D'
* [2] = '3'
* [3,4] = {Version}
* [5] = {Flags}
* [6-9] = {ID3 Size}
*
* An ID3v2 tag can be detected with the following pattern:
* $49 44 33 yy yy xx zz zz zz zz
* ... | Returns true if an ID3 header can be found at offset in data
@param {Uint8Array} data - The data to search in
@param {number} offset - The offset at which to start searching
@return {boolean} - True if an ID3 header is found | isHeader | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
isFooter = function isFooter(data, offset) {
/*
* The footer is a copy of the header, but with a different identifier
*/
if (offset + 10 <= data.length) {
// look for '3DI' identifier
if (data[offset] === 0x33 && data[offset + 1] === 0x44 && data[offset + 2] === 0x49) {
// check version is withi... | Returns true if an ID3 footer can be found at offset in data
@param {Uint8Array} data - The data to search in
@param {number} offset - The offset at which to start searching
@return {boolean} - True if an ID3 footer is found | isFooter | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
getID3Data = function getID3Data(data, offset) {
var front = offset;
var length = 0;
while (isHeader(data, offset)) {
// ID3 header is 10 bytes
length += 10;
var size = readSize(data, offset + 6);
length += size;
if (isFooter(data, offset + 10)) {
// ID3 footer is 10 bytes
length... | Returns any adjacent ID3 tags found in data starting at offset, as one block of data
@param {Uint8Array} data - The data to search in
@param {number} offset - The offset at which to start searching
@return {Uint8Array | undefined} - The block of data containing any ID3 tags found
or *undefined* if no header is found at... | getID3Data | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
readSize = function readSize(data, offset) {
var size = 0;
size = (data[offset] & 0x7f) << 21;
size |= (data[offset + 1] & 0x7f) << 14;
size |= (data[offset + 2] & 0x7f) << 7;
size |= data[offset + 3] & 0x7f;
return size;
} | Returns any adjacent ID3 tags found in data starting at offset, as one block of data
@param {Uint8Array} data - The data to search in
@param {number} offset - The offset at which to start searching
@return {Uint8Array | undefined} - The block of data containing any ID3 tags found
or *undefined* if no header is found at... | readSize | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
canParse = function canParse(data, offset) {
return isHeader(data, offset) && readSize(data, offset + 6) + 10 <= data.length - offset;
} | Returns any adjacent ID3 tags found in data starting at offset, as one block of data
@param {Uint8Array} data - The data to search in
@param {number} offset - The offset at which to start searching
@return {Uint8Array | undefined} - The block of data containing any ID3 tags found
or *undefined* if no header is found at... | canParse | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
getTimeStamp = function getTimeStamp(data) {
var frames = getID3Frames(data);
for (var i = 0; i < frames.length; i++) {
var frame = frames[i];
if (isTimeStampFrame(frame)) {
return readTimeStamp(frame);
}
}
return undefined;
} | Searches for the Elementary Stream timestamp found in the ID3 data chunk
@param {Uint8Array} data - Block of data containing one or more ID3 tags
@return {number | undefined} - The timestamp | getTimeStamp | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
isTimeStampFrame = function isTimeStampFrame(frame) {
return frame && frame.key === 'PRIV' && frame.info === 'com.apple.streaming.transportStreamTimestamp';
} | Returns true if the ID3 frame is an Elementary Stream timestamp frame
@param {ID3 frame} frame | isTimeStampFrame | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
getFrameData = function getFrameData(data) {
/*
Frame ID $xx xx xx xx (four characters)
Size $xx xx xx xx
Flags $xx xx
*/
var type = String.fromCharCode(data[0], data[1], data[2], data[3]);
var size = readSize(data, 4); // skip frame id, size, and flags
var offset = 10;
retur... | Returns true if the ID3 frame is an Elementary Stream timestamp frame
@param {ID3 frame} frame | getFrameData | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
getID3Frames = function getID3Frames(id3Data) {
var offset = 0;
var frames = [];
while (isHeader(id3Data, offset)) {
var size = readSize(id3Data, offset + 6); // skip past ID3 header
offset += 10;
var end = offset + size; // loop through frames in the ID3 tag
while (offset + 8 < end) {
va... | Returns an array of ID3 frames found in all the ID3 tags in the id3Data
@param {Uint8Array} id3Data - The ID3 data containing one or more ID3 tags
@return {ID3.Frame[]} - Array of ID3 frame objects | getID3Frames | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
decodeFrame = function decodeFrame(frame) {
if (frame.type === 'PRIV') {
return decodePrivFrame(frame);
} else if (frame.type[0] === 'W') {
return decodeURLFrame(frame);
}
return decodeTextFrame(frame);
} | Returns an array of ID3 frames found in all the ID3 tags in the id3Data
@param {Uint8Array} id3Data - The ID3 data containing one or more ID3 tags
@return {ID3.Frame[]} - Array of ID3 frame objects | decodeFrame | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
decodePrivFrame = function decodePrivFrame(frame) {
/*
Format: <text string>\0<binary data>
*/
if (frame.size < 2) {
return undefined;
}
var owner = utf8ArrayToStr(frame.data, true);
var privateData = new Uint8Array(frame.data.subarray(owner.length + 1));
return {
key: frame.type,
info: own... | Returns an array of ID3 frames found in all the ID3 tags in the id3Data
@param {Uint8Array} id3Data - The ID3 data containing one or more ID3 tags
@return {ID3.Frame[]} - Array of ID3 frame objects | decodePrivFrame | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
decodeTextFrame = function decodeTextFrame(frame) {
if (frame.size < 2) {
return undefined;
}
if (frame.type === 'TXXX') {
/*
Format:
[0] = {Text Encoding}
[1-?] = {Description}\0{Value}
*/
var index = 1;
var description = utf8ArrayToStr(frame.data.subarray(index), true);
in... | Returns an array of ID3 frames found in all the ID3 tags in the id3Data
@param {Uint8Array} id3Data - The ID3 data containing one or more ID3 tags
@return {ID3.Frame[]} - Array of ID3 frame objects | decodeTextFrame | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
decodeURLFrame = function decodeURLFrame(frame) {
if (frame.type === 'WXXX') {
/*
Format:
[0] = {Text Encoding}
[1-?] = {Description}\0{URL}
*/
if (frame.size < 2) {
return undefined;
}
var index = 1;
var description = utf8ArrayToStr(frame.data.subarray(index), true);
... | Returns an array of ID3 frames found in all the ID3 tags in the id3Data
@param {Uint8Array} id3Data - The ID3 data containing one or more ID3 tags
@return {ID3.Frame[]} - Array of ID3 frame objects | decodeURLFrame | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
readTimeStamp = function readTimeStamp(timeStampFrame) {
if (timeStampFrame.data.byteLength === 8) {
var data = new Uint8Array(timeStampFrame.data); // timestamp is 33 bit expressed as a big-endian eight-octet number,
// with the upper 31 bits set to zero.
var pts33Bit = data[3] & 0x1;
var timestamp ... | Returns an array of ID3 frames found in all the ID3 tags in the id3Data
@param {Uint8Array} id3Data - The ID3 data containing one or more ID3 tags
@return {ID3.Frame[]} - Array of ID3 frame objects | readTimeStamp | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
utf8ArrayToStr = function utf8ArrayToStr(array, exitOnNull) {
if (exitOnNull === void 0) {
exitOnNull = false;
}
var decoder = getTextDecoder();
if (decoder) {
var decoded = decoder.decode(array);
if (exitOnNull) {
// grab up to the first null
var idx = decoded.indexOf('\0');
re... | Returns an array of ID3 frames found in all the ID3 tags in the id3Data
@param {Uint8Array} id3Data - The ID3 data containing one or more ID3 tags
@return {ID3.Frame[]} - Array of ID3 frame objects | utf8ArrayToStr | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function getTextDecoder() {
if (!decoder && typeof self.TextDecoder !== 'undefined') {
decoder = new self.TextDecoder('utf-8');
}
return decoder;
} | Returns an array of ID3 frames found in all the ID3 tags in the id3Data
@param {Uint8Array} id3Data - The ID3 data containing one or more ID3 tags
@return {ID3.Frame[]} - Array of ID3 frame objects | getTextDecoder | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function TSDemuxer(observer, config, typeSupported) {
this.observer = void 0;
this.config = void 0;
this.typeSupported = void 0;
this.sampleAes = null;
this.pmtParsed = false;
this.audioCodec = void 0;
this.videoCodec = void 0;
this._duration = 0;
this.aacLastPTS = null;
this._in... | highly optimized TS demuxer:
parse PAT, PMT
extract PES packet from audio and video PIDs
extract AVC/H264 NAL units and AAC/ADTS samples from PES packet
trigger the remuxer upon parsing completion
it also tries to workaround as best as it can audio codec switch (HE-AAC to AAC and vice versa), without having to restart ... | TSDemuxer | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function createAVCSample(key, pts, dts, debug) {
return {
key: key,
frame: false,
pts: pts,
dts: dts,
units: [],
debug: debug,
length: 0
};
} | Initializes a new init segment on the demuxer/remuxer interface. Needed for discontinuities/track-switches (or at stream start)
Resets all internal track instances of the demuxer. | createAVCSample | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function parsePAT(data, offset) {
// skip the PSI header and parse the first PMT entry
return (data[offset + 10] & 0x1f) << 8 | data[offset + 11]; // logger.log('PMT PID:' + this._pmtId);
} | Initializes a new init segment on the demuxer/remuxer interface. Needed for discontinuities/track-switches (or at stream start)
Resets all internal track instances of the demuxer. | parsePAT | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function parsePMT(data, offset, mpegSupported, isSampleAes) {
var result = {
audio: -1,
avc: -1,
id3: -1,
isAAC: true
};
var sectionLength = (data[offset + 1] & 0x0f) << 8 | data[offset + 2];
var tableEnd = offset + 3 + sectionLength - 4; // to determine where the table is, we have to figure out... | Initializes a new init segment on the demuxer/remuxer interface. Needed for discontinuities/track-switches (or at stream start)
Resets all internal track instances of the demuxer. | parsePMT | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function parsePES(stream) {
var i = 0;
var frag;
var pesLen;
var pesHdrLen;
var pesPts;
var pesDts;
var data = stream.data; // safety check
if (!stream || stream.size === 0) {
return null;
} // we might need up to 19 bytes to read PES header
// if first chunk of data is less than 19 bytes, let'... | Initializes a new init segment on the demuxer/remuxer interface. Needed for discontinuities/track-switches (or at stream start)
Resets all internal track instances of the demuxer. | parsePES | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function pushAccessUnit(avcSample, avcTrack) {
if (avcSample.units.length && avcSample.frame) {
// if sample does not have PTS/DTS, patch with last sample PTS/DTS
if (avcSample.pts === undefined) {
var samples = avcTrack.samples;
var nbSamples = samples.length;
if (nbSamples) {
var ... | Initializes a new init segment on the demuxer/remuxer interface. Needed for discontinuities/track-switches (or at stream start)
Resets all internal track instances of the demuxer. | pushAccessUnit | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function insertSampleInOrder(arr, data) {
var len = arr.length;
if (len > 0) {
if (data.pts >= arr[len - 1].pts) {
arr.push(data);
} else {
for (var pos = len - 1; pos >= 0; pos--) {
if (data.pts < arr[pos].pts) {
arr.splice(pos, 0, data);
break;
}
}
... | Initializes a new init segment on the demuxer/remuxer interface. Needed for discontinuities/track-switches (or at stream start)
Resets all internal track instances of the demuxer. | insertSampleInOrder | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function discardEPB(data) {
var length = data.byteLength;
var EPBPositions = [];
var i = 1; // Find all `Emulation Prevention Bytes`
while (i < length - 2) {
if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) {
EPBPositions.push(i + 2);
i += 2;
} else {
i++;
}
} // ... | remove Emulation Prevention bytes from a RBSP | discardEPB | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function Hls(userConfig) {
if (userConfig === void 0) {
userConfig = {};
}
this.config = void 0;
this.userConfig = void 0;
this.coreComponents = void 0;
this.networkControllers = void 0;
this._emitter = new eventemitter3__WEBPACK_IMPORTED_MODULE_11__["EventEmitter"]();
this._autoL... | Creates an instance of an HLS client that can attach to exactly one `HTMLMediaElement`.
@constructs Hls
@param {HlsConfig} config | Hls | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function Part(partAttrs, frag, baseurl, index, previous) {
var _this2;
_this2 = _BaseSegment2.call(this, baseurl) || this;
_this2.fragOffset = 0;
_this2.duration = 0;
_this2.gap = false;
_this2.independent = false;
_this2.relurl = void 0;
_this2.fragment = void 0;
_this2.index = voi... | Utility method for parseLevelPlaylist to get a fragment's decryption data from the currently parsed encryption key data
@param levelkey - a playlist's encryption info
@param segmentNumber - the fragment's segment number
@returns {LevelKey} - an object to be applied as a fragment's decryptdata | Part | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
function setCodecs(codecs, level) {
['video', 'audio', 'text'].forEach(function (type) {
var filtered = codecs.filter(function (codec) {
return Object(_utils_codecs__WEBPACK_IMPORTED_MODULE_7__["isCodecType"])(codec, type);
});
if (filtered.length) {
var preferred = filtered.filter(function (... | Backfill any missing PDT values
"If the first EXT-X-PROGRAM-DATE-TIME tag in a Playlist appears after
one or more Media Segment URIs, the client SHOULD extrapolate
backward from that tag (using EXTINF durations and/or media
timestamps) to associate dates with those segments."
We have already extrapolated forward, but a... | setCodecs | javascript | gongfuxiang/shopxo | public/static/common/lib/ckplayer/hls.js/hls.light.js | https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.