How Implement The Audio Player For Drupal Mobile Site?

Hello Everyone,
If you are facing the problem with audio player in you DRUPAL site then don’t worry, you have need only follow my steps for add the HTML5 Audio Player. I made the following changes to Drupal’s Audio Module:

  1. In flash player add a class and title.

    First of all you have need to edit the “1pixelout.inc” file in the audio/players/ directory (or edit the .inc file for the play you have chosen to use.).
    You have need to add the following class to the flash object tag:class=”1pixelflashplayer”and Also, need to add the following title attribute to the object tag: title=”{$options[‘soundFile’]}”.

  2. Add javascript into the page template (like page.tpl.php, page.front.tpl.php)

    The following javascript will search for all the flash players with the aforementioned class, hide them, and insert an <audio> tag after them with the src of the video from the flash player. Note: This will only work for mp3 audio files.

     <script>
    $(document).ready(function()
    {
    	try
    	{
    	  	myAudioObj = new Audio("");
    	  	audioObjSupport = !!(myAudioObj.canPlayType);
    	  	basicAudioSupport = !!(!audioObjSupport ? myAudioObj.play : false);
    	  	if (myAudioObj.canPlayType)
    	  	{
    			canPlayMp3 = ("no" != myAudioObj.canPlayType("audio/mpeg")) && ("" != myAudioObj.canPlayType("audio/mpeg"));
    		}
    	}
    	catch (e)
    	{
    	  audioObjSupport = false;
    	  basicAudioSupport = false;
    	}
    	if (canPlayMp3)
    	{
    		$('.1pixelflashplayer').each(function(index)
    		{
    			var $player = $(this);
    			$player.hide();
    			var url = $player.attr('title');
    			$player.after('<audio controls="controls" src="'+url+'" ></audio>');
    		});
    	}
    });
    </script>

I Hope this helps all my friends. :)

Enjoy Code! | Enjoy Raghunath Blog

24 Replies to “How Implement The Audio Player For Drupal Mobile Site?”

  1. I was recommended this website by means of my cousin. I
    am not certain whether this post is written by means of him as nobody else
    recognise such unique approximately my difficulty. You’re amazing!
    Thank you!

  2. Hey just wanted to give you a quick heads up. The words in
    your post seem to be running off the screen in
    Safari. I’m not sure if this is a formatting issue or something to do with internet browser compatibility but I figured I’d post to let you know.
    The design look great though! Hope you get the issue solved soon.
    Many thanks

  3. A person necessarily assist to make seriously posts I might
    state. That is the very first time I frequented your web page and up
    to now? I amazed with the research you made to create this actual put up amazing.
    Wonderful job!

  4. An outstanding share! I have just forwarded this onto a coworker
    who had been conducting a little research on this. And he actually bought me dinner simply because I stumbled upon it for him…
    lol. So allow me to reword this…. Thank YOU for the meal!!
    But yeah, thanks for spending the time to discuss this issue here on your
    blog.

  5. Excellent blog here! Also your web site loads up fast!
    What host are you using? Can I get your affiliate link to your host?
    I wish my site loaded up as fast as yours lol

  6. I am now not certain the place you are getting your info, however good topic.
    I needs to spend some time learning much more or understanding more.
    Thank you for great information I was on the lookout for this info for
    my mission.

  7. I really like your blog.. very nice colors & theme.
    Did you design this website yourself or did you hire someone to do it for you?
    Plz reply as I’m looking to design my own blog and would like to find out where u got this from.
    cheers

  8. Heya i am for the primary time here. I found this board and I in finding It truly helpful & it helped me out much.
    I’m hoping to offer one thing back and aid others such as you helped me.

  9. I got this web page from my pal who shared with me on
    the topic of this web site and now this time I am visiting
    this site and reading very informative articles at this time.

  10. I would like to thank you for the efforts you have put in penning this
    website. I’m hoping to view the same high-grade content from you later on as
    well. In fact, your creative writing abilities has inspired me to get my own, personal blog now ;)

  11. Fantastic post however , I was wondering if you could
    write a litte more on this subject? I’d be very grateful
    if you could elaborate a little bit further.
    Appreciate it!

  12. My brother recommended I may like this blog.
    He was totally right. This post truly made my day. You cann’t believe simply how a lot time I had spent for this info!
    Thank you!

  13. Hi! I could have sworn I’ve been to this blog before
    but after reading through some of the post I realized it’s new to me.
    Anyhow, I’m definitely glad I found it and I’ll be bookmarking and
    checking back frequently!

  14. Pingback: 7EKjrOHS9x
  15. I am really enjoying the theme/design of your web site.
    Do you ever run into any web browser compatibility issues?
    A small number of my blog visitors have complained about my website not operating correctly in Explorer but looks great in Firefox.
    Do you have any suggestions to help fix this problem?

Leave a Reply

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