Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sound Drops in FLVPlayback Bug?

64 views
Skip to first unread message

rob day

unread,
Aug 2, 2008, 10:25:54 AM8/2/08
to
I posted this in the AS 3 forum awhile back and got no response. I'm building a
video player with AS3 that changes clips via activeVideoPlayerIndex and
visibleVideoPlayerIndex. For some reason when I change the player index, the
sound gets dropped. If I trace the volume it shows as 1, so it's like the sound
portion of the clip is not streaming. I thought it was something in my code and
tried some code (below) from Adobe's help page with the addresses to a couple
of my clips and the same thing happens. If you run this code, when the active
player changes on the cue point the sound drops even though the volume is
tracing as 1. The problem also occurs when I point to clips on my local
computer.

//Requires: - FLVPlayback component on the Stage with an instance name of
my_FLVPlybk
// add a cue point to the default player
// add a cue point to the default player
import fl.video.*;
my_FLVPlybk.source =
"rtmp://sas-Flash.OnstreamMedia.com/ondemand/FlashDMSP/latitudeinc/MTV Mall
World/LadiesMan.flv";
my_FLVPlybk.addASCuePoint(10, "1st_switch");
my_FLVPlybk.addEventListener(VideoEvent.READY, ready_listener);
function ready_listener(eventObject:VideoEvent):void {
// add a second video player and create a cue point for it
my_FLVPlybk.activeVideoPlayerIndex = 1;
my_FLVPlybk.source =
"rtmp://sas-Flash.OnstreamMedia.com/ondemand/FlashDMSP/latitudeinc/Hills/ChooseO
rg.flv";
my_FLVPlybk.addASCuePoint(10, "2nd_switch");
my_FLVPlybk.activeVideoPlayerIndex = 0;
};
// add listener for a cuePoint event
my_FLVPlybk.addEventListener(MetadataEvent.CUE_POINT, cp_listener);
// add the handler function for the cuePoint event
function cp_listener(eventObject:MetadataEvent):void {
// display the no. of the video player causing the event
trace("Hit cuePoint event for player: " + eventObject.vp);
// test for the video player and switch FLV files accordingly
if (eventObject.vp == 0) {
my_FLVPlybk.pause();//pause the first FLV file
my_FLVPlybk.activeVideoPlayerIndex = 1;// make the 2nd player active
my_FLVPlybk.visibleVideoPlayerIndex = 1;// make the 2nd player visible
my_FLVPlybk.play();// begin playing the new player/FLV
} else if (eventObject.vp == 1) {
my_FLVPlybk.pause();// pause the 2nd FLV
my_FLVPlybk.activeVideoPlayerIndex = 0;// make the 1st player active
my_FLVPlybk.visibleVideoPlayerIndex = 0;// make the 1st player visible
my_FLVPlybk.play();
}// begin playing the 1st player
}

my_FLVPlybk.addEventListener(VideoEvent.COMPLETE, complete_listener);
function complete_listener(eventObject:VideoEvent):void {
trace("Hit complete event for player: " + eventObject.vp);
if (eventObject.vp == 0) {
my_FLVPlybk.activeVideoPlayerIndex = 1;
my_FLVPlybk.visibleVideoPlayerIndex = 1;
my_FLVPlybk.play();
} else {
my_FLVPlybk.closeVideoPlayer(1);
}
}


//trace audio volume
my_FLVPlybk.addEventListener(MetadataEvent.METADATA_RECEIVED, Loaded);

function Loaded(event:MetadataEvent):void {
trace(my_FLVPlybk.metadata.audiodatarate);
}

my_FLVPlybk.addEventListener(VideoEvent.PLAYING_STATE_ENTERED, isplaying);

function isplaying(e:VideoEvent):void {
trace(my_FLVPlybk.volume);
}

JSavageDesign2

unread,
Aug 21, 2008, 9:37:25 AM8/21/08
to
This happens for me as well. I can't figure it out.

I can add that (using the code by rob day) that

my_FLVPlybk.soundtransfom.volume = 0;

and it can't be changed.

rob day

unread,
Aug 21, 2008, 4:18:28 PM8/21/08
to
I figured it out, you have to mute the player then reset the volume to 1:

import fl.video.*;
my_FLVPlybk.source =
"rtmp://sas-Flash.OnstreamMedia.com/ondemand/FlashDMSP/latitudeinc/History/05Wri
tingTheDeclOfIndepence_H264.flv";
my_FLVPlybk.addASCuePoint(40, "1st_switch");


my_FLVPlybk.addEventListener(VideoEvent.READY, ready_listener);
function ready_listener(eventObject:VideoEvent):void {

my_FLVPlybk.activeVideoPlayerIndex = 1;
my_FLVPlybk.source =
"rtmp://sas-Flash.OnstreamMedia.com/ondemand/FlashDMSP/latitudeinc/Hills/ChooseO
rg.flv";
my_FLVPlybk.addASCuePoint(10, "2nd_switch");
my_FLVPlybk.activeVideoPlayerIndex = 0;

my_FLVPlybk.bufferTime=6;
}

my_FLVPlybk.addEventListener(MetadataEvent.CUE_POINT, cp_listener);

function cp_listener(eventObject:MetadataEvent):void {


if (eventObject.vp == 0) {
my_FLVPlybk.pause();

my_FLVPlybk.volume=0;//mute the player


my_FLVPlybk.activeVideoPlayerIndex = 1;
my_FLVPlybk.visibleVideoPlayerIndex = 1;
my_FLVPlybk.play();

my_FLVPlybk.volume=1;// set the volume
my_FLVPlybk.bufferTime=6;


} else if (eventObject.vp == 1) {
my_FLVPlybk.pause();

my_FLVPlybk.volume=0;
my_FLVPlybk.activeVideoPlayerIndex = 0;
my_FLVPlybk.visibleVideoPlayerIndex = 0;
my_FLVPlybk.play();
my_FLVPlybk.volume=1;
my_FLVPlybk.bufferTime=6;
}
}

my_FLVPlybk.addEventListener(VideoEvent.COMPLETE, complete_listener);
function complete_listener(eventObject:VideoEvent):void {

if (eventObject.vp == 0) {
my_FLVPlybk.volume=0;


my_FLVPlybk.activeVideoPlayerIndex = 1;
my_FLVPlybk.visibleVideoPlayerIndex = 1;
my_FLVPlybk.play();

my_FLVPlybk.volume=1;
} else {
my_FLVPlybk.closeVideoPlayer(1);
}
}

0 new messages