Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




How Can We Control The Sound Object Of A Video Stream From A Different Domain.



Hi All, We are quite familiar with action scripting but are facing an awkward situation. We need to call different instances of youTube Video into our own swf and play them. Now as youTube video is from a different domain, the Flash sandbox restrictions naturally come into play. We am loading the youTube swf into a clip using the MovieClipLoader Class. If we remove the instance using the removeMovieClip() command the video is removed but the sound continues. We have even tried the MovieClipLoader unloadClip() method but that too did not yield results. We wish to be able to kill the sound object or atleast mute it so that it does not play even after the movie clip containing the video is removed. As the swf belongs to a different domain we are unable to control the sound object directly through script. We have even tried loading another youTube instance into the same movie clip after first removing it using the removeMovieClip() command, then creating it again, and finally loading the youTube instance using the MovieClipLoader class, but the earlier sound still continues to play even while the second clip sound also plays. We need help guys. Any advice? Thanks to all.



KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 05-13-2007, 07:55 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Video Object Sound Control
Hello!
I was wondering what is the best way to solve this issue:

If you use the Video object to load an FLV WITH sound and before it has ended playing you load another FLV in the same Video object WITHOUT sound, then the sound of the first FLV keeps playing. This doesn't happen with the FLV Playback component.

Any suggestions?
Thanks.

Stream Sound Volume Control
my movie contains a lot of sounds and voice over. how do i control the volume of the sound(stream sound in a layer) using a slider.some one pl help
regards
suresh

Control Volume Of Sound And Set Sync=stream?
Hi everyone,

Hopefully this is an easy one...

I have a sound clip I am using as background music during my movie. Currently I have it attached to the starting frame (in the frame properties, not by AS). I have the 'sync' property set to stream so it will skip animation frames if it needs to in order to keep up with the music (timing is important).

Now that I've added a few more sounds to the movie, the background music needs to be quieter, so I thought I'd start the music via AS instead:

Code:
music = new Sound();
music.attachSound("bgMusic");
music.start();
music.setVolume(25);
But this appears to drop the sync = stream property.

How can I edit the volume but keep the sync = stream on the music?

Thanks in advance,
chris

AS3: How To Control Incoming Sound From An Audio Stream?
When I call NetStream.play() on an existing audio stream, it will start playing the audio. Is there any way I can detect the actual sound intensity the way you'd do with a Microphone object, for example? I can connect to the stream, but I can't know if there's actual sound coming out of it, and even worse, I don't even know if there's a way to know if the stream is actually valid. NetStream.play returns no value...

Playing Online Stream With Sound Object
Hi there,

few of my colleges set up online radio which we plan to develop further by allowing users to visit the site and be able to listen to the streaming without need for additional players. So far, I've managed to get MP3 stream playing but if I set audio encoding to, say, AAC it fails. Is there any way to capture AAC stream?

I know that MP3 is what we're supposed to use but considering low upload speed, for now, we have to turn to AAC.

By the way, this is my code that plays MP3 with no problem:

ActionScript Code:
Security.allowDomain("http://localhost:8081");
var req:URLRequest = new URLRequest("http://localhost:8081");
var s:Sound = new Sound();
s.load(req,new SoundLoaderContext(1000,true));
//s.addEventListener(Event.ID3,handler);
s.play();
Please notice that "localhost:8081" is just for testing purposes. I intend to replace URL with correct one.

Any idea is much appreciated! Thx!

Make Sound Object An Event Rathe Rthan A Stream?
Hi folks.

I've just used the tutorial on actionscript.org to load in audio from an external swf. tutorial

The trouble is, I'd like it to load at the start, but not start playing the audio until it hits a certain frame. I think this is to do with the sound object being a stream rather than an event??

Can anyone help me to edit the code found on the tutorial to make the audio buffer at the start, but not start playing till (let's say) frame 10???

Thanks for any help.

.stop() For Sound Object Stopping Embedded Video Sound
I have a problem where the stop funtion for a sound object is stopping the audio in an embedded video. Has anyone ever encountered this? Ihave poured over my code and there is no cross-linked intance names, so I do not have a clue what is happening.

Control Sound - Object
Hi.
I need help with flash mx in:

I need a graphic (symbol) moves when a song is playing
and ... when the song ends the object stop.

to use this maybe on mouse over or just in a scene.
thanks

Putting Video Object In Container To Control Size
I have a video object that dynamically changes. I want to put that inside of a movieclip that is always 320,240 no matter what the video object size is. I want the video object to increase or decrease but I always want to display it at 320,240. How would I write this? I tried:


ActionScript Code:
videoDisplay = new Sprite();
videoDisplay.graphics.beginFill(0xCCFF00,100);
videoDisplay.graphics.drawRect(0, 0, 320, 240);
addChildAt(videoDisplay,0);

        v = new Video();
        videoDisplay.addChild(v);

But the video object still is large (my video object is 480,360 in this case). It seems like it is not nested inside of the the videoDisplay sprite which should only be 320,240.

Control Volume Without Sound Object
You are thinking why would you need to do that? Well, I have music that has to be timed precisely to the images so it needs to be embedded in the timeline and set to stream. Any other way won't match the sounds and animation. A sound object here would play independent of my root timeline. So i can stopallsounds obviously but i dont know how i could start the sound without a sound object.

Any ideas?

Multiple Sound Object Volume Control
Hi, I was hoping somebody could answer a question for me?

In the project I'm working on there are multilpe sound objects. And I need to be able to control the volume on them all seperately. As in, "tap" is an ambient background sound for the scene, but "voiceloopa" is dialogue that is only activated (or rather the volume is increased) on rollover.

The sounds are all named as seperate objects in the first frame, and the ambient sound 'tap' is started:
============
voiceloopa = new Sound();
voiceloopa.attachSound("voiceloopa");
tap = new Sound();
tap.attachSound("tap");
tap.start(0, 1000);
============

Yet when the code to start the dialogue:
============
voiceloopa.start(0, 1000);
voiceloopa.setvolume(50);
============

is encountered, the setvolume command effects -all- the sounds (those on the timeline and sound objects) in the movie, not just "voiceloopa".

So the question is: how do I use the 'setvolume' command to only alter the volume of a specific sound object?


thanks,

-Eoin

Using Mysterious _flash Object To Control Sound
I've inherited a Flash site with multiple videos with sound embedded in external .swfs, loaded dynamically and "on-demand" (ie. when a user performs a specfic action).

The site also feats a "sound on/off"-toggle button to control control sound in all loaded (and not-yet-loaded) video-swf's.

The code to control the sound is basically


ActionScript Code:
_flash.allsound = "off";

and

ActionScript Code:
_flash.allsound = "on";


This actually works, but I can't figure out how and why!

I can find no code in the video swfs that does any kind of sound handling (everything is embedded in the stream). It is, however, somewhat inconsistent as it doesn't seem to work everywhere it's being used.

As I understand it, _flash is a (undocumented) top-level object in which every object resides (even _level0). But information on this is sparse, and I have found no reference to this "allsound" object.

I was hoping that anyone familiar with "_flash" and/or "allsound" could shed some light on this and perhaps provide links to sites/posts with more information on _flash.

(Google didn't turn up much, and Ultrashock seems to strip off underscores in searches ....)

I am also very much interesed in hearing any ideas on alternative ways to implement a sound on/off button on a site like this where there is no Sound() objects to control.

Thanks,
Elsand

How To Control Sound Of Embedded Video In MX?
Is it possible to control the sound of an embedded video with actionScripting in MX. I would like to make a volume slider (0-->100%) which controls the volume of my video.
TX a lot !!!

Control Sound For Embeded Video
hello!

is there any way to control the sound of an embeded video? i only need a on/off button.

i can turn it off with stopAllSounds(), but i haven't figured out a way to turn it back on.

i really need to use embeded video because i have to banners that i need to sinchronize... there's no way i can do this with streaming...

thanks

Sound Object For Video? Help
Hi there,

I am trying to use the sound object to separate two different sound channels from a flv.
Ive never attempted anyhting like this before- does anyone know if it is at all possible?

Basicly I have a video file as flv loaded in, and I want to be able to switch between the left and right channels.

The code I found is:

var mySoundTransformObject:Object = new Object();
mySoundTransformObject.ll = 100;
mySoundTransformObject.lr = 100;
mySoundTransformObject.rr = 50;
mySoundTransformObject.rl = 50;

my_sound.setTransform(mySoundTransfromObject);


in actionscript help files,

Im hoping to use it on press of a left and right button:

left.onRelease = function() {
var mySoundTransfromObject:Object = {ll:100, lr:100, rr:0, rl:0};
}


but as I have no real understanding of how it works, I dont know how to actually get it to work.

Would the sound object work on a piece of video, or is it just for mp3s,

Please help- any tips would be much appreciated

Sound - Event Vs. Stream (stream Quality Problem)
Hey Guys,

I've got a flash piece with various MP3's that I have playing throughout. When I set it to stream within Flash, it sounds great. However when I publish the SWF and play it solely in the Flash viewer, the audio is significantly worse. If I go back into Flash and set the audio type to "event", it sounds great again. The problem is I need to keep the audio streaming.

Any suggestions on how to do this?

Thanks Much.

Video Object - Sound But No Picture
I am trying to make a video player from scratch for a project.

The audio plays, but the video does not.

code: var obj_Video:Video = new Video ();
var obj_Video_NC:NetConnection = new NetConnection ();
obj_Video_NC.connect (null);
var obj_Video_NS:NetStream = new NetStream (obj_Video_NC);
obj_Video.attachVideo(obj_Video_NS);
obj_Video_NS.play ("video.flv");

I read the documentation and I have to attach the video object to the timline, but how do I do that?

Any ideas?

Thanks in advance!

Video Object - Sound But No Picture
I am trying to make a video player from scratch for a project.

The audio plays, but the video does not.

var obj_Video:Video = new Video ();
var obj_Video_NC:NetConnection = new NetConnection ();
obj_Video_NC.connect (null);
var obj_Video_NS:NetStream = new NetStream (obj_Video_NC);
obj_Video.attachVideo(obj_Video_NS);
obj_Video_NS.play ("video.flv");

I read the documentation and I have to attach the video object to the timline, but how do I do that?

Any ideas?

Thanks in advance!

Display Object From Child Class ? Sound But No Video. I Dont Get It...
So I have a main package with a main class, then it breaks down into children from there (I think thats how you explain it). I am trying to stream a video and get it on the stage. I know my issue is with adding the display object but I dont get it - I have too many forum posts / books open but I just cant seem to get it. How do I get it to display when compiled? I can hear the sound but cant see it.

Main Package:

package core {

import flash.display.*;

public class SecretSolutions extends MovieClip {

var secretsXMLFile = "../xml/secrets.xml";

public function SecretSolutions() {

var secretsXML = new GlobalXML;

var secretsVideo = new GlobalVideo;

secretsVideo.showVideo();

secretsXML.importXML(secretsXMLFile);
}
}
}


Global Video Package

package core {

import flash.display.*;
import flash.net.*;
import flash.events.*;
import flash.media.*;

internal class GlobalVideo extends MovieClip {

public function showVideo () {


var video:Video = new Video(320,240);

addChild(video);

var nc:NetConnection = new NetConnection();

nc.connect(null);

var ns:NetStream = new NetStream(nc);

ns.addEventListener(NetStatusEvent.NET_STATUS, onStatusEvent);

function onStatusEvent(stat:Object):void{

trace(stat.info.code);
}

var meta:Object = new Object();

meta.onMetaData = function(meta:Object){

trace(meta.duration);
}

ns.client = meta;

video.attachNetStream(ns);

ns.play("video_001.flv");

}
}
}


Thanks in advance and for any insight - Im new to AS3

Question About Domain Control
Hello,

I'm new to this forum and hope someone can help me with a problem I've
been trying to solve for days.

I have a flash movie that I want to distribute on a permission use basis.
This means it can only be hosted on domains that have permission to host it.
Here's the solution I came up with, but I can't find a way to implement it with AS:

1) I provide a key to each host that is an encrypted version of their domain
2) They pass this key to the SWF using a query string
3) The SWF would decrypt the key and compare it to the domain hosting it
4) If it's not a match, the SWF aborts, redirects to my website, etc.

I already know how to:

- Create a unique key by encrypting the approved domain
- Pass the key to the SWF using the query string

But I don't know how to:

- Determine the domain hosting the SWF (domain only, domain.ext)
- Decrypt the key that is passed to the SWF (reverse of original encryption)

I hope this isn't too much to ask for my first post.
Thanks in advance for any help you can toss my way!

Applejack

Domain Issues With Shared Object
Hi,

I'm using shared objects to keep the language preference of users.

How I did it was to use language.swf to save the Shared Object and then lesson1.swf will pick it up (both in different files). The structure of the file is as below ...

Root/
level 1/
language.swf
level 2/
lesson1.swf

It worked perfectly fine on my local pc (localhost).

However when i ported this to a live site (let's call it www.abc.com), lesson1.swf couldn't pick up the shared object. I then checked the SOL files the weird thing is, language.swf saved it in the folder "www.abc.com" but lesson1.swf is trying to read from the folder "abc.com".

Any idea how i can make them both read from the same folder? It's weird because both flash files are in the same domain.

The code used are

(in language.swf)
mySO = SharedObject.getLocal("lang", "/");
mySO.data.lang = lang;
if (!mySO.flush(1000)) {
System.showSettings(1);
} else {
getURL("javascript:gotoURL("lesson1.html"')", "_self");
}

(in lesson.swf)
mySO = SharedObject.getLocal("lang", "/");
thelanguage = mySO.data.lang;

Volume Control - Mp3 Stream?
I am streaming MP3s which load dynamically from an XML file.

Is it possible to add/use a volume control button/dial to this type of player?

if so - can anyone give me a starting point?

thanks again!

RR

Loading Sound From Another Domain - Possible?
Ok, I'm loading up an XML list of sounds, and some of them are on other domains.

First,
I strip the URLs down to their base URLs and then add them to a quoted, comma separated list ('domainone.com','domaintwo.com','...'). The list is saved as a variable "domainList"

After I have this text list list created, I do this:
System.security.allowDomains(domainList).

Then I proceed to try loading the sound (my_sound.loadSound('url_of_sound/sound',true), and as I thought, I can't.

Is there any way to load sounds from another domain???

I thought the allowDomain method let the app have access to the domains listed. How exactly does this work?

ASP STREAM Object For An SWF File
I am playing with the ASP Steam object,
and trying to get it to write an SWF file
to my browser.

My code goes (with file.swf as the swf file
to be opened):

<%
Response.Buffer=true
Response.ContentType = "application/x-shockwave-flash"

path = Server.MapPath("file.swf")

set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type=1
objStream.Open
objStream.LoadFromFile path

Response.BinaryWrite objStream.Read

objStream.Close()
Set objStream = Nothing

Response.Flush()

%>

My browser prints the file, rather than shows
the SWF image. When I open the file by
setting the browser url to
"

Stream Video?
How can I make a webcam stream video to my website? Please get me started.

How Can I Stream Video
Hi.
I have some mpegs (about 50 MB each) imported in SWFs (about 150 MB each).

I was read on forum that they can be streamed with loadmovie action, but they doesn't. Any suggestion, please?

Tryed with loadmovie into target, and loadmovienum into level on timeline.

Tnx, Cash

How Do I Stream Video?
Hey everyone.

Just wont to know how to stream video!!
I embedd the video into the time line - but when i test my movie in the bandwidth profiler - under streaming video - it will only play the video after it has finished the whole 100%, and to my understanding thats not streaming.

Can someone please give my a clue.
Cheers Werglum.

How Do You Stream A Video? Please Help
i need to know how to stream a video , please and thx

Video Stream
Anybody know how to loop a video stream?

Please someone, Cheers

Taksman

Video Does Not Stream...help...
Hi:

I have a Flash Movie that is suppose to stream a .flv file off a website.

The problem is it doesn't work.

It works fine when I test it locally on my computer, but when I upload it to the server it doesn't play. I see the MediaPlayback Component that I placed in the Flash movie, but no video streams.

The URL to the .flv file is OK, I checked that.

Does a server need any specific settings? I am using Flash MX 2004 to make this, and no other software.

Any ideas, links, help would be greatly appreciated.

Thanks,

SP

How To Add Video Ads In Between FLV Stream
I'm working on a video portal. We are using Flix engine to convert all the videos to FLV format. While streaming back the FLV file we want to embed some Video Ads for every 15 min interval of the FLV file and we dont want to manually do this. Like in windows media player asx format do we have anything like a playlist for AD mixing in FLV.

No Video From FMS Stream
Hello,

I'm unable to stream a stored flv on Flash Media Server.

I created a sample folder in the applications directory. Added main.asc and video2.flv.

I created a fla locally with a video object (named sample_video) and the following code on the first frame of the main timeline.

var nc:NetConnection = new NetConnection();
nc.onStatus = function(info){
trace1("NetConnection.onStatus called: ("+getTimer()+" ms)");
for (var prop in info) {
trace1(" "+prop+": "+info[prop]);
}
trace1("");
}
nc.connect("rtmp://servername.com/sample"); \where servername is the actual name of our server.

var ns:NetStream = new NetStream(nc);
var sample_video:Video;

ns.setBufferTime(0);
sample_video.attachVideo(ns);
ns.play("video2.flv");

ns.onStatus = function(info){
trace1("NetStream.onStatus called: ("+getTimer()+" ms)");
for (var prop in info) {
trace1(" "+prop+": "+info[prop]);
}
trace1("");

}

Here's the output:


NetConnection.onStatus called: (150 ms)
description:Connection succeeded.
code:NetConnection.Connect.Success
level:status

NetStream.onStatus called: (165 ms)
clientid:89429232
details:video2.flv
description:Playing and resetting video2.flv.
code:NetStream.Play.Reset
level:status

NetStream.onStatus called: (165 ms)
clientid:89429232
details:video2.flv
description:Started playing video2.flv.
code:NetStream.Play.Start
level:status


Looks like everything is okay but I don't get any video in my output. Also, the fms2_console says that it is playing live video2.flv. How do I change this to "stored".

Any help would be greatly appreciated as I have search the web for a full day and no luck getting this to work. The examples are geared more towards live streaming, haven't found one yet for streaming just a plain old flv.

My Mp4 Video Will Not Stream?
Here is the code for my video but for some reason it isn't playing the video...

I am thinking that maybe it is trying to load the whole mp4 file before it plays, but im not sure if that is the case. Any help would be appreciated.

the mp4 is quite large


Code:
import caurina.transitions.*;

var conn:NetConnection = new NetConnection();
conn.connect(null);

var stream:NetStream = new NetStream(conn);
stream.play("http://jasonhardwick.com/WatchIT/res_hi/2519-20019-2.mp4");
var metaListener:Object = new Object();
metaListener.onMetaData = theMeta;
stream.client = metaListener;

var st:SoundTransform = new SoundTransform();
stream.soundTransform = st;

var video:Video = new Video();
video.attachNetStream(stream);
video.width = 640;
video.height = 360;
video.x = 70;
video.y = 0;
video_mc.addChild(video);

barBg_mc.thumb_mc.mouseEnabled = false;
barBg_mc.thumb_mc.alpha = 0;
barBg_mc.track_mc.buttonMode = true;
barBg_mc.speaker_mc.buttonMode = true;
barBg_mc.toggle_mc.buttonMode = true;
bigPlay_mc.buttonMode = true;
barBg_mc.volScrubber_mc.volThumb_mc.buttonMode = true;

stage.addEventListener(Event.ENTER_FRAME, enterFrame);
stage.addEventListener(MouseEvent.MOUSE_OVER, getInterface);
stage.addEventListener(MouseEvent.MOUSE_OUT, removeInterface);
barBg_mc.speaker_mc.addEventListener(MouseEvent.CLICK, mute);
barBg_mc.speaker_mc.addEventListener(MouseEvent.MOUSE_OVER, rollOnSpeaker);
barBg_mc.speaker_mc.addEventListener(MouseEvent.MOUSE_OUT, rollOffSpeaker);
barBg_mc.toggle_mc.addEventListener(MouseEvent.CLICK, pause);
barBg_mc.toggle_mc.addEventListener(MouseEvent.MOUSE_OVER, rollOnToggle);
barBg_mc.toggle_mc.addEventListener(MouseEvent.MOUSE_OUT, rollOffToggle);
bigPlay_mc.addEventListener(MouseEvent.CLICK, pause);
barBg_mc.track_mc.addEventListener(MouseEvent.MOUSE_OVER, trackOver);
barBg_mc.track_mc.addEventListener(MouseEvent.MOUSE_OUT, trackOut);
barBg_mc.track_mc.addEventListener(MouseEvent.CLICK, goToSecond);
barBg_mc.track_mc.addEventListener(MouseEvent.MOUSE_DOWN, trackDown);
barBg_mc.track_mc.addEventListener(MouseEvent.MOUSE_UP, trackUp);
barBg_mc.volScrubber_mc.volThumb_mc.addEventListener(MouseEvent.MOUSE_DOWN, volDown);
stage.addEventListener(MouseEvent.MOUSE_UP, volUp);

var xOffset:Number;
var xMin:Number = 13;
var xMax:Number = 309;
var volOffset:Number;
var volxMin:Number = 0;
var volxMax:Number = barBg_mc.volScrubber_mc.volTrack_mc.width - 7;
var volPercent:Number;
var totalLength:uint;

function theMeta(data:Object):void
{
totalLength = data.duration;
}

function enterFrame(e:Event):void
{
var nowSecs:Number = Math.floor(stream.time);
var totalSecs:Number = Math.round(totalLength);
if(nowSecs > 0)
{
barBg_mc.timerText.text = videoTimeConvert(nowSecs) + " / " + videoTimeConvert(totalSecs);
var amountPlayed:Number = stream.time / totalLength;
var amountLoaded:Number = stream.bytesLoaded / stream.bytesTotal;
barBg_mc.playStatus_mc.x = 46;
barBg_mc.playStatus_mc.width = 294 * amountPlayed - 1;
barBg_mc.dlStatus_mc.x = 46;
barBg_mc.dlStatus_mc.width = 294 * amountLoaded + 3;
}
}

function getInterface(e:MouseEvent):void
{
if(mouseX > 70 && mouseX < 710 && mouseY > 0 && mouseY < 360)
Tweener.addTween(barBg_mc, {alpha:1, time:3});
}

function removeInterface(e:MouseEvent):void
{
Tweener.addTween(barBg_mc, {alpha:0, time:3});
}

function trackOver(e:MouseEvent):void
{
stage.addEventListener(MouseEvent.MOUSE_MOVE, startFollow);
xOffset = mouseX - barBg_mc.thumb_mc.x;
}

function trackOut(e:MouseEvent):void
{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, startFollow);
barBg_mc.thumb_mc.alpha = 0;
}

function startFollow(e:MouseEvent):void
{
barBg_mc.thumb_mc.alpha = 1;
barBg_mc.thumb_mc.x = barBg_mc.mouseX - (barBg_mc.thumb_mc.width / 2) + 2;
if(barBg_mc.thumb_mc.x <= xMin)
barBg_mc.thumb_mc.x = xMin;
if(barBg_mc.thumb_mc.x >= xMax)
barBg_mc.thumb_mc.x = xMax;
stage.addEventListener(Event.ENTER_FRAME, getTimeText);
e.updateAfterEvent();
}

function getTimeText(e:Event):void
{
var percentAcross:Number = (barBg_mc.thumb_mc.x - 12) / barBg_mc.track_mc.width;
barBg_mc.thumb_mc.trackTime_mc.text = videoTimeConvert(totalLength * percentAcross);
}

function goToSecond(e:MouseEvent):void
{
if(barBg_mc.track_mc.mouseX < barBg_mc.dlStatus_mc.width)
{
var percentAcross:Number = (barBg_mc.thumb_mc.x - 12) / barBg_mc.track_mc.width;
stream.seek(totalLength * percentAcross);
}
}

function trackDown(e:MouseEvent):void
{
stage.addEventListener(MouseEvent.MOUSE_MOVE, scrubTo);
xOffset = mouseX - barBg_mc.thumb_mc.x;
}

function trackUp(e:MouseEvent):void
{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, scrubTo);
}

function scrubTo(e:MouseEvent):void
{
if(barBg_mc.track_mc.mouseX < barBg_mc.dlStatus_mc.width)
{
var percentAcross:Number = (barBg_mc.thumb_mc.x - 12) / barBg_mc.track_mc.width;
stream.seek(totalLength * percentAcross);
}
}

function pause(e:MouseEvent):void
{
stream.togglePause();
if(barBg_mc.toggle_mc.currentFrame == 1)
{
bigPlay_mc.alpha = 1;
barBg_mc.toggle_mc.gotoAndStop(2);
}
else
{
bigPlay_mc.alpha = 0;
barBg_mc.toggle_mc.gotoAndStop(1);
}
}

function rollOnToggle(e:MouseEvent):void
{
barBg_mc.toggle_mc.alpha = .5;
}

function rollOffToggle(e:MouseEvent):void
{
barBg_mc.toggle_mc.alpha = 1;
}

function mute(e:MouseEvent):void
{
if(barBg_mc.speaker_mc.currentFrame == 1)
{
st.volume = 0;
stream.soundTransform = st;
barBg_mc.speaker_mc.gotoAndStop(2);
}
else
{
st.volume = volPercent;
stream.soundTransform = st;
barBg_mc.speaker_mc.gotoAndStop(1);
}
}

function rollOnSpeaker(e:MouseEvent):void
{
barBg_mc.speaker_mc.alpha = .5;
}

function rollOffSpeaker(e:MouseEvent):void
{
barBg_mc.speaker_mc.alpha = 1;
}

function volDown(e:MouseEvent):void
{
stage.addEventListener(MouseEvent.MOUSE_MOVE, volAdjust);
}

function volUp(e:MouseEvent):void
{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, volAdjust);
}

function volAdjust(e:MouseEvent):void
{
barBg_mc.volScrubber_mc.volThumb_mc.x = barBg_mc.volScrubber_mc.volTrack_mc.mouseX;
if(barBg_mc.volScrubber_mc.volThumb_mc.x <= volxMin)
barBg_mc.volScrubber_mc.volThumb_mc.x = volxMin;
if(barBg_mc.volScrubber_mc.volThumb_mc.x >= volxMax)
barBg_mc.volScrubber_mc.volThumb_mc.x = volxMax;
volPercent = barBg_mc.volScrubber_mc.volThumb_mc.x / volxMax;
if(barBg_mc.speaker_mc.currentFrame == 1)
st.volume = volPercent;
stream.soundTransform = st;
e.updateAfterEvent();
}

var displayHours:Boolean = true;

function videoTimeConvert(myTime):String
{
var tempNum = myTime;
var minutes = Math.floor(tempNum / 60);

if (displayHours)
{
var hours = Math.floor(minutes / 60);
}
var seconds = Math.round(tempNum - (minutes * 60));

if (seconds < 10)
{
seconds = "0" + seconds;
}
if (minutes < 10)
{
minutes = "0" + minutes;
}

if (displayHours)
{
if (hours < 10)
{
hours = "0" + hours;
}
}

var currentTimeConverted = hours + ":" + minutes + ":" + seconds;

return currentTimeConverted;
}

Video Stream
Hello people

Please help me..
I have one question:

Is possible to view video stream, which comming throu the live stream (url like mms://server/video) via flash player..
If yes, please tell me where can I find the sample (fla, or swf, os AS)..

Thanks

Net Stream Video
how do i create buttons at the end of the video that loads external swf when i use netstream

Can't Stream FLV Video
I'm a total flash noob, so pardon my ignorance. I working with Flash 8 and trying to create a flash file that will play a FLV video. I've tried using both the import video function and also the media display component. I can get the flash movie to work fine locally, but I can't get it to work once uploaded to my server. I have made sure the url is correct inside the flash file. I have tried using both relative and absolute paths.

I am starting to think the problem may be my host because I can't play the FLV in an FLV player from my server using the URL.

Am I overlooking anything?

Cross Domain XML, Sound.Spectrum, And FMS 2
I've created a custom video / audio player which gets it's video / audio content from a Flash Media Server. I'm trying to use SoundMixer.computeSpectrum() to create a nice audio spectrum line. I'm getting this sandbox security error. I'm already using a crossdomain.xml to allow another flash object to call a webservice and it works fine, but since my videos are on another server, I'm not sure what I should do to get this working? Has anyone run into this issue before or have any words of advice?

SecurityError: Error #2123: Security sandbox violation: SoundMixer.computeSpectrum: http://www.MYSITE.com/Flash/player.swf cannot access rtmp://192.114.20.88/Videos. No policy files granted access.
at flash.media::SoundMixer$/computeSpectrum()
at TEVideoPlayer/spectrumPlayer()
at TEVideoPlayer/volumePlay()


Thanks
Drewskiibob



























Edited: 07/24/2008 at 08:09:31 AM by drewskiibob

Audio Scrubber Without Net Stream Object
I'm looking for a way to add seeking capability to audio playback. I can do it pretty easily for video, but I'm currently using a sound object which has no seek capabilities whatsoever.

Is there a different object or method I can use to direct audio playback to a particular point in the audio duration?

what I was trying (modification of a video playback tutorial):


PHP Code:



// initialize sound object
var as:Sound = new Sound();
as.loadSound("test.mp3", true);

var audioInterval = setInterval(audioStatus,100);
var audioLoaded:Number;
var audioDuration:Number = -1;

// update loader bar and scrub location
function audioStatus() {
    audioLoaded = as.getBytesLoaded() / as.getBytesTotal();
    loader.loadbar._width = as.duration * 170;
    if( audioDuration == as.duration && as.duration > 0 ) {
        loader.scrub._x = as.position / as.duration * 170 - 85;
    } else {
        audioDuration = as.duration;
    }
}

var audioScrubInterval;

// start dscrub drag
loader.scrub.onPress = function() {
    clearInterval(audioInterval);
    scrubInterval = setInterval(scrubAudio,10);
    this.startDrag(false,-85,this.y,85,this.y);
}

// end scrub drag
loader.scrub.onRelease = loader.scrub.onReleaseOutside = function() {
    clearInterval(scrubInterval);
    audioInterval = setInterval(audioStatus,100);
    this.stopDrag();
}

// seek and continue on release (this is the part that obviously isn't working as sound objects don't have a seek method.
function scrubAudio() {
    as.seek(Math.floor((loader.scrub._x/170)*audioDuration));
}




any help would be appreciated. I'm trying to avoid converting the test mp3 into an flv and hiding the video playback and i also am looking to avoid using netstrem.

Invalid Tincan Object Name (stream ID: 1)
I'm attempting to stream a video file and my net connection succeeds, but when I try netStream.play(filename), I receive the error 'Invalid tincan object name (stream ID: 1)'

What even is a tincan object, and what issue is there with the name?

My netConnection input is
netConnection.connect('rtmp://'+hostname+'/filepath/filename');

My netStream.play() input is identical to the netConnection input

Video Preload Vs Stream
Hi. I am creating a CD with several short video clips set to music and low-bandwidth animation.

I was under the impression that I could force MX to stream the video files as long as the video was loaded from a _root timeline, either into a level or into a movie clip. However, whenever I load my video SWF into a movie clip, it loads all of the SWF's frames before preceding. (I've checked.) I only need it to preload a few frames, and I've hidden such a preloader in a natural pause in the animation (i.e. pausing at a pretty picture) before the video plays. Preloading the entire video clip creates an unnacceptably long (albeit by a couple of seconds) pause in the animation.

Is there a way that I can force the video to stream while in a movieClip? I can't load it into a level since I need to fade it in and out from alpha = 0.

Any help would be much appreciated.

Can HTTP / Url Be Used To Stream Video?
Hi,

I posted earlier regarding the "loading" of Mpeg's during runtime.

What I meant to ask really, was:

Can I use http / url to STREAM Mpeg's?

Imagine this:

I am usinh http / url to get/send data. Using this method, could I hook up a camera at my front door, and be able to watch Live Video (OR.... what APPEARS to be live video). I want to do this using a SWF NOT a projector file. Therefore, the stream has to come in during runtime.

Does anyone know if this has been done? I'm finding it VERY hard to get a straight answer from Macromedia, and I can't seem to find any tutorials or samples etc... anywhere on the web.

Any ideas? Even a series of rapidly changing Jpeg's (MJpeg - motion jpeg) would do for now, can that be done?

Thanks Kindly in adnvance!!! Any suggestions would be helpful.

How To Preload / Stream Video?
I'm trying to embed video into Flash MX. I get it in everything is fine, but the file size is obviously to large. All the books say that if the video is embedded onto the main timeline, a form of streaming will take place. If I put the video into a MC it will need to download the whole MC before it starts playing.

I've tried making some preloaders on the main scene to help it download more before it starts to play (with out the preloaders it gets hung up on the second frame) either my preloaders are not correct or the "streaming" is effecting my preloaders.

Does anyone out there have a preloader or suggestions for me as to how to get my vidoes to either stream or preload better?

Any help would save me my sanity!

Thank you

How Do You Get A Video Not To Stream In Flash ?
I cant get flash to not stream a link to a video to download...

on (release) {
getURL ("http://www.distortedvision.co.uk/lee/tinkertheserialrabbitkiller.WMV", "_blank");
}

this streams it...

Can I Attach Video From One Stream To Another?
Hi!
How can I something like:

PHP Code:




a = new NetStream(nc1);
a.play();
.....
b = new NetStream(nc2);
b.attachVideo(a);
b.publish()






The following code doesn't work. Any ideas how it can be done?

Flash Video - How To Stream Or...
Totally new to Flash - well at least working with Flash video clips.

How do I code a Flash clip to start downloading and playing when the page is opened?

The clip has a skin etc - any pointers or tutorials?

<object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="350" height="323"><param name="wmode" value="transparent"><param name="movie" value="video/CampfireForWeb2.swf"><param name="bgcolor" value="#000000"><param name="quality" value="high"><param name="menu" value="false"><embed src="video/CampfireForWeb2.swf" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="350" height="323" bgcolor="#000000" quality="high" wmode="transparent" menu="false"></embed></object>

Thanks in advance

Video Stream With Array
Hi,
i have the following problem:
i want to stream a lot of small videos into one swf file, and control the videos via a 'next' 'previous' and 'play again' button.
now i am no flash whizz and but i know i need an array to do the above but can't quite work out how. i got the video to stream in but for some reason all 3 buttons (next, previous, play again) only replay the video which is playing. can anyone help me here please, here is the code so far:

var myVideos:Array = new Array("video/lecture01.flv", "video/lecture02.flv", "video/lecture03.flv");
var counter:Number = 0;
function playVideo(video:String):Void {
obj_netStreamIntro.play("video/lecture02.flv");
}
previous_but.onRelease = function() {
_level0.counter--;
if (_level0.counter<0) {
_level0.counter = 0;
}
_level0.playVideo(_level0.myVideos[_level0.counter]);
};
play_again_but.onRelease = function() {
obj_netStreamIntro.seek(0);
obj_netStreamIntro.pause(false);
};
next_but.onRelease = function() {
_level0.counter++;
if (_level0.counter>_level0.myVideos.length) {
_level0.counter = 0;
}
_level0.playVideo(_level0.myVideos[_level0.counter]);
};
playVideo(myVideos[counter]);
stop();

Video Stream Not Closing
In a video player I built, if you rapidly change videos the application becomes buggy. I assume is it because certain streams are not closing. Here is the code that has the buggy behavior:

ActionScript Code:
var vid1:String = "http://*/flood.flv";
var vid2:String = "http://*/movie1.flv";
var vid3:String = "http://*/liquid.flv";
var vid4:String = "http://*/worldsapart.flv";
var vid5:String = "http://*/157.flv";


var _nc:NetConnection = new NetConnection();
_nc.connect(null);
var _ns:NetStream = new NetStream(_nc);
video.attachNetStream(_ns);

var _listener:Object = new Object();
_listener.onMetaData = function(data:Object):void { }
_ns.client = _listener;

butt1.addEventListener(MouseEvent.CLICK, buttClick, false, 0, true);
butt2.addEventListener(MouseEvent.CLICK, buttClick, false, 0, true);
butt3.addEventListener(MouseEvent.CLICK, buttClick, false, 0, true);
butt4.addEventListener(MouseEvent.CLICK, buttClick, false, 0, true);
butt5.addEventListener(MouseEvent.CLICK, buttClick, false, 0, true);

function buttClick(e:MouseEvent):void
{
    var url:String;
    switch(e.currentTarget)
    {
        case butt1: url = vid1; break;
        case butt2: url = vid2; break;
        case butt3: url = vid3; break;
        case butt4: url = vid4; break;
        case butt5: url = vid5; break;
    }
   
    playVid(url);
}

function playVid(url:String):void
{
    _ns.close();
    _ns.play(url);
}

addEventListener(Event.ENTER_FRAME, perLoaded);
function perLoaded(e:Event):void
{
    bar.scaleX = _ns.bytesLoaded / _ns.bytesTotal;
}

playVid(vid1);

and here is the code I have to use to get rid of the bug:

ActionScript Code:
function playVid(url:String):void
{
    _ns.close();
   
    _ns = new NetStream(_nc);
    video.attachNetStream(_ns);
   
    _ns.client = _listener;
    _ns.play(url);
}

Is there something that I'm missing with the first code, or is my only option to over write the instance which kills the opened stream (where the close method must be calling before the stream is ever even opened).

However, the problem with doing it the second way is if you just jam on one of the buttons (click it fast multiple times), the video never ends up playing.

How can I effectively control the video without limiting the user's clicks (disabling nav)?

Let Video Stream A Bit Before Playing.
I have a video that is going to be in a transparent layer overlaying a product on a ecommerce website with a person talking about the product.


it plays right away and smoothly at work but at home with my slower internet connection it plays right away and is very choppy.


I was wondering if there is a way to let it stream a bit (like 10% of its length) before it starts to play so the video wont appear choppy on some slower connections and since its just an extra and not a prominant part of the page it doesnt matter if it take 5 seconds before it starts.

Thanks!!!


my code is below:

ActionScript Code:
import flash.media.Video;
import flash.external.ExternalInterface;

var overlayVideo:String;
if(root.loaderInfo.parameters.overlayVideo){
    overlayVideo = root.loaderInfo.parameters.overlayVideo;
}else{
    overlayVideo = "person.flv";
}



var videoConnection:NetConnection = new NetConnection();
videoConnection.connect(null);
var videoStream:NetStream = new NetStream(videoConnection);
videoStream.play(overlayVideo);
var metaListener:Object = new Object();
metaListener.onMetaData = onMetaData;
videoStream.client = metaListener;
var video:Video = new Video();
video.attachNetStream(videoStream);
var vid:Sprite = new Sprite();
vid.addChild(video);
addChild(vid);
video.width = 269;
video.height = 380;


var close_btn:Close_btn = new Close_btn();
vid.addChild(close_btn);
close_btn.visible = false;
var replay_btn:Replay_btn = new Replay_btn();
vid.addChild(replay_btn);
replay_btn.visible = false;
close_btn.addEventListener(MouseEvent.CLICK,onBtnClick);
replay_btn.addEventListener(MouseEvent.CLICK,restartVideo);

function onMetaData(data:Object):void {
    vid.addEventListener(MouseEvent.MOUSE_OVER, onVideoOver);
    vid.addEventListener(MouseEvent.MOUSE_OUT, onVideoOut);
}
function onVideoOver (event:MouseEvent) {
    close_btn.visible = true;
    close_btn.x = vid.width/2;
    close_btn.y = vid.height/2;
   
    replay_btn.visible = true;
    replay_btn.x = vid.width/2;
    replay_btn.y = vid.height/2 + close_btn.height+5;
}
function onVideoOut (event:MouseEvent) {
    close_btn.visible = false;
    replay_btn.visible = false;
}
function onBtnClick (event:MouseEvent){
    close_video();
}
function restartVideo (event:MouseEvent){
    videoStream.play(overlayVideo);
}

function close_video() {
    ExternalInterface.call("close_video_overlay");
}

Stream Video From A Web Server?
Hi,

I have a flash video on a web server, and i have its URL, now I want to stream it to my local system through my application using FMS and actionscript. will i be needing an encoder or transcoder in between??
anyone please tell me how should i proceed?

thanks a ton

Copyright © 2005-08 www.BigResource.com, All rights reserved