File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,16 +49,16 @@ export const video = (() => {
4949 * @param {Response } res
5050 * @returns {Promise<Response> }
5151 */
52- const resToVideo = ( res ) => {
53- vid . addEventListener ( 'loadedmetadata' , ( ) => {
54- document . getElementById ( 'video-love-stroy-loading' ) ?. remove ( ) ;
55- } , { once : true } ) ;
52+ const resToVideo = ( res ) => res . clone ( ) . blob ( ) . then ( ( b ) => {
53+ const loaded = new Promise ( ( r ) => vid . addEventListener ( 'loadedmetadata' , r , { once : true } ) ) ;
54+ vid . preload = 'auto' ;
55+ vid . src = URL . createObjectURL ( b ) ;
5656
57- return res . clone ( ) . blob ( ) . then ( ( b ) => {
58- vid . src = URL . createObjectURL ( b ) ;
57+ return loaded . then ( ( ) => {
58+ document . getElementById ( 'video-love-stroy-loading' ) ?. remove ( ) ;
5959 return res ;
6060 } ) ;
61- } ;
61+ } ) ;
6262
6363 /**
6464 * @returns {Promise<Response> }
@@ -103,7 +103,6 @@ export const video = (() => {
103103 vid . disablePictureInPicture = true ;
104104 vid . controlsList = 'noremoteplayback nodownload noplaybackrate' ;
105105
106- vid . load ( ) ;
107106 observer . observe ( vid ) ;
108107 return res ;
109108 } ) . catch ( ( err ) => {
You can’t perform that action at this time.
0 commit comments