-
play_single
It opens a single video with name neat.mpg and play it.
package require media 1.0
_window {title=Ladybug2000 Playback centre=480 320}
_video {name=../Media/neat.mpg}
_play
video_
window_
-
play_single_loop
It plays the video repeatly. The while (1) command is a forevery loop. _rewind command moves the video header to the starting position.
package require media 1.0
_window {title=Ladybug2000 Single Loop centre=480 240}
_video {name=../Media/neat.mpg}
while {1} {
_play
_rewind
}
video_
window_
-
play_group
This code sets ls to be a list of video files. foreach command picks up each element e from the list ls and substitutes it in the name attribute of the _video. The $ls represents the value of the ls.
package require media 1.0
set ls {"../Media/neat.mpg" "../Media/neat.mpg"}
_window {title=Ladybug2000 Group centre=480 240}
foreach e $ls {
_video "name=$e"
_play
video_
}
window_
-
play_group_loop
This code plays a list of video files from beginning to the end. And then it plays the group of video files repeatly.
package require media 1.0
set ls {"../Media/neat.mpg" "../Media/neat.mpg"}
_window {title=Neatware Ladybug2000 width=480 height=240}
while {1} {
foreach e $ls {
_video "name=$e"
_play
video_
}
}
window_
-
play_group_loop
This code plays a list of video files from beginning to the end. And then it plays the group of video files repeatly.
package require media 1.0
set ls {"../Media/neat.mpg" "../Media/neat.mpg"}
_window {title=Neatware Ladybug2000 width=480 height=240}
while {1} {
foreach e $ls {
_video "name=$e"
_play
video_
}
}
window_
-
play_single_step
It uses the _step command to play video from frame 0 to the end. The for command sets the initial variable n as 0. When the value of n is less than the video length, it executes the _step command. The variable n increases 1 after each loop.
package require media 1.0
_window {title=Ladybug2000 Video centre=480 320 auto=true}
_video {name=../Media/neat.mpg}
# play from 0 to n
for {set n 0} {$n < [?video length]} {incr n} {
_step
}
video_
window_
-
play_fullscreen
This code plays the video in fullscreen. It is implemented simply by setting the window width and height as the screen width and height.
package require media 1.0
# get screen size
set w [?screen width]
set h [?screen height]
_window "title=Ladybug2000 Fullscreen
border=normal orgx=0 orgy=0 width=$w height=$h auto=true"
_video {name=../Media/neat.mpg}
_play
video_
window_
-
play_group_enlarge
This code shows how to change the window's size after the playback of a video. The expr command computes the math expression like the C language and returns the result. !window command modifies the title, orgx, orgy, width, and height.
package require media 1.0
set ls {"../Media/neat.mpg" "../Media/neat.mpg"}
_window {title=Ladybug2000 Group centre=480 240}
# travse all the video file names
foreach e $ls {
_video "name=$e"
# recalcuate the rectangle of window
set rect [?window rect]
set d 48
set x [expr {[lindex $rect 0] - $d}]
set y [expr {[lindex $rect 1] - $d}]
set w [expr {[lindex $rect 2] - [lindex $rect 0] + 2*$d}]
set h [expr {[lindex $rect 3] - [lindex $rect 1] + 2*$d}]
# modify window
!window "title=Ladybug2000 -- $e
orgx=$x orgy=$y width=$w height=$h"
_play
video_
}
window_
-
play_seek
This code demonstrates the usage of the _seek command to set the video starting position in the middle of the video length.
package require media 1.0
set ls {../Media/neat.mpg}
_window {title=Neatware Ladybug2000 Seek centre=480 320}
foreach e $ls {
_video "name=$e"
set frames [?video length]
_seek "current=[expr $frames/2]"
_play
video_
}
window_
<< Examples: Information
Examples: Transform >>