Sha256: 543ba04592fffba2de64dfe017160e290e833fba7e8b6783be04c9e318a07dd2
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
require "clutter-gtk" require "clutter-gst" module Mireru module Widget class Video class << self def create(file) clutter = ClutterGtk::Embed.new stage = clutter.stage stage.background_color = Clutter::Color.new(:black) video_texture = ClutterGst::VideoTexture.new stage.add_child(video_texture) video_texture.signal_connect("eos") do |_video_texture| _video_texture.progress = 0.0 _video_texture.playing = true end video_texture.filename = file video_texture.playing = true define_events(stage, video_texture) clutter.signal_connect("destroy") do video_texture.playing = false end clutter end def define_events(stage, video_texture) stage.signal_connect("event") do |_stage, event| handled = false case event.type when Clutter::EventType::KEY_PRESS animation = nil case event.key_symbol when Clutter::Keys::KEY_space state = video_texture.playing? video_texture.playing = state ? false : true end handled = true end handled end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mireru-0.2.1 | lib/mireru/widget/video.rb |