浏览代码

instant play

am
Amirul Anwar 9 个月前
父节点
当前提交
b3b13f9dcc
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4
    1
      resources/views/digital-card.blade.php

+ 4
- 1
resources/views/digital-card.blade.php 查看文件

37
                 var scrollAmount = window.innerHeight / 7; // Amount to scroll per interval
37
                 var scrollAmount = window.innerHeight / 7; // Amount to scroll per interval
38
     
38
     
39
                 function playAudio() {
39
                 function playAudio() {
40
-                    if (!hasPlayed && scrollCount >= maxScrolls) {
40
+                    if (!hasPlayed) {
41
+                        console.log('play')
41
                         var playPromise = audioElement.play();
42
                         var playPromise = audioElement.play();
42
     
43
     
43
                         if (playPromise !== undefined) {
44
                         if (playPromise !== undefined) {
54
     
55
     
55
                 function smoothScroll() {
56
                 function smoothScroll() {
56
                     if (!hasPlayed) {
57
                     if (!hasPlayed) {
58
+                        playAudio();
57
                         scrollCount++;
59
                         scrollCount++;
58
                         if (scrollCount >= maxScrolls) {
60
                         if (scrollCount >= maxScrolls) {
59
                             playAudio();
61
                             playAudio();
66
 
68
 
67
                 function playOnly() {
69
                 function playOnly() {
68
                     if (!hasPlayed) {
70
                     if (!hasPlayed) {
71
+                        playAudio();
69
                         scrollCount++;
72
                         scrollCount++;
70
                         if (scrollCount >= maxScrolls) {
73
                         if (scrollCount >= maxScrolls) {
71
                             playAudio();
74
                             playAudio();

正在加载...
取消
保存