Background music browser implementations summary

1, [use] audio background music
which is actually very simple, just
join such a sentence on ok between the head html:

    <audio id="music" controls="controls" autoplay="autoplay" loop="loop"> 
            <source src="mp3/benxi-StillBelieve.mp3" type="audio/mpeg"> 
    </audio>

autoplay
If this attribute is present, the audio playback immediately after the ready.
controls
if the property is in, then displayed to the user controls, such as play button.
loop
If this attribute is present, then whenever the audio end start playing again.
muted
provisions of the video output should be muted.
preload
If this attribute is present, the audio is loaded when the page is loaded and ready to play.
If you use the "autoplay", this attribute is ignored.

Then you will find very ideals
Google browser:
Background music browser implementations summary

IE browser 11

Background music browser implementations summary

9/10 IE browser interface

Background music browser implementations summary

IE8 and below do not support H5

2, [use] bgsound play background music
is worth noting that bgsound only IE browser support, the rest browser does not support.
[Lower version of IE is also supported, but there is no interface]
wording is simple

<head>
        <meta charset="UTF-8">
        <script type="text/javascript" src="../../js/jquery.js" ></script>
        <title>背景音乐</title>
        <bgsound src="mp3/benxi-StillBelieve.mp3" loop="infinite">
</head>

[Use] the
balance
of the property values in the -10,000 to +10,000, which determines how the volume distribution between the speakers.
loop
This attribute indicates the number of times audio is played, is a numerical value or the keyword infinite.
src
This attribute defines the URL of an audio file, you must be one of the following formats: .wav, .au, .mid
Volume
of the property range is -10,000 to 0, which determines the volume of the background music.

3, using the embed [background music]
we add the label code is in the same position:

<head>
        <meta charset="UTF-8">
        <script type="text/javascript" src="../../js/jquery.js" ></script>
        <title>背景音乐</title>
        <embed src="mp3/benxi-StillBelieve.mp3"  autostart="true" loop="true">
    </head>

Then you will find, IE browser calls are windows play and can play audio not all open. Google interface is this:

Background music browser implementations summary

And audio tags have great similarity.

4, using the [video] to play background music
video This tag can also play video,

    <video src="mp3/benxi-StillBelieve.mp3" autoplay loop controls="controls"></video>

谷歌中的界面是这样的:

Background music browser implementations summary

IE8及以下不支持H5,9+中的界面有点意思。
可以隐藏、放大之类的。

Background music browser implementations summary

Guess you like

Origin blog.51cto.com/13479739/2414571
Recommended