gvhung / as3mp3streamplayer

Automatically exported from code.google.com/p/as3mp3streamplayer
0 stars 0 forks source link

how to change the volume #13

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. play a stream
2. try to change the volume
3.

What is the expected output? What do you see instead?

Hi I am trying to change the volume (eventually using a volume slider)
the MP3StreamPlayer.soundChannel is read only, how to use soundTransform?

What version of the product are you using? What player environment did you
test in? What version?

latest one, in flash CS4.

Please provide any additional information below.

Original issue reported on code.google.com by steven.j...@gmail.com on 9 Jan 2010 at 10:26

GoogleCodeExporter commented 9 years ago
mp3streamplayer.soundChannel.soundTransform.volume = 0.5; // 50%

Original comment by martn.1...@googlemail.com on 18 Jan 2010 at 4:34

GoogleCodeExporter commented 9 years ago
This is the code I am using (to test it):

import fly.sound.*
import fly.sound.shoutcast.*
import fly.sound.events.*

var ssp:MP3StreamPlayer = new MP3StreamPlayer() 
ssp.playStream("http://scfire-ntc-aa06.stream.aol.com:80/stream/1039")
ssp.soundChannel.soundTransform.volume = 0.0; // 50%

The error I receive is:

TypeError: Error #1009: Cannot access a property or method of a null object 
reference.
    at Untitled_fla::MainTimeline/frame1()

Original comment by steven.j...@gmail.com on 19 Jan 2010 at 8:32

GoogleCodeExporter commented 9 years ago

If you want to change the volume, try this:

var myPlayer:MP3StreamPlayer = new MP3StreamPlayer();;
var myChannel:SoundChannel = myPlayer.soundChannel;
var mySoundTransform:SoundTransform = myChannel.soundTransform;
mySoundTransform.volume = 0.5;
myChannel.soundTransform = mySoundTransform;

Original comment by clenn.m...@gmail.com on 7 Apr 2010 at 10:22

GoogleCodeExporter commented 9 years ago
It won't work.  You can change wolume only after the playback is started. It 
can be done with this code:

var stream:MP3StreamPlayer = new MP3StreamPlayer();
stream.addEventListener(Event.COMPLETE, completeHandler);
stream.playStream('http://stream_address/');

function completeHandler(e:Event)
{
    var stream:MP3StreamPlayer = e.target;
    var mySoundTransform:SoundTransform = stream.soundChannel.soundTransform;
    mySoundTransform.volume = Std.parseFloat(params.volume);
    stream.soundChannel.soundTransform = mySoundTransform;
}

Original comment by Jacek.Je...@gmail.com on 28 Jun 2010 at 1:32