HTML5 audio with javascript

Audtio Element တစ်ခုကြေငြာခြင်း

var audioElement = document.createElement(‘audio’);

ဒါမှမဟုတ် audio tag , id name က myaudio နဲ့ ချိတ်မယ်ဆိုရင်

var audioElement = document.getElementById(‘myaudio’);

Play ချင်ရင်

audioElement.play();


Pause လုပ်ချင်ရင်

audioElement.pause();

ကြာမယ့် အချိန်ကို သိချင်ရင် (total second ကိုပြသည်)

audioElement.duration

လက်ရှိ ရောက်နေတဲ့ second ကို သိချင်ရင်

audioElement.currentTime

35 စက္ကန့်ကို ကျော်ချင်ရင်

audioElement.currentTime = 35;

သီချင်းပြောင်းချင်ရင်

audioElement.setAttribute(‘src’, ‘music/Track01.mp3’);

audioElement.load();

firefox နဲ့ opera အတွက်က ogg ပေါ့။ safari နဲ့ chrome အတွက်က mp3 ပေါ့။

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Saturngod

Subscribe now to keep reading and get access to the full archive.

Continue reading