Solved

Controlling PremiumBeat mp3 player from JavaScript

Posted on 2011-10-01
5
693 Views
Last Modified: 2012-05-12
Does anyone know how I can control the PremiumBeat Multiple Tracks mp3 player from JavaScript?  I'd like to issue a play() command, and better still, a play(n) command where n is the nth song in the xml playlist.

Thanks for any ideas.
Steve
0
Comment
Question by:steva
  • 3
  • 2
5 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 36897356
http://www.premiumbeat.com/flash_music_players

Hello steva,

To allow javascript to interact with flash function you need to have somee function with ExternalInterface class in the flash program :
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html
http://www.switchonthecode.com/tutorials/flex-javascript-basics-using-externalinterface

You don't have theses classes inside the PremiumBeat mp3 player so you can't control the player with javascript.

You may use an other flash player :
http://flowplayer.org/plugins/streaming/audio.html
http://www.longtailvideo.com/players/jw-flv-player/

Best Regards
0
 

Author Comment

by:steva
ID: 36898117
Hi Leakim,

Yes, I'm aware of the ExternalInterface and that was my concern, that the PremiumBeat player hadn't enabled it and so there would be no way to control the player from JavaScript.  Recall that you and I went through this a couple of years ago when I needed to control a Flash video player from JavaScript and I ended up writing my own player with the ExternalInterface enabled.  I suspect I will end up converting that player now to an audio player to get the job done.

How did you know that the PremiumBeat player didn't have ExternalInterface enabled?  I was just guessing.

One more thing.  I liked the PremiumBeat player because the sound was superb, but I'm thinking that the sound quality of a Flash mp3 player  is really up to codecs in Flash and so any mp3 player I do with the latest Flash would  have the same excellent sound, as long as I feed it a 256kbs, or higher, mp3.  Is that your understanding?

Good to talk to you again.

Steve






0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 36898185
>How did you know that the PremiumBeat player didn't have ExternalInterface enabled?  I was just guessing.
You may use swf class explorer, for example : http://flassari.is/2008/07/swf-class-explorer-for-as3/

Concerning the quality of the sound, I'm sure other flash players can provide same quality, each player is "only" a set of function, templates and graphics, the adobe flash plugin itself do the job of playing the song.

If you really want to use the premiumbeat plugin, I saw it's difficult to protect file from decompiling : http://active.tutsplus.com/tutorials/workflow/protect-your-flash-files-from-decompilers-by-using-encryption/
0
 

Author Comment

by:steva
ID: 36899050
Thanks for the information, Leakim.

Yes, I've verified that other players have the same quality as the PremiumBeat player, including QuickTime.  You just have to give them all a  256kbps mp3 to get the quality.

My reason for using Flash was so that I could control the player from JavaScript, once I built a player with the ExternalInterface class.  But it turns out that the Quick Time player can already be controlled from JavaScript. And since it's quality is as good as Flash, that's the route I'm taking. Plus, it has excellent documentation from Apple.

Thanks for the discussion, Leakim.  I gave you the points.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36899255
Thank you, have a nice sunday, see you soon.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now