3 Replies - 6907 Views - Last Post: 20 December 2012 - 02:29 AM

#1 candi73  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 19-December 12

background music

Posted 19 December 2012 - 09:46 PM

Hello,

I have background music on this website: beauty-4-ashes-outreach.org. I want to know if there is another code to use to have the music to play visiting the site from a cellphone and or tablet?

The code I had that didn't work was:
<object type="audio/mp3" 
        data=".mpg">
  <param name="autoplay"
         value="false">
</object>


Thanks in advance

This post has been edited by Atli: 19 December 2012 - 10:35 PM
Reason for edit:: Please use [code] tags when posting code.


Is This A Good Question/Topic? 0
  • +

Replies To: background music

#2 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3730
  • View blog
  • Posts: 6,017
  • Joined: 08-June 10

Re: background music

Posted 19 December 2012 - 10:44 PM

Hey.

What you are doing there is trying to involve a 3rd party plugin to play your audio, like the Windows Media Player plugin or the VLC plugin. Relying on that is unreliable at best, because those plugins are neither wide-spread enough to be assumed to be present, nor all that dependable in the first place. It's all very much reliant on the browser and the user. (And depending on the user tends to be a fatal error.)

To play media on your sites, the best options available are either to use a Flash player, or to use the new HTML5 media support. Each has it's own downsides thought. Flash is a 3rd party plugin, so it can't be 100% counted on, but as far as plugins go it's about as wide-spread as they get. People usually have it installed. HTML5, on the other hand, is native to the browser, but it is relatively new and not supported on old browsers. The media formats supported also vary from browser to browser, so you may have to offer multiple versions of the same media to cover them all.

If you are interested in getting audio playing on mobile devices, HTML5 is your best bet. I suggest you read this article for more details. There is also a lot of other material available on this out there.
Was This Post Helpful? 2
  • +
  • -

#3 Vompaudi  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 43
  • Joined: 23-November 12

Re: background music

Posted 20 December 2012 - 01:32 AM

You can put background music easily after <body> tag like this:
<embed src="bgsound.mp3" autostart="true" loop="true">  


Putting music on this way is not recommended. Think when you are surfing in net and it is quite late. You click some page open, and accidentally your speakers are full volume after using of headset. And if music file is large, loading of page takes very long.

More user-friendly way is to create link, where opens new window for player, and player is as quicktime plugin, where is possible adjust volume and pause the music.
Was This Post Helpful? 0
  • +
  • -

#4 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3730
  • View blog
  • Posts: 6,017
  • Joined: 08-June 10

Re: background music

Posted 20 December 2012 - 02:29 AM

View PostVompaudi, on 20 December 2012 - 08:32 AM, said:

You can put background music easily after <body> tag like this:
<embed src="bgsound.mp3" autostart="true" loop="true">  


This does essentially the same thing the OP was trying to do: invoke a 3rd party media player plugin. Like I explained, this is not a reliable method since it depends on the browser actually having a plugin installed capable of handling the embed content, which is far from a given thing.

I'd recommend against this. Instead either use HTML5 audio, or a Flash player. Things like MediaElement.js can also make things easier, if you need to support old browsers.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1