Browse Source

instant play

am
Amirul Anwar 5 months ago
parent
commit
b3b13f9dcc
1 changed files with 4 additions and 1 deletions
  1. 4
    1
      resources/views/digital-card.blade.php

+ 4
- 1
resources/views/digital-card.blade.php View File

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

Loading…
Cancel
Save