Ok, this might do it, but just to check:
I'm looking for a way to stream a dynamically specified MP3 file. I've
got the videoview working with an FLV, but can't seem to get it working
with an MP3.
So, I guess I have two questions:
1. The docs all talk about a videoview in terms that seem to suggest
that videoviews can stream and play MP3's. Is this true? If so, how is
it done?
2. If I attach an MP3 as a resource to a regular view, will the file be
streamed? (i.e. does playback begin while the file is partially loaded,
or do we have to wait for the resource to be loaded in its entirety)
2.a. If a regular view /does/ support streaming, then what makes a
videoview different with respect to MP3 download and playback?
Thanks! :)
-Rich
Henry Minsky wrote:
There's an audio example in examples/music/music.lzx , which uses a
plain old view to fetch an audio mp3 file
<view id="audioplayer" play="true" y="40"
resource="http:music.mp3"
oninit="new LzDelegate( this, 'lastoff', this, 'onlastframe');
new LzDelegate( this, 'stopped', this, 'onstop')">
<attribute name="vol" value="100" />
<view>
<simplelayout axis="x" spacing="-1" />
<button width="40" onclick="audioplayer.play(1);" >
<view resource="icons/rewind_all.png" y="6" align="center"/>
</button>
<button width="40" onclick="audioplayer.seek( -2 );" >
<view resource="icons/rewind.png" y="6" align="center"/>
</button>
<button width="40" onclick="audioplayer.stop()" >
<view resource="icons/stop.png" y="6" align="center"/>
</button>
<button width="40" onclick="audioplayer.play()" >
<view resource="icons/play.png" y="5" align="center"/>
</button>
<button width="40" onclick="audioplayer.seek( 2 );" >
<view resource="icons/fastfwd.png" y="6" align="center"/>
</button>
</view>
<view>
<simplelayout axis="x" spacing="-1" />
<button width="40" onclick="audioplayer.setVolume(
audioplayer.getVolume() -10)">
<view resource="icons/quieter.png" y="5" align="center"/>
</button>
<button width="40" onclick="audioplayer.setVolume(
audioplayer.getVolume() +10)">
<view resource="icons/louder.png" y="5" align="center"/>
</button>
<button width="40" onclick="audioplayer.setPan(
audioplayer.getPan() - 10 );" >
<view resource="icons/pan_left.png" y="5" align="center"/>
</button>
<button width="40" onclick="audioplayer.setPan(
audioplayer.getPan() + 10 );" >
<view resource="icons/pan_right.png" y="5" align="center"/>
</button>
</view>
<simplelayout axis="x" spacing="10"/>
<method name="lastoff">
Debug.write("Got last");
</method>
<method name="stopped">
Debug.write("Got stopped");
</method>
<view name="background" bgcolor="black" width="202"
height="15" y="50" options="ignorelayout;">
<view name="loadbar" resource="icons/audio_scrubtrack.png"
width="${audioplayer.loadperc * 200}" >
<view name="playbar" resource="icons/audio_scrubber.png" y="1"
x="${Math.round(180 *
audioplayer.frame/audioplayer.totalframes)}" />
</view>
</view>
</view>
On 9/21/07, Rich Christiansen <[EMAIL PROTECTED]> wrote:
Hey, all!
For some reason, I can use a videoview to view a streaming FLV just fine.
However, I can't seem to get it to work with an MP3. I've tried using a
simple videoview, a videoview with an embedded mediastream, using a file on
localhost, using files on a remote server, etc. Nothing I do seems to help.
From my tests, the files are loading fine, I just can't get them to play.
I've uploaded an MP3 to a public-facing server for a simple test. Please
give this test harness a shot:
<canvas width="100%" height="100%" debug="true">
<simplelayout axis="y"/>
<videoview name="video" autoplay="true">
<!-- <mediastream name="stream"
url="http://localhost:8080/lps-4.0.2/track4.mp3"> -->
<mediastream name="stream"
url="http://featurific.com/files/tmp/shiver.mp3">
<handler name='onprogress'>
Debug.write("PROGRESS! " + progress)
if(progress==1)
{
Debug.write("Come on, play!")
play()
}
</handler>
<handler name='onrequest'>
Debug.write("REQUEST!")
</handler>
<handler name='onurl'>
Debug.write("URL!")
</handler>
<handler name='onload'>
Debug.write("LOAD!")
</handler>
</mediastream>
</videoview>
<!-- <videoview
url="http://featurific.com/files/tmp/shiver.mp3"
autoplay="true"/> -->
<!-- <videoview
url="http://site.airgundepot.com/video/agd.flv"
autoplay="true" width="800" height="600"/> -->
<!-- <videoview
url="http://site.airgundepot.com/video/agd.flv"
autoplay="true">
<animator name="movex" attribute="x" to="300" duration="5000"
start="true"/>
<animator name="movey" attribute="y" to="300" duration="7000"
start="true"/>
</videoview> -->
</canvas>
As a side-note, I've been able to find examples of using a videoview with a
.flv file. However, I can't find any code examples on the net of someone
using a videoview with an MP3 file to provide just audio alone. So strange
for a feature that seems so powerful! (The original laszlo killer-app
(Pandora) relied profoundly on this feature, right? Surprising...)
Anyway, thanks in advance for your help! :)
-Rich
P.S. THis is my first post to the email group. Which is better for
questions like this - the email group or the forums on the website? I'd
imagine turnaround time is shorter here, and the discussion is still indexed
somewhere as Google-fodder, right?