PDA

View Full Version : Audio Player in a Window fails to play


doke01
06-20-2007, 07:37 PM
I have a strange issue. I have an audio player set up in a window. If I open the window an mp3 file starts to download and play, which is great! If I close the window before the mp3 file downloads completely and re-open it again the mp3 file will sometimes play but usually fails completely. If I close the window and open it again the mp3 player will always fail to start playing or even downloading the mp3.

I use the following code to completely close the window and I think that the audio player is not completely closing down when I do this because when I refresh the browser everything works fine again.


<method name="close" event="close">
Debug.write("!!!!! Close event fired.");
LzModeManager.release(this.parent);
this.parent.destroy();
</method>

Any suggestions on closing down the audio player completely when the window closes would be appreciated or if anyone else has had this problem it would be great to hear your solution.

Thanks,

Doug

doke01
06-20-2007, 07:42 PM
I am running on 3.4.0. Here is the audio player code:

<!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Audio Player XXXXXXXXXXXXXXXXXXX -->
<view id="audioplayer" play="false" visible="true" y="0" x="0" width="140" bgcolor="${canvas.c8}"
>
<attribute name="vol" value="100" />
<simplelayout axis="y" spacing="1" />
<view >
<simplelayout axis="x" spacing="2" />

<button width="27" height="25" onclick="audioplayer.stop()" >
<view resource="images/media-playback-stop.png" y="4" align="center"/>
</button>
<button width="27" height="25" onclick="audioplayer.play()" >
<view resource="images/play_up.png" y="4" align="center"/>
</button>

</view>

<simplelayout axis="x" spacing="10"/>

<view name="background" bgcolor="black" width="138" height="12" x="0" y="30" options="ignorelayout;">
<view name="loadbar" resource="images/audio_scrubtrack.png"
width="${audioplayer.loadperc * 100}" >

<view name="loadingmp3" x="50" >
<text fontsize="8">
Loading...
</text>
</view>

<view name="loadbarprog" resource="images/audio_prog.png" x="2"
stretches="width"
width="${audioplayer.loadperc * (parent.parent.width-2)}"
valign="middle"/>



<view name="playbar" resource="images/audio_scrubber.png" y="1"
x="${Math.round(120 * audioplayer.frame/audioplayer.totalframes)}" />
</view>
</view>



If the progress bar is not at 100% and the window is closed when you re-open it the player will fail to download or play.

Doug

doke01
06-21-2007, 12:21 PM
It looks like this may be the answer:

http://forum.openlaszlo.org/showthread.php?t=8150&highlight=close+window

I'll check it out and let everyone know.