@@ -13,10 +13,14 @@ const rrwebScriptPath = path.resolve(
1313const rrwebStylePath = path . resolve ( rrwebScriptPath , "../style.css" ) ;
1414const rrwebRaw = fs . readFileSync ( rrwebScriptPath , "utf-8" ) ;
1515const rrwebStyle = fs . readFileSync ( rrwebStylePath , "utf-8" ) ;
16+ interface Config {
17+ // start playback delay time
18+ startDelayTime ?: number ,
19+ }
1620
1721function getHtml (
1822 events : Array < eventWithTime > ,
19- config ?: Omit < RRwebPlayerOptions [ "props" ] , "events" >
23+ config ?: Omit < RRwebPlayerOptions [ "props" ] & Config , "events" >
2024) : string {
2125 return `
2226<html>
@@ -38,20 +42,19 @@ function getHtml(
3842 props: {
3943 events,
4044 showController: false,
41- autoPlay: false, // 默认关闭自动播放
45+ autoPlay: false, // autoPlay off by default
4246 ...userConfig
4347 },
4448 });
4549
4650 window.replayer.addEventListener('finish', () => window.onReplayFinish());
47- let time = userConfig.startDelayTime || 1000 // 开始播放延迟时间
51+ let time = userConfig.startDelayTime || 1000 // start playback delay time, default 1000ms
4852 let start = fn => {
49- let timer = setTimeout(() => {
50- clearTimeout(timer);
53+ setTimeout(() => {
5154 fn()
5255 }, time)
5356 }
54- // 建议默认不自动播放,如果倍速的话自动播放前期页面块会空白
57+ // It is recommended not to play auto by default. If the speed is not 1, the page block in the early stage of autoPlay will be blank
5558 if (userConfig.autoPlay) {
5659 start = fn => {
5760 fn()
@@ -73,7 +76,7 @@ type RRvideoConfig = {
7376 input : string ;
7477 cb : ( file : string , error : null | Error ) => void ;
7578 output : string ;
76- rrwebPlayer : Omit < RRwebPlayerOptions [ "props" ] , "events" > ;
79+ rrwebPlayer : Omit < RRwebPlayerOptions [ "props" ] & Config , "events" > ;
7780} ;
7881
7982const defaultConfig : RRvideoConfig = {
0 commit comments