The Green Shoes Manual 1.1.362

Video

Green Shoes supports embedding of MP4, AVI, WMV, QuickTime and various other popular video formats. This is all thanks to Ruby/GStreamer. Use the video method to setup a Shoes::Video object.

 Shoes.app width: 400, height: 300 do
   background gold..cyan, angle: 90
   space = ' ' * 3
   v = video 'http://is.gd/xZ6Jih'
   links = para space, 
     link('play'){v.play; links.move(0, 300)}, 
     space, link('pause'){v.pause}, 
     space, link('-1sec'){v.time -= 1000},
     space, link('+1sec'){v.time += 1000}, 
     top: 250
   msg = para left: 250, top: 300
   every do
     msg.text = fg("#{(v.position*100).to_i}% " + 
       "(#{v.time/1000}/#{v.length.to_i/1000}sec)", 
       darkcyan)
   end
 end

In addition to video formats, some audio formats are also supported, such as MP3, WAV and Ogg Vorbis.

hide() » self

Hides the video. If already playing, the video will continue to play. This just turns off display of the video. One possible use of this method is to collapse the video area when it is playing an audio file, such as an MP3.

Note: Green Shoes doesn't support hide method so far.

length() » a number

The full length of the video in milliseconds. Returns nil if the video is not yet loaded.

Moves the video to specific coordinates, the (left, top) being the upper left hand corner of the video.

Note: Green Shoes doesn't support move method so far.

pause() » self

Pauses the video, if it is playing.

playing?() » true of false

Returns true if the video is currently playing. Or, false if the video is paused or stopped.

play() » self

Starts playing the video, if it isn't already playing. If already playing, the video is restarted from the beginning.

position() » a decimal

The position of the video as a decimanl number (a Float) between the beginning (0.0) and the end (1.0). For instance, a Float value of 0.5 indicates the halfway point of the video.

Sets the position of the video using a Float value. To move the video to its 25% position: @video.position = 0.25.

remove() » self

Removes the video from its slot. This will stop the video as well.

Note: Green Shoes doesn't support remove method so far.

show() » self

Reveals the video, if it has been hidden by the hide() method.

Note: Green Shoes doesn't support show method so far.

stop() » self

Stops the video, if it is playing.

time() » a number

The time position of the video in milliseconds. So, if the video is 10 seconds into play, this method would return the number 10000.

Set the position of the video to a time in milliseconds.

toggle() » self

Toggles the visibility of the video. If the video can be seen, then hide is called. Otherwise, show is called.

Note: Green Shoes doesn't support tobble method so far.

Next: AndSoForth