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

Advertisements

Sr. Software Engineer

Tagged with: , , , , ,
Posted in Drupal
24 comments on “How Implement The Audio Player For Drupal Mobile Site?
  1. Magdalena says:

    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. Barb says:

    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. Katrice says:

    Very quickly this web site will be famous among all
    blog viewers, due to it’s nice articles

  5. Camille says:

    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.

  6. Leta says:

    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

  7. Teresa says:

    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.

  8. Zora says:

    Everything is very open with a clear explanation of the
    issues. It was really informative. Your site is useful.

    Thank you for sharing!

  9. Hwa says:

    If some one needs expert view about blogging afterward i propose him/her to go to see this web
    site, Keep up the good work.

  10. Hulda says:

    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

  11. Lourdes says:

    Magnificent site. Lots of useful info here.

    I am sending it to a few buddies ans additionally sharing in delicious.
    And obviously, thank you to your sweat!

  12. Hunter says:

    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.

  13. Christin says:

    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.

  14. Roseanna says:

    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 😉

  15. Chante says:

    Hi, everything is going fine here and ofcourse every one is
    sharing information, that’s truly good, keep up writing.

  16. Zachary says:

    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!

  17. Corey says:

    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!

  18. I do not еven ҝnοw Һow I ended upp hеre, but I thought thіs post աas ɡood.
    Ӏ don’t know who yoou are bսt defiոitely үοu’гe goiոg to a famous blogger іf you are nott
    alrеady 😉 Cheers!

  19. Callum says:

    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!

  20. Hello, after reading this awesome article i am too cheerful to share my knowledge here
    with friends.

  21. 7EKjrOHS9x says:

    Healing’s Dragon

    to uncover issues to further improve my web site!I suppose its alright for making utilization of a number of of the ideas!!

  22. 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?

  23. Tammy this a wonderful blog put up! It is so nice when people today appreciate all that you do.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: