Pages

9/23/2011

html5: เริ่มต้นกับ VDO / Audio

เริ่มต้นกับ Tag จุดเด่นของ html5 เลยดีกว่า ว่าด้วยเรื่องของ VDO / Audio  ดังจะเห็นได้ว่า เวลาเราเข้าเวปแต่ละเวปที่แสดง vdo หรือ mp3 ก็วุ่นวายกัน ว่าต้องลง Plug-in Flash ดีหรือว่าต้องลง Plug-in อะไรดีถึงจะเล่นเวปนี้ได้ ฟังเพลงนี้ได้ Html5 ก็เข้ามาตอบโจทย์พยามสร้าง Standard ให้ดังนี้


<video src="movie.ogg" controls="controls">
</video>

AttributeValueDescription
audiomutedDefining the default state of the the audio. Currently, only "muted" is allowed
autoplayautoplayIf present, then the video will start playing as soon as it is ready
controlscontrolsIf present, controls will be displayed, such as a play button
heightpixelsSets the height of the video player
looploopIf present, the video will start over again, every time it is finished
posterurlSpecifies the URL of an image representing the video
preloadpreloadIf present, the video will be loaded at page load, and ready to run. Ignored if "autoplay" is present
srcurlThe URL of the video to play
widthpixelsSets the width of the video player

Support
FormatIEFirefoxOperaChromeSafari
OggNo3.5+10.5+5.0+No
MPEG 49.0+NoNo5.0+3.0+
WebMNo4.0+10.6+6.0+No


<audio src="song.ogg" controls="controls">
</audio>

AttributeValueDescription
autoplayautoplaySpecifies that the audio will start playing as soon as it is ready.
controlscontrolsSpecifies that controls will be displayed, such as a play button.
looploopSpecifies that the audio will start playing again (looping) when it reaches the end
preloadpreloadSpecifies that the audio will be loaded at page load, and ready to run. Ignored if autoplay is present.
srcurlSpecifies the URL of the audio to play

Support
FormatIE 9Firefox 3.5Opera 10.5Chrome 3.0Safari 3.0
Ogg VorbisNoYesYesYesNo
MP3YesNoNoYesYes
WavNoYesYesYesYes


No comments:

Post a Comment