Skip to content

Instantly share code, notes, and snippets.

@AndyObtiva
Created April 16, 2020 21:16
Show Gist options
  • Save AndyObtiva/2ed89f4f9c3288e65e470a32173558ef to your computer and use it in GitHub Desktop.
Save AndyObtiva/2ed89f4f9c3288e65e470a32173558ef to your computer and use it in GitHub Desktop.
Glimmer Video Widget Observers
# ...
def display_video_status(video, status)
message_box = MessageBox.new(video.swt_widget.getShell)
message_box.setText(status)
message = "Video Position: #{video.position} seconds\n"
message += "Video Duration: #{video.duration} seconds"
message_box.setMessage(message)
message_box.open
end
@shell = shell {
minimum_size 800, 500
@video = video(file: video_file, background: :black) {
on_playing {
display_video_status(@video, 'Playing')
}
on_paused {
display_video_status(@video, 'Paused')
}
on_ended {
display_video_status(@video, 'Ended')
}
}
}
@shell.open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment