52 lines
1.4 KiB
JavaScript
52 lines
1.4 KiB
JavaScript
//Player request.
|
|
const kCloseDecoderReq = 0;
|
|
const kOpenDecoderReq = 1;
|
|
const kRequestHeaderReq = 2;
|
|
const kRequestBodyReq = 3;
|
|
const kPauseGetUrlReq = 4;
|
|
const kResumeGetUrlReq = 5;
|
|
const kRequestLiveReq = 6;
|
|
const kDecodeVideo = 7;
|
|
|
|
//CMSParser response.
|
|
const kCMSHeaderRes = 8;
|
|
const kVideoFrame = 9;
|
|
const kAudioFrame = 10;
|
|
const kImageFrame = 11;
|
|
const kFinishDownload = 12;
|
|
const kVideoBuffer = 13;
|
|
const kCmsPartHeader = 14;
|
|
|
|
function Logger(module) {
|
|
this.module = module;
|
|
}
|
|
|
|
Logger.prototype.log = function (line) {
|
|
console.log("[" + this.currentTimeStr() + "][" + this.module + "]" + line);
|
|
}
|
|
|
|
Logger.prototype.logError = function (line) {
|
|
// console.log("[" + this.currentTimeStr() + "][" + this.module + "][ER] " + line);
|
|
}
|
|
|
|
Logger.prototype.logInfo = function (line) {
|
|
// console.log("[" + this.currentTimeStr() + "][" + this.module + "][IF] " + line);
|
|
}
|
|
|
|
Logger.prototype.logDebug = function (line) {
|
|
// console.log("[" + this.currentTimeStr() + "][" + this.module + "][DT] " + line);
|
|
}
|
|
|
|
Logger.prototype.currentTimeStr = function () {
|
|
var now = new Date(Date.now());
|
|
var year = now.getFullYear();
|
|
var month = now.getMonth() + 1;
|
|
var day = now.getDate();
|
|
var hour = now.getHours();
|
|
var min = now.getMinutes();
|
|
var sec = now.getSeconds();
|
|
var ms = now.getMilliseconds();
|
|
return year + "-" + month + "-" + day + " " + hour + ":" + min + ":" + sec + ":" + ms;
|
|
}
|
|
|