Simple Video Player

The following script demonstrates using TMCI for embedding video playback in a Tk window as shown below.
 
load mci 
## variables - set these for your own configuration 
# 
set moviefile uxmas97.avi 
set alias uxmas 

## Set up GUI 
# 
foreach w [winfo child .] {destroy $w} 

frame .f -bd 2 -relief sunken 
label .f.movie -bg darkGreen 
pack .f.movie -fill both -expand 1 
frame .divider -bd 1 -relief sunken -height 3 
frame .buttons 
pack .buttons -side bottom -fill x 
pack propagate .divider 
pack .divider -side bottom -fill x 
set b .buttons 
button $b.start -text "Start" -command "mci \{play $alias from 0:0:0\}" 
button $b.stop -text "Stop" -command "mci \{stop $alias\}" 
button $b.console -text "Show Console" -command {console show} 
pack $b.start $b.stop $b.console -side left 
pack .f -side top -fill both -expand 1 

## make sure to update so as to allow for the windows to be created 
update 

bind .f.movie <Destroy> { 
    mci {close all} 
    puts {video closed} 
} 

### mci stuff 
## first open the movie 
# 
mci "open $moviefile alias $alias" 
## now specify the window for rendering 
# 
scan [winfo id .f.movie] %x id 
mci "window $alias handle $id"