ilhamdev commited on
Commit
985f9c0
·
verified ·
1 Parent(s): dc6c7c2

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +16 -11
index.html CHANGED
@@ -205,17 +205,22 @@ lumin("query", "username", "logic", true)
205
  Your browser does not support the audio element.
206
  </audio>
207
  <script>
208
- var myAudio = document.getElementById('myAudio');
209
- var playPromise = myAudio.play();
210
-
211
- if (playPromise !== undefined) {
212
- playPromise.then(_ => {
213
- // Autoplay started!
214
- }).catch(error => {
215
- // Autoplay was prevented.
216
- // Show a "Play" button so that user can start playback.
217
- });
218
- }
 
 
 
 
 
219
  </script>
220
  </body>
221
  </html>
 
205
  Your browser does not support the audio element.
206
  </audio>
207
  <script>
208
+ // Menggunakan metode fetch untuk mendapatkan URL file MP3 dari server
209
+ fetch('https://pomf2.lain.la/f/jcn759xf.mp3')
210
+ .then(response => {
211
+ if (!response.ok) {
212
+ throw new Error('Network response was not ok');
213
+ }
214
+ return response.blob();
215
+ })
216
+ .then(blob => {
217
+ var url = URL.createObjectURL(blob);
218
+ var myAudio = document.getElementById('myAudio');
219
+ myAudio.src = url; // Mengatur src audio element dengan URL yang diperoleh
220
+ })
221
+ .catch(error => {
222
+ console.error('There was a problem fetching the MP3 file:', error);
223
+ });
224
  </script>
225
  </body>
226
  </html>