Solved

Controlling PremiumBeat mp3 player from JavaScript

Posted on 2011-10-01
5
685 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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…
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

744 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

11 Experts available now in Live!

Get 1:1 Help Now