加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
common.js 2.21 KB
一键复制 编辑 原始数据 按行查看 历史
冯宸宇 提交于 2020-07-13 11:03 . 'finished'
//Player request.
const kPlayVideoReq = 0;
const kPauseVideoReq = 1;
const kStopVideoReq = 2;
//Player response.
const kPlayVideoRsp = 0;
const kAudioInfo = 1;
const kVideoInfo = 2;
const kAudioData = 3;
const kVideoData = 4;
//Downloader request.
const kGetFileInfoReq = 0;
const kDownloadFileReq = 1;
const kCloseDownloaderReq = 2;
//Downloader response.
const kGetFileInfoRsp = 0;
const kFileData = 1;
//Downloader Protocol.
const kProtoHttp = 0;
const kProtoWebsocket = 1;
//Decoder request.
const kInitDecoderReq = 0;
const kUninitDecoderReq = 1;
const kOpenDecoderReq = 2;
const kCloseDecoderReq = 3;
const kFeedDataReq = 4;
const kStartDecodingReq = 5;
const kPauseDecodingReq = 6;
const kSeekToReq = 7;
//Decoder response.
const kInitDecoderRsp = 0;
const kUninitDecoderRsp = 1;
const kOpenDecoderRsp = 2;
const kCloseDecoderRsp = 3;
const kVideoFrame = 4;
const kAudioFrame = 5;
const kStartDecodingRsp = 6;
const kPauseDecodingRsp = 7;
const kDecodeFinishedEvt = 8;
const kRequestDataEvt = 9;
const kSeekToRsp = 10;
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;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化