File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -180,10 +180,40 @@ const Preview = () => {
180
180
player . subtitle . url = proxyLink ( subtitle , true )
181
181
} )
182
182
}
183
+ interval = window . setInterval ( resetPlayUrl , 1000 * 60 * 14 )
183
184
} )
184
185
} )
186
+ let interval : number
187
+ let curSeek : number
188
+ async function resetPlayUrl ( ) {
189
+ const resp = await post ( )
190
+ handleResp ( resp , async ( data ) => {
191
+ const list =
192
+ data . video_preview_play_info . live_transcoding_task_list . filter (
193
+ ( l ) => l . url ,
194
+ )
195
+ if ( list . length === 0 ) {
196
+ notify . error ( "No transcoding video found" )
197
+ return
198
+ }
199
+ const quality = list . map ( ( item , i ) => {
200
+ return {
201
+ html : item . template_id ,
202
+ url : item . url ,
203
+ default : i === list . length - 1 ,
204
+ }
205
+ } )
206
+ player . quality = quality
207
+ curSeek = player . currentTime
208
+ await player . switchUrl ( quality [ quality . length - 1 ] . url )
209
+ setTimeout ( ( ) => {
210
+ player . seek = curSeek
211
+ } , 1000 )
212
+ } )
213
+ }
185
214
onCleanup ( ( ) => {
186
215
player ?. destroy ( )
216
+ window . clearInterval ( interval )
187
217
} )
188
218
const [ autoNext , setAutoNext ] = createSignal ( )
189
219
return (
You can’t perform that action at this time.
0 commit comments