PDA

View Full Version : Adding volumecontrol buttons for mpg-videos?


Schmidl
04-19-2004, 09:06 AM
Hello,

in my project I added volume control buttons for mp3 sounds played over the background_channel, which work fine.

Now I want to have the same control for the sound of mpeg-videos shown in the videoplayer. On which channel is the sound of the movies? Or is this not possible at all?

Thank you!
Schmidl

yosik
04-19-2004, 09:59 AM
From the help file:


Video.SetVolume (
string ObjectName,

number Volume )


Description
Sets the volume level of a video object.

Parameters
ObjectName
(string) The name of the video object.

Volume
(number) The volume level represented by a number between 0 and 100. The value 0 is silent and 100 is the loudest.

I think this is self-explanatory.

Good Luck,
Yossi

Schmidl
04-26-2004, 08:03 AM
Thank you for the hint,

maybe I explained it wrong: I added buttons (+) and (-) for the volume control of mp3s. These mp3s run on the BACKGROUND_CHANNEL, so i.e the + button has on the action-tab:

audio_channel = CHANNEL_BACKGROUND;
Audio.SetVolume(audio_channel, Audio.GetVolume(audio_channel)+20);

And I want exactly these two buttons for the volume control of a video played via a video object while it is running. But on which channel is the sound of a video to adapt the buttons? I know how to set the basic volume of a video, like you described, I want to change the volume while the video plays.

Thanks again
Schmidl

Schmidl
05-04-2004, 09:24 AM
Hi,

is really nobody able to help me with that :wow?

Schmidl

Adam
05-04-2004, 11:29 AM
Schmidl,

Please use this code assuming that you have a video on your page named "video 1":

For the - button:
-- get the current volume
volume = Video.GetVolume("Video1");
-- if volume is greater than 10
if ((volume - 10) > 0) then
-- set the volume down a notch
Video.SetVolume("Video1", volume -10);
end

For the + button:
-- get the current volume
volume = Video.GetVolume("Video1");
-- if volume is less than 100
if ((volume + 10) < 100) then
-- set the volume up a notch
Video.SetVolume("Video1", volume +10);
end

I hope this helps.

Adam Kapilik

Schmidl
05-05-2004, 09:53 AM
Hello Adam,

thank you, it really helps :p! I never came on that on my own :rolleyes.

And, sorry, another thing: Is there a way to adapt the "Toggle.Play" function with the video sound as well? For normal audio I use "Audio.TogglePlay(CHANNEL_BACKGROUND);"

Thank you again!
Schmidl

JRuoto
06-22-2004, 11:57 AM
Hello, I recently found this post and it pointed me in the right direction as far as needing to toggle the music which is in a video file on and off - this thread talked about decreasing or increasingt he volume - by taking that concept I was able to "jimmy-rig" a toggle on/off for the audio. In my case I used the checkbox found in the special folder and applied the follow action:
-- get the current volume
volume = Video.GetVolume("VIDEO_NAME");
-- if volume is greater than 10
if ((volume - 10) > 0) then
-- set the volume to 0
Video.SetVolume("VIDEO_NAME", 0);
else
-- if volume is muted or O
-- set the volume to 100
Video.SetVolume("VIDEO_NAME", 100);
end
<<>>
I am posting this here, though I know it is an old thread in hopes that it may be helpful to others looking to do what I did. Thank you for your help!