Oncorporation / CastorLazyPack

Castor's Lazy Pack Development Repository
7 stars 5 forks source link

Question in client.js #6

Open Genide opened 5 years ago

Genide commented 5 years ago

In client.js, you have this section of code.

                video.autoplay = true;
                //video.get(0).play();
                video.play();

                await timeout(MySet.duration);

                addClass(video, 'hidden');
                await timeout(1000);

                video.pause();
                video.load();
                source.removeAttribute('src'); // empty source
                video.play();
                video.removeChild(source);
                video.muted = true; 
                callback();

I have a couple of questions.

  1. Why is video.load called after the first video.play? I believe this should be moved up.
  2. Why is video.play called a second time after the video has been hidden?

Proposed changes:

                video.load(); // Moved up to here
                video.play();

                await timeout(MySet.duration);

                addClass(video, 'hidden');
                await timeout(1000);

                video.pause();
                source.removeAttribute('src'); // empty source
                video.removeChild(source);
                video.muted = true;
                callback();