I hope that .. the code bellow .. will .. work very well ..
I use the fallowing .. preBuildCommand .. into my project .. FAG EXPLORER FLV.fdp
<preBuildCommand>"$(ToolsDir)\swfmill\swfmill.exe" simple "library/video.xml"
"library/video.swf"
To be continued
FAG = FREE ACADEMIC GAMES
When I use the line
<preBuildCommand>"$(ToolsDir)\swfmill\swfmill.exe" simple "library/video.xml"
"library/video.swf"
then
the project must contain the lines below
<library>
<asset path="Library\video.swf" />
</library>
Observations:
swfmill.exe .. creates .. the file .. video.swf .. into the directory .. library
(library .. is .. placed next to the project file)
swfmill.exe uses the file .. video.xml .. to create .. the file .. video.swf
The code of the file .. video.swf .. is
<?xml version="1.0" encoding="utf-8" ?>
<movie version="7">
<frame>
<library>
<clip id="VideoDisplay">
<frame>
<video id="VideoSurface" width="854" height="480"/>
<place id="VideoSurface" name="video"/>
</frame>
</clip>
</library>
</frame>
</movie>
To be continued
import util.VideoDisplay;
class util.Instances
{
function Instances() {
// _root.Fdisplay_MC
_root.createEmptyMovieClip ("Fdisplay_MC", _root.getNextHighestDepth());
_root.Fdisplay_MC._alpha = 50;
//
var
Fdisplay:VideoDisplay = new VideoDisplay(null, _root.Fdisplay_MC, "Fdisplay", 1);
_root.Fdisplay = Fdisplay; _root.Fdisplay._x = 5; _root.Fdisplay._y = 0;
_root.Fdisplay.setVolume(100);
//
_root.Fdisplay_MC.onPress = function()
{
if (_root.b_pause) _root.b_pause = 0 else _root.b_pause = 1;
_root.Fdisplay.pause();
}// _root.Fdisplay_MC.onPress = function()
}// function Instances() {
}// class util.Instances
To be continued
/**
* The initial code is from http://www.flashdevelop.org/community/viewtopic.php?t=321
* Part 3. Streaming FLV videos (FlashDevelop/SWFMILL only)
I put the fallowing code into the initial class util.VideoDisplay
// attach audio
display.attachAudio(ns);
audio_sound = new Sound(display);
/**
* Get time in video
*/
public function pos():Number
{
return ns.time;
}
public function setVolume(vol:Number):Void
{
audio_sound.setVolume(vol);
}
private var audio_sound:Sound;
*/
class util.VideoDisplay
{
//{ PUBLIC MEMBERS
/**
*
* Create a new video display surface
*/
function VideoDisplay(targetURI:String, parent:MovieClip, name:String, depth:Number, initObj)
{
display = parent.attachMovie("VideoDisplay", name, depth, initObj);
// create video stream
nc = new NetConnection();
nc.connect(targetURI);
ns = new NetStream(nc);
// attach the video stream to the video object
display.video.attachVideo(ns);
// attach audio
display.attachAudio(ns);
audio_sound = new Sound(display);
} // VideoDisplay(targetURI:String, parent:MovieClip, name:String, depth:Number, initObj)
/**
* Video surface dimensions
*/
function setSize(width:Number, heigth:Number):Void
{
display.video._width = width;
display.video._height = heigth;
}
/**
* Video clip position
*/
function setLocation(x:Number, y:Number):Void
{
display._x = x;
display._y = y;
}
/**
* Start streaming
* @param url FLV file
* @param bufferTime Buffer size (optional)
*/
public function play(url:String, bufferTime:Number):Void
{
if (bufferTime != undefined) ns.setBufferTime(bufferTime);
ns.play(url);
}
/**
* Pause streaming
*/
public function pause():Void
{
ns.pause();
}
/**
* Seek position in video
*/
public function seek(offset:Number):Void
{
ns.seek(offset);
}
/**
* Get time in video
*/
public function pos():Number
{
return ns.time;
}
/**
* Close the video
*/
public function close():Void
{
ns.close();
}
public function setVolume(vol:Number):Void
{
audio_sound.setVolume(vol);
}
//}
//{ PRIVATE MEMBERS
private var display:MovieClip;
private var nc:NetConnection;
private var ns:NetStream;
private var audio_sound:Sound;
//}
}