{"id":16382438,"url":"https://github.com/andyobtiva/glimmer-cw-video","last_synced_at":"2025-03-23T03:33:20.701Z","repository":{"id":40031417,"uuid":"260725171","full_name":"AndyObtiva/glimmer-cw-video","owner":"AndyObtiva","description":"Video custom widget for Glimmer DSL for SWT","archived":false,"fork":false,"pushed_at":"2023-06-15T21:53:14.000Z","size":4750,"stargazers_count":2,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-13T01:05:06.353Z","etag":null,"topics":["desktop","desktop-widget","glimmer","glimmer-custom-widget","gui","jruby","mac","macos","ruby","swt","windows"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AndyObtiva.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-02T16:12:06.000Z","updated_at":"2024-10-29T03:40:57.000Z","dependencies_parsed_at":"2024-10-28T15:24:14.562Z","dependency_job_id":"a871fa0f-be83-49fd-8fe1-cd96381c0bc2","html_url":"https://github.com/AndyObtiva/glimmer-cw-video","commit_stats":{"total_commits":39,"total_committers":2,"mean_commits":19.5,"dds":0.3846153846153846,"last_synced_commit":"e7511a0d7f5deb108638d4fc4023edf28535213e"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndyObtiva%2Fglimmer-cw-video","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndyObtiva%2Fglimmer-cw-video/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndyObtiva%2Fglimmer-cw-video/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndyObtiva%2Fglimmer-cw-video/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndyObtiva","download_url":"https://codeload.github.com/AndyObtiva/glimmer-cw-video/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244267475,"owners_count":20425835,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["desktop","desktop-widget","glimmer","glimmer-custom-widget","gui","jruby","mac","macos","ruby","swt","windows"],"created_at":"2024-10-11T04:05:23.948Z","updated_at":"2025-03-23T03:33:20.083Z","avatar_url":"https://github.com/AndyObtiva.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Video 1.1.0\n## [\u003cimg src=\"https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png\" height=40 /\u003e Glimmer Custom Widget](https://github.com/AndyObtiva/glimmer#custom-widget-gem)\n[![Gem Version](https://badge.fury.io/rb/glimmer-cw-video.svg)](http://badge.fury.io/rb/glimmer-cw-video)\n[![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-cw-video.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-cw-video)\n[![Coverage Status](https://coveralls.io/repos/github/AndyObtiva/glimmer-cw-video/badge.svg?branch=master)](https://coveralls.io/github/AndyObtiva/glimmer-cw-video?branch=master)\n[![Maintainability](https://api.codeclimate.com/v1/badges/b46ff4b09463b86aa7aa/maintainability)](https://codeclimate.com/github/AndyObtiva/glimmer-cw-video/maintainability)\n[![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n![Video Widget](images/glimmer-video-widget.png)\n\nVideo is a [Glimmer DSL for SWT Custom Widget](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#custom-widgets) for playing videos via the `video` [Glimmer DSL](https://github.com/AndyObtiva/glimmer#glimmer-dsl-syntax) keyword.\n\nFeatured in [Math Bowling 2](https://github.com/AndyObtiva/MathBowling)\n\n![Math Bowling 2](https://github.com/AndyObtiva/MathBowling/raw/master/MathBowling-2.0.0-Demo-4Players.gif)\n\n## Platforms\n\nThis has been tested and confirmed to be working on:\n- Mac\n- Windows\n\n## Pre-requisites\n\n- [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) application, [Glimmer DSL for SWT custom shell](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#custom-shells), or another [Glimmer DSL for SWT custom widget](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#custom-widgets)\n- [JRuby version required by Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt#pre-requisites)\n- [Java version required by Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt#pre-requisites)\n\n## Setup\n\n### Glimmer Application\n\nAdd the following to a [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) application `Gemfile`:\n\n```ruby\ngem 'glimmer-cw-video', '1.1.0'\n```\n\nRun:\n\n```\njruby -S bundle\n```\n\n(or just `bundle` if using RVM)\n\n### Glimmer Custom Shell or Glimmer Custom Widget\n\nWhen reusing the video custom widget in a [Glimmer DSL for SWT custom shell](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#custom-shells) or [custom widget](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#custom-widgets), you can follow the same steps for a [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) application, and then add a require statement to your library file:\n\n```ruby\nrequire 'glimmer-cw-video'\n# ... more require statements follow\n```\n\n## API Options\n\nHere are the options to pass in as hash arguments to the `video` widget keyword (see in [Samples](#samples)):\n- `autoplay` (true [default] or false): plays video automatically as soon as loaded\n- `controls` (true [default] or false): displays controls\n- `looped` (true or false [default]): plays video in looped mode\n- `background` (Glimmer color [default: white]): sets background color just like with any other widget\n- `fit_to_width` (true [default] or false): fits video width to widget allotted width regardless of video's original size. Maintains video aspect ratio.\n- `fit_to_height` (true [default] or false): fits video height to widget allotted height regardless of video's original size. Maintains video aspect ratio.\n- `offset_x` (integer [default: 0]): offset from left border. Could be a negative number if you want to show only an area of the video. Useful when fit_to_width is false to pick an area of the video to display.\n- `offset_y` (integer [default: 0]): offset from top border. Could be a negative number if you want to show only an area of the video. Useful when fit_to_height is false to pick an area of the video to display.\n\n## API Methods\n\n- `#play`: plays video\n- `#pause`: pauses video\n- `#toggle`: toggles video playback, playing if paused, and pausing if playing.\n- `#reload`: reloads video restarting from beginning\n- `#position`: position in seconds (and fractions)\n- `#position=`: seeks a new position in video\n- `#duration`: length of video, maximum video position possible\n- `#loaded?`: returns true when video has been initially loaded or reloaded\n- `#playing?`: returns true when video is actively playing\n- `#paused?`: returns true when video is not playing\n- `#ended?`: returns true when video has reached the end (position == duration)\n- `#volume`: returns video volume (0.0 - 1.0 float value)\n- `#volume=`: sets video volume (0.0 - 1.0 float value)\n- `#volume_up(value=0.05)`: bumps video volume up by a specified value or default\n- `#volume_down(value=0.05)`: bumps video volume down by a specified value or default\n- `#mute`: mutes video\n- `#unmute`: unmutes video\n- `#muted?`: returns true if video is muted\n- `#toggle_muted`: mutes/unmutes video depending on `muted?` attribute\n\n\n## API Observer Events\n\n(see in [Samples](#samples))\n\n- `on_loaded`: invoked when video `#loaded?` becomes true\n- `on_ended`: invoked when video `#ended?` becomes true\n- `on_playing`: invoked when video `#playing?` becomes true\n- `on_paused`: invoked when video `#paused?` becomes true\n\n## Samples\n\nRun this command after installing the gem to list available Video samples via the Glimmer Meta-Sample (note that you would have to restart the Glimmer Meta-Sample after every Video sample run because of an unresolved minor issue):\n\n```\nglimmer samples\n```\n\n### Hello, Video!\n\nRun from Glimmer Meta-Sample or by cloning this project and executing:\n\n```\nglimmer samples/video/hello_video.rb\n```\n\nGlimmer Code (from [samples/video/hello_video.rb](samples/video/hello_video.rb)):\n\n```ruby\nrequire_relative '../../lib/glimmer-cw-video'\n\ninclude Glimmer\n\nvideo_file = File.expand_path('../videos/Clouds_passing_by_CCBY_NatureClip.mp4', __FILE__)\n\nshell {\n  text 'Hello, Video!'\n  minimum_size 384, 240\n  \n  video(file: video_file)\n}.open\n```\n\nGlimmer App:\n\n![glimmer cw video hello video](images/glimmer-cw-video-hello-video.png)\n\n### Hello, Looped Video with Black Background!\n\nRun from Glimmer Meta-Sample or by cloning this project and executing:\n\n```\nglimmer samples/video/hello_looped_video_with_black_background.rb\n```\n\nGlimmer Code (from [samples/video/hello_looped_video_with_black_background.rb](samples/video/hello_looped_video_with_black_background.rb)):\n\n```ruby\nrequire_relative '../../lib/glimmer-cw-video'\n\ninclude Glimmer\n\nvideo_file = File.expand_path('../videos/Blackpool_Timelapse.mp4', __FILE__)\n\nshell {\n  text 'Hello, Looped Video with Black Background!'\n  minimum_size 1024, 640\n\n  video(file: video_file, looped: true, background: :black)\n}.open\n```\n\nGlimmer App:\n\n![glimmer cw video hello video](images/glimmer-cw-video-hello-looped-video-with-black-background.png)\n\n### Hello, Video Observers!\n\nRun from Glimmer Meta-Sample or by cloning this project and executing:\n\n```\nglimmer samples/video/hello_video_observers.rb\n```\n\nGlimmer Code (from [samples/video/hello_video_observers.rb](samples/video/hello_video_observers.rb)):\n\n```ruby\nrequire_relative '../../lib/glimmer-cw-video'\n\ninclude Glimmer\n\nvideo_file = File.expand_path('../videos/Ants.mp4', __FILE__)\n\ndef display_video_status(video, status)\n  message_box {\n    text status\n    message \"#{video.position.round(2)}/#{video.duration.round(2)} seconds have elapsed.\"\n  }.open\nend\n\n@shell = shell {\n  text 'Hello, Video Observers!'\n  minimum_size 800, 500\n\n  @video = video(file: video_file, background: :black) {\n    on_swt_show { |event|\n      # set focus as soon as the SWT widget is shown to grab keyboard events below\n      @video.set_focus\n    }\n    \n    on_key_pressed { |event|\n      case event.keyCode\n      when swt(:space), swt(:cr)\n        @video.toggle\n      when swt(:arrow_left)\n        @video.rewind\n      when swt(:arrow_right)\n        @video.fast_forward\n      when swt(:arrow_up)\n        @video.volume_up\n      when swt(:arrow_down)\n        @video.volume_down\n      end\n    }\n    \n    on_playing {\n      display_video_status(@video, 'Playing')\n    }\n    \n    on_paused {\n      display_video_status(@video, 'Paused')\n    }\n    \n    on_ended {\n      display_video_status(@video, 'Ended')\n    }\n  }\n}\n@shell.open\n```\n\nGlimmer App:\n\n![glimmer cw video hello video observers](images/glimmer-cw-video-hello-video-observers.png)\n\nDialog for video playing event:\n\n![glimmer cw video hello video observers](images/glimmer-cw-video-hello-video-observers-playing-event.png)\n\nDialog for video paused event:\n\n![glimmer cw video hello video observers](images/glimmer-cw-video-hello-video-observers-paused-event.png)\n\nDialog for video ended event:\n\n![glimmer cw video hello video observers](images/glimmer-cw-video-hello-video-observers-ended-event.png)\n\n## TODO\n\n[TODO.md](TODO.md)\n\n## Change Log\n\n[CHANGELOG.md](CHANGELOG.md)\n\n## Contributing to glimmer-cw-video\n \n- Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.\n- Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.\n- Fork the project.\n- Start a feature/bugfix branch.\n- Commit and push until you are happy with your contribution.\n- Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.\n- Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.\n\n## License\n\n[MIT](LICENSE.txt)\n\nCopyright (c) 2020-2023 - Andy Maleh.\n\n--\n\n[\u003cimg src=\"https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png\" height=40 /\u003e](https://github.com/AndyObtiva/glimmer-dsl-swt) Built for [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) (JRuby Desktop Development GUI Framework).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandyobtiva%2Fglimmer-cw-video","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandyobtiva%2Fglimmer-cw-video","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandyobtiva%2Fglimmer-cw-video/lists"}