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

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>