1.::SWF::VideoStream(3)User Contributed Perl Documentation.::SWF::VideoStream(3)
2
3
4
6 SWF::VideoStream - SWF Video class
7
9 use SWF::VideoStream;
10 $videostream = new SWF::VideoStream("test.flv");
11
13 SWF::VideoStream is a helper class useful for playing videos via SWF
14 applications, either via embedded video data, or controlled by
15 ActionScript.
16
18 $videostream = new SWF::VideoStream($filename)
19 Creates a SWF::VideoStream object. If the file can't be opened the
20 constructor will return an empty object. The filename is not
21 limited to 'flv' extension.
22
23 $frames = $videostream->getNumFrames()
24 This method returns the number of video-frames of an object of
25 SWF::VideoStream, this works only for embedded streams. In case of
26 error you will get result of -1.
27
28 $videostream->setDimension(width, height)
29 This method sets width and height for streamed videos, this works
30 only on streamed videos (progressive download or rtmp).
31
32 $bool = $videostream->hasAudio()
33 A test whether the embedded FLV stream also has audio data.
34
35 $videostream->setFrameMode($mode)
36 If the mode == SWFVIDEOSTREAM_MODE_AUTO (default) on every SWF
37 movie frame a video frame is added. In SWFVIDEOSTREAM_MODE_MANUAL
38 mode, the user needs to call the nextFrame() method to change the
39 video's frame. This works only with embedded video streams. Does
40 return the previous mode or -1 if an invalid mode was passed.
41
42 $result = $videostream->nextFrame()
43 Switch to next video frame. Works only with embedded video streams.
44 Returns -1 if an error happend. Here follows some demo code how to
45 use SWF::VideoStream objects (without ActionScript):
46
47 use SWF qw(:ALL); # to be lazy
48 $movie = new SWF::Movie();
49 $movie->setRate( 25 );
50 # $movie->setRate( 5 ); # e.g. 5 for slow motion
51 # here movie set background etc. etc.
52 #
53 $video=new SWF::VideoStream('MyTestVideo.flv');
54 die if (-1 == $v->getNumFrames()); # abort if something went wrong
55 #
56 $video->setFrameMode(SWF::Constants::SWFVIDEOSTREAM_MODE_MANUAL);
57 $video->seek(1000, 0); # for example only
58 $displayitem = $movie->add($video);
59 #
60 # 250 for a 10 seconds movie part (at rate of 25 per minute)
61 for(my $n = 0; $n < 250; ++$n)
62 {
63 $video->nextFrame();
64 $movie->nextFrame();
65 }
66 $movie->save("MyTestVideo.swf",9);
67 # that's all, folks
68
69 $result = $videostream->seek($frame, $whence)
70 This functions allows seeking $frame in video stream, returning the
71 old video frame position. As value of $whence use one of the
72 following:
73
74 0 for seeking from beginning
75 1 for seeking from current position
76 2 for seeking from end of file
77
79 developers of ming
80 ming.sourceforge.net
81
83 SWF, SWF::Action, SWF::Movie, SWF::MovieClip, SWF::Sound,
84 SWF::SoundStream, SWF::Constants
85
86
87
88perl v5.32.0 2020-07-28 .::SWF::VideoStream(3)