I have a video that is an swf file with length 03:02 (3 minutes & 2 seconds) 4552 Frames.
Now in different timing of this video I want to synch 4 audio files.
Is there any possibility to synchronize all sounds on the video?
My audio files must be placed in exactly positions. For example the second audio must be loaded at 01:27:30.
I have extended my timeline to 4552 frames (03:02) and I am using the code below in different frames to load my audio files:
var soundClip:Sound=new Sound();
//Create a new SoundChannel Object
var sndChannel:SoundChannel=new SoundChannel();
//Load sound using URLRequest
soundClip.load(new URLRequest("secondsound.mp3"));
sndChannel=soundClip.play();
And if there is a way to synch my audio files is there any possibility to preload the whole movie with all sounds and with my .swf file?
track the netstream time property and call your sounds when the video reaches the times you want to hear them.
Related
After recording a sound and converting it into wav...
var enco:WaveEncoder=new WaveEncoder();
var o:ByteArray=enco.encode(soundO,1,16,44100);
I pass it to ShineMP3Encoder
_mp3_encoder = new ShineMP3Encoder(o);
_mp3_encoder.addEventListener(Event.COMPLETE, onMP3EncoderComplete, false, 0, true);
_mp3_encoder.start();
onMP3EncoderComplete has two vars
var mp3:ByteArray = _mp3_encoder.mp3Data;
var wav:ByteArray = _mp3_encoder.wavData;
wav audio is normal, but mp3 almost always (99%) has a clicking sound when audio begins.
Here's a picture from SoundForge app.
We can see these two files are identical, but mp3 has a clicking sound at the beginning.
Is it my system/hardware/compiler problem or it's something else?
btw I tried some online swf example of ShineMP3Encoder and it has same issue. So probably that's not my compiler problem
I'm trying to achieve seamless looping of an MP4 (or M4A to be more specific) sound. The usual method of loading, playing to the end, and then seeking to position zero causes a small delay (less than a second) before the second playback begins.
So now I'm trying to preload the sound data and then use NetStream.appendBytes() to append the whole sound data at the end of the original sound, expecting the sound to repeat once. But first, I want to be able to play the sound just once using the appendBytes() method. Here is the code I wrote that doesn't give any errors but doesn't play a sound either:
var data:ByteArray = new SoundData; // SoundData class contains the embedded M4A file data
var connection: NetConnection = new NetConnection();
connection.connect(null);
var stream: NetStream = new NetStream(connection);
stream.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
stream.client = {};
function onNetStatus(event:NetStatusEvent): void {
trace(event.info.code, stream.time, stream.bytesLoaded, stream.bytesTotal);
}
stream.play(null);
stream.appendBytesAction(NetStreamAppendBytesAction.RESET_BEGIN);
stream.appendBytes(data);
Am I using appendBytes() correctly?
I ended up using a hack for achieving apparent seamless looping: loading two sound files through NetStream, playing one, and 100ms before its end, starting to play the other.
When I am streaming a video (using RTMP) in my flash player (AS3) - the frames I see are colored [b]a bit [/b] differently than the frames in the original video !
I would like to somehow save the frames I am showing in my player to an image sequence,
so that I can examine it and understand the difference between each frame I was showing from the stream to the original frame in the original video.
How can this be achieved ? (the video is 5 minutes long, and has 25 frames-per-second).
First you should set the following flags on the fms script, which allows you to access the streaming video or audio.
application.onConnect = function(client,....)
{
...
client.audioSampleAccess = "/";
client.videoSampleAccess = "/";
}
Secondly on the client side, you may use the BitMapData.draw method to capture the video from the VideoDisplayObject
var snapshot:BitmapData = new BitmapData(video.width, video.height);
snapshot.draw(videoDisplay);
I want to dynamically load .swf file in a player(like FLV player of as3) in as3.When I shall click on an image the corresponding video will be played on the player on right side(like you tube). Is there something (like FLV player) for .swf files with play, pause, resume, scrubber options to play in web?
You can start with AS3's Loader Class, which will allow you to load and place SWF files in your application.
Controlling the loaded swf's position is going to be a bit trickier, and you may need to have a Movie Clip with a specific linkage name in the .swf, from which you can create an instance in your code and control with the standard MovieClip timeline commands. You should be able to create some controls that work with gotoAndPlay/gotoAndStop/etc
There are a lot of AS3 video players out there. Here is a tutorial that lets you create one. Once you create your FLVPlayer, you can load it using a Loader object.
I think this does what you are looking for.
var SWFLoader:Loader=new Loader();
screen_mc.addChild(SWFLoader);
function loadSWF(evt:MouseEvent):void{
if (evt.target==one_btn){
SWFLoader.load(new URLRequest("one.swf"));
}
else if (evt.target==two_btn){
SWFLoader.load(new URLRequest("two.swf"));
}
}
one_btn.addEventListener(MouseEvent.CLICK,loadSWF);
two_btn.addEventListener(MouseEvent.CLICK,loadSWF);
I am trying to stop the audio of the video swf and I can't get it to stop. Here is my code for loading the file:
var myLoader:Loader= new Loader();
myLoader.x=420;
myLoader.y=200;
// boolean variable set for use below in our function
var screenCheck:Boolean = false;
//These three linces keep stafe elements the same size, so they don't distort
var swfStage:Stage = this.stage;
video_btn.addEventListener(MouseEvent.CLICK,contentvideo);
function contentvideo (event:MouseEvent):void{
myLoader.load(new URLRequest("prevideo.swf"));
addChild(myLoader);
movie_btn.stop();
movie_btn.visible=false;
}
Now I have other functions that load different URLRequest and when they are loading, the audio keeps playing. Do I have to add a line of code to them? I also have an MP3 player and tried SoundMixer.stopAll(). I still need the mp3 player to keep playing.
I'm not familiar with what you're doing but just looking at the code and given the problem you're experiencing I wonder if that
addChild(myLoader);
has anything to do with it. It seems like the kind of thing that could easily create multiple child objects which is why you continue to experience the sound play back. Is there a removeChild[0] option or something?
A shot in the dark I know but I thought I'd offer the possibility anyway.