Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Controlling PremiumBeat mp3 player from JavaScript

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The goal of the tutorial is to teach the user how to how to record live broadcast.

829 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