Jump to content

Recommended Posts

Posted

Hi

 

I have seen play WAV

 

<script>
 var audio2 = document.createElement('audio');
 audio2.setAttribute('src', 'files/Inicio.wav');
 audio2.play();
</script>

 

But how I can plays back MP3?

 

Thanks

Posted

Thanks Farshad

 

But I need to play sound in IE 8. I need to control the sound from the program: play and stop.

 

Can you help me please. JavaScript world is completely unknown to me.

 

Thank you very much.

Javi

Posted

Thanks Anders Andersen.

 

But how I can control the player from UniGui?

I had a bit of a look and this player seems to be very easy to use.

 

From the documentation all you do is use this html code:

 

<object type="application/x-shockwave-flash" data="player_mp3_mini.swf" width="200" height="20">
    <param name="movie" value="player_mp3_mini.swf" />
    <param name="bgcolor" value="#ff0000" />
    <param name="FlashVars" value="mp3=test.mp3" />
</object>

 

Just put the flash file somewhere in the files folder and put the code above in a UniHTMLFrame. Should be pretty easy.

Posted

Hello again.

 

I managed to run the code in Firefox, but not IE8.

 

Can you help again? Thank you very much.

Javi

 

TUniHTMLFrame.Html

 

<object class="playerpreview" id="myFlash" type="application/x-shockwave-flash" data="/files/player_mp3_js.swf" width="200" height="20">
   <param name="movie" value="player_mp3_js.swf" />
   <param name="bgcolor" value="#ff0000" />
   <param name="FlashVars" value="mp3=/files/TresCerditos.mp3" />       
</object>

 

procedure TMainForm.UniButtonPlayClick(Sender: TObject);
begin
 WebForm.JSCode('document.getElementById("myFlash").SetVariable("method:play", "");');
end;

procedure TMainForm.UniButtonStopClick(Sender: TObject);
begin
 WebForm.JSCode('document.getElementById("myFlash").SetVariable("method:stop", "");');
end;

Posted

Finally works!!

 

TUniHTMLFrame.Html

 

<object class="playerpreview" id="myFlash" type="application/x-shockwave-flash" data="/files/player_mp3_js.swf" 
width="200" height="20">
   <param name="movie" value="/files/player_mp3_js.swf" />
   <param name="bgcolor" value="#ff0000" />
   <param name="FlashVars" value="mp3=/files/TresCerditos.mp3" />       
</object>

 

 

This was the error

 

<param name="movie" value="/files/player_mp3_js.swf" />

 

 

Thank you very much Anders Andersen.

  • 2 weeks later...
Posted

I folks,

 

 

I have used something like:

 

//

// Set TextConversion property at TUniLabel component to txtHTML

//

lbURL.TextConversion := txtHTML

lbURL.Caption := '<object type="application/x-shockwave-flash" data="./mp3player.swf" width="200" height="20">' +

'<param name="movie" value="./mp3player.swf" />' +

'<param name="FlashVars" value="mp3=./temp/music.mp3&showslider=1&width=200&height=20&autoplay=0&showinfo=0" />' +

'</object>';

 

As you can see I just used a block of code inside a TUniLabel Component.

 

The player I use is found in http://flash-mp3-player.net/medias/

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...