Forums  

Go Back   Forums > Talk > General FPP Discussion

Reply
 
Thread Tools Display Modes
  #1  
Old 09-24-2009, 11:28 AM
permort permort is offline
Junior Member
 
Join Date: May 2009
Posts: 16
Downloads: 0
Uploads: 0
Default Communicate between flvPlayer and another swf-file

I canīt figure out how to communicate between these two .swf-files.
The first file, "coordinates.swf" is tracking the coordinates and play/pause my flv-videos. The second file, "flvPLayer.swf" is playing the flv-file.

What I want to do is to play/pause the video when the pano is between spesific coordinates.

My question is:How do I call the "playVideo" function in "flvPlayer.swf" from "coordinates.swf"?

Here is my code so far. This is from "coordinates.swf":
Code:
if (coordinate < -95 && coordinate > -170) {
			//Here I want to call the "playVideo" function in "flvPlayer.swf"
		
		} else {
			//Here I want to call the "pauseVideo" function in "flvPlayer.swf"
			}
This is some code from "flvPlayer.swf". I have paused at frame 1 so itīs not starting when loaded:
Code:
function connectStream():void {

	stream = new NetStream(connection);
	stream.client = this;	
	stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);

	video = new Video(375, 225);
	vid.addChild(video);
	video.attachNetStream(stream);
	stream.play(file);
	stream.seek(1);
	stream.pause();

			
}
function playVideo() {
		stream.resume();
	}
function pauseVideo() {
		stream.pause();
	}

Last edited by permort; 09-24-2009 at 12:23 PM.
Reply With Quote
  #2  
Old 09-24-2009, 11:36 AM
allSaints's Avatar
allSaints allSaints is offline
Senior Member
 
Join Date: Aug 2008
Location: Stockholm, Sweden
Posts: 731
Downloads: 0
Uploads: 0
Default

May I suggest checking up the commander.swf plugin. It may be capable of handling what you want to achieve.

Tommy
Reply With Quote
  #3  
Old 09-24-2009, 01:23 PM
permort permort is offline
Junior Member
 
Join Date: May 2009
Posts: 16
Downloads: 0
Uploads: 0
Default

Thankīs for your reply, but I canīt see how to do this with your plug-in.
I guess I have to use "commandIn" and "commandOut" but all the examples in the xml-file links to global-functions in FPP XML-file.

In one global function, you use "stopVideo()". Where is that function defined?
Reply With Quote
  #4  
Old 09-24-2009, 01:43 PM
allSaints's Avatar
allSaints allSaints is offline
Senior Member
 
Join Date: Aug 2008
Location: Stockholm, Sweden
Posts: 731
Downloads: 0
Uploads: 0
Default

Thanks for spotting an error - stopVideo() should be stopTgrLou().

And these are FPP commands, yes. And with FPP commands you can easily handle your plugins...
Reply With Quote
  #5  
Old 09-25-2009, 09:41 AM
permort permort is offline
Junior Member
 
Join Date: May 2009
Posts: 16
Downloads: 0
Uploads: 0
Default

ok, I found some kind of solution, but itīs not optimal. I appreciate other ideas, please

What I did was to call two FPP commands from "coordinates.swf":
Code:
if (coordinate < -95 && coordinate > -170) {

		if (spotObject3.visible == 0) {
		spotObject3.visible=1;
		hotspots.execute("global.start_video");
		}
		} else {
			hotspots.execute("global.stop_video");
			}
My xml-file:
Code:
//Global parameter
start_video="spot.visible=1; spot.url=files/flvplayer_toril.swf;"
stop_video="spot.visible=0; spot.url=;"

//Hotspot
<box id="spot" file="movies/video.flv" scaleable="0" smoothing="0" pan="-123.00" refreshRate="20" segmentsX="10" segmentsY="10" />
The problem with this solution are two things:
1. The video.flv file starts streaming a new stream each time the command "start_video" is called. It seems like "stop_video" command donīt stop the stream. This is not good because it takes a lot of bandwidth. I want to use the same file from cache over and over again, so the video only loads one time.

2. I want to pause the stream before itīs starting. If I do that, the stream can load in the background and start to play at once when the coordinates are right.

The best solution for me is to be able to call a function in flvPlayer.swf from the xml-file. Please help!!
Reply With Quote
  #6  
Old 09-25-2009, 11:14 AM
allSaints's Avatar
allSaints allSaints is offline
Senior Member
 
Join Date: Aug 2008
Location: Stockholm, Sweden
Posts: 731
Downloads: 0
Uploads: 0
Default

If your flvPlayer.swf is a hotspot plugin, you can have a timer checking the value of a hotspot parameter, for example "cmd", and as soon as that parameter is set to a specific value, you can execute your function.

If that is not good enough, you have to use the LocalConnection API or the ExternalInterface API.
Reply With Quote
  #7  
Old 09-25-2009, 12:09 PM
permort permort is offline
Junior Member
 
Join Date: May 2009
Posts: 16
Downloads: 0
Uploads: 0
Default

Thanks a lot!! Great idea
Itīs now working

What I did was to make a timer function in "flvPlayer.swf" to check the visible status of the hotspot.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 04:31 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.