Class: Workarea::Storefront::VideoEmbedder::Vimeo
- Inherits:
-
Object
- Object
- Workarea::Storefront::VideoEmbedder::Vimeo
- Defined in:
- app/services/workarea/storefront/video_embedder/vimeo.rb
Instance Method Summary collapse
- #attrs ⇒ Object
-
#initialize(embed_code, options = {}) ⇒ Vimeo
constructor
A new instance of Vimeo.
- #url_params ⇒ Object
Constructor Details
#initialize(embed_code, options = {}) ⇒ Vimeo
5 6 7 8 |
# File 'app/services/workarea/storefront/video_embedder/vimeo.rb', line 5 def initialize(, = {}) = = end |
Instance Method Details
#attrs ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/services/workarea/storefront/video_embedder/vimeo.rb', line 10 def attrs { id: vimeo_id, src: "#{url}?#{url_params}", webkitallowfullscreen: '', mozallowfullscreen: '', data: { vimeo_api: { player_id: vimeo_id, mute: [:mute] }.to_json } } end |
#url_params ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'app/services/workarea/storefront/video_embedder/vimeo.rb', line 25 def url_params parsed_query = Rack::Utils.parse_query(uri.query) parsed_query['api'] = 1 parsed_query['autoplay'] = [:autoplay] parsed_query['loop'] = [:loop_playback] parsed_query['player_id'] = vimeo_id uri.query = URI.encode_www_form(parsed_query) end |