@@ -42,6 +42,10 @@ export class HomeComponent implements OnInit, BranchieVideoFsmEventsSink{
42
42
console . log ( '触发器 tid=' + trigger . id ) ;
43
43
44
44
const act = this . videoFsm . currentActivity ;
45
+ if ( this . videoUrl !== act . video ) {
46
+ this . videoUrl = act . video ;
47
+ }
48
+
45
49
this . rewind ( act . timeStart ) ; // activity 里的时间是毫秒,播放器需要秒
46
50
this . resume ( ) ;
47
51
}
@@ -55,6 +59,7 @@ export class HomeComponent implements OnInit, BranchieVideoFsmEventsSink{
55
59
}
56
60
57
61
onVideoDurationChanged ( event ) : void {
62
+ console . log ( this . videoUrl . toString ( ) ) ;
58
63
/*
59
64
if (!isNaN(this.videoDuration)) {
60
65
this.videoDuration = this.player.nativeElement.duration * 1000;
@@ -108,6 +113,7 @@ export class HomeComponent implements OnInit, BranchieVideoFsmEventsSink{
108
113
}
109
114
110
115
private async reinit ( ) : Promise < void > {
116
+ this . clearTransitions ( ) ;
111
117
const videoConfig = await this . videoService . loadVideoConfig ( ) ;
112
118
this . videoFsm = new BranchieVideoFsm ( videoConfig , this ) ;
113
119
this . playVideo ( ) ;
@@ -174,7 +180,10 @@ export class HomeComponent implements OnInit, BranchieVideoFsmEventsSink{
174
180
private updateTime ( ) : void {
175
181
const act = this . videoFsm . currentActivity ;
176
182
this . videoTime = ( this . player . nativeElement . currentTime * 1000.0 ) - act . timeStart ;
177
- this . videoDuration = act . timeEnd - act . timeStart ;
183
+ let endTime = ( act . timeEnd !== undefined && ! isNaN ( act . timeEnd ) ?
184
+ act . timeEnd : this . player . nativeElement . duration * 1000 ) ;
185
+ endTime = isNaN ( endTime ) ? 0 : endTime ;
186
+ this . videoDuration = endTime - act . timeStart ;
178
187
}
179
188
180
189
}
0 commit comments