@bililive-tools/manager 1.16.1 → 1.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -145,7 +145,7 @@ export class mesioDownloader extends EventEmitter {
|
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
147
|
createCommand() {
|
|
148
|
-
const inputOptions = [...this.inputOptions, "--fix", "--no-proxy"];
|
|
148
|
+
const inputOptions = [...this.inputOptions, "--fix", "--no-proxy", "--disable-log-file"];
|
|
149
149
|
if (this.debugLevel === "verbose") {
|
|
150
150
|
inputOptions.push("-v");
|
|
151
151
|
}
|
|
@@ -23,7 +23,12 @@ export declare class Segment extends EventEmitter {
|
|
|
23
23
|
outputVideoFilePath: string;
|
|
24
24
|
disableDanma: boolean;
|
|
25
25
|
videoExt: TrueVideoFormat;
|
|
26
|
-
|
|
26
|
+
options?: {
|
|
27
|
+
firstStartTime: number;
|
|
28
|
+
};
|
|
29
|
+
constructor(getSavePath: GetSavePath, disableDanma: boolean, videoExt: TrueVideoFormat, options?: {
|
|
30
|
+
firstStartTime: number;
|
|
31
|
+
});
|
|
27
32
|
private getVideoFileCompletedPayload;
|
|
28
33
|
handleSegmentEnd(): Promise<void>;
|
|
29
34
|
onSegmentStart(stderrLine: string, callBack?: {
|
|
@@ -13,11 +13,13 @@ export class Segment extends EventEmitter {
|
|
|
13
13
|
outputVideoFilePath;
|
|
14
14
|
disableDanma;
|
|
15
15
|
videoExt;
|
|
16
|
-
|
|
16
|
+
options;
|
|
17
|
+
constructor(getSavePath, disableDanma, videoExt, options) {
|
|
17
18
|
super();
|
|
18
19
|
this.getSavePath = getSavePath;
|
|
19
20
|
this.disableDanma = disableDanma;
|
|
20
21
|
this.videoExt = videoExt;
|
|
22
|
+
this.options = options;
|
|
21
23
|
}
|
|
22
24
|
getVideoFileCompletedPayload() {
|
|
23
25
|
return {
|
|
@@ -58,11 +60,13 @@ export class Segment extends EventEmitter {
|
|
|
58
60
|
if (!this.init) {
|
|
59
61
|
await this.handleSegmentEnd();
|
|
60
62
|
}
|
|
63
|
+
// 首次创建使用上次的时间戳,后续创建使用当前时间戳
|
|
64
|
+
const startTime = this.init ? (this.options?.firstStartTime ?? Date.now()) : Date.now();
|
|
61
65
|
this.init = false;
|
|
62
|
-
const startTime = Date.now();
|
|
63
66
|
let liveInfo = { title: "", cover: "" };
|
|
64
67
|
if (callBack?.onUpdateLiveInfo) {
|
|
65
68
|
try {
|
|
69
|
+
// TODO:这里存在bug,当调用onUpdateLiveInfo并在等待时,handleSegmentEnd被调用,那么会造成竞态导致数据错误,后续需要优化,需要保存segment状态
|
|
66
70
|
liveInfo = await callBack.onUpdateLiveInfo();
|
|
67
71
|
}
|
|
68
72
|
catch (err) {
|
|
@@ -143,7 +147,9 @@ export class StreamManager extends EventEmitter {
|
|
|
143
147
|
}
|
|
144
148
|
this.recordSavePath = recordSavePath;
|
|
145
149
|
if (hasSegment) {
|
|
146
|
-
this.segment = new Segment(getSavePath, disableDanma, this.videoExt
|
|
150
|
+
this.segment = new Segment(getSavePath, disableDanma, this.videoExt, {
|
|
151
|
+
firstStartTime: startTime,
|
|
152
|
+
});
|
|
147
153
|
this.segment.on("DebugLog", (data) => {
|
|
148
154
|
this.emit("DebugLog", data);
|
|
149
155
|
});
|
package/lib/index.js
CHANGED
package/lib/recorder.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ export interface RecorderCreateOpts<E extends AnyObject = UnknownObject> {
|
|
|
25
25
|
saveSCDanma?: boolean;
|
|
26
26
|
/** 保存封面 */
|
|
27
27
|
saveCover?: boolean;
|
|
28
|
+
/** 转封装为 mp4 */
|
|
29
|
+
convert2Mp4?: boolean;
|
|
28
30
|
/** 身份验证 */
|
|
29
31
|
auth?: string;
|
|
30
32
|
/** cookie所有者uid,B站弹幕录制 */
|
|
@@ -66,7 +68,7 @@ export interface RecorderCreateOpts<E extends AnyObject = UnknownObject> {
|
|
|
66
68
|
/** 调试等级 */
|
|
67
69
|
debugLevel?: "none" | "basic" | "verbose";
|
|
68
70
|
}
|
|
69
|
-
export type SerializedRecorder<E extends AnyObject> = PickRequired<RecorderCreateOpts<E>, "id"> & Pick<Recorder<E>, "id" | "channelId" | "remarks" | "disableAutoCheck" | "quality" | "streamPriorities" | "sourcePriorities" | "extra" | "segment" | "saveSCDanma" | "saveCover" | "saveGiftDanma" | "disableProvideCommentsWhenRecording" | "liveInfo" | "uid" | "titleKeywords">;
|
|
71
|
+
export type SerializedRecorder<E extends AnyObject> = PickRequired<RecorderCreateOpts<E>, "id"> & Pick<Recorder<E>, "id" | "channelId" | "remarks" | "disableAutoCheck" | "quality" | "streamPriorities" | "sourcePriorities" | "extra" | "segment" | "saveSCDanma" | "saveCover" | "convert2Mp4" | "saveGiftDanma" | "disableProvideCommentsWhenRecording" | "liveInfo" | "uid" | "titleKeywords">;
|
|
70
72
|
/** 录制状态,idle: 空闲中,recording: 录制中,stopping-record: 停止录制中,check-error: 检查错误,title-blocked: 标题黑名单 */
|
|
71
73
|
export type RecorderState = "idle" | "recording" | "stopping-record" | "check-error" | "title-blocked";
|
|
72
74
|
export type Progress = {
|