Class: Decidim::Meetings::MeetingIframeEmbedder
- Inherits:
-
Object
- Object
- Decidim::Meetings::MeetingIframeEmbedder
- Defined in:
- app/services/decidim/meetings/meeting_iframe_embedder.rb
Overview
This class handles the streaming url to be included in the iframe present in the live event. For some services it is required to transform a bit the structure of the URL.
Instance Method Summary collapse
- #embed_code(request_host) ⇒ Object
- #embed_transformed_url(request_host) ⇒ Object
- #embeddable? ⇒ Boolean
-
#initialize(online_meeting_service_url) ⇒ MeetingIframeEmbedder
constructor
Public: Initializes the service.
Constructor Details
#initialize(online_meeting_service_url) ⇒ MeetingIframeEmbedder
Public: Initializes the service. online_meeting_service_url - A String containing the url of the online meeting
13 14 15 |
# File 'app/services/decidim/meetings/meeting_iframe_embedder.rb', line 13 def initialize(online_meeting_service_url) @online_meeting_service_url = online_meeting_service_url end |
Instance Method Details
#embed_code(request_host) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/services/decidim/meetings/meeting_iframe_embedder.rb', line 36 def (request_host) return nil if parsed_online_meeting_uri.nil? <<~HTML <div class="disabled-iframe"> <!-- <iframe allow="camera; microphone; fullscreen; display-capture; autoplay" loading="lazy" src="#{(request_host)}" style="height: 100%; width: 100%; border: 0px;"></iframe> --> </div> HTML end |
#embed_transformed_url(request_host) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/services/decidim/meetings/meeting_iframe_embedder.rb', line 17 def (request_host) return nil if parsed_online_meeting_uri.nil? case parsed_online_meeting_uri.host when "www.youtube.com" transform_youtube_url(parsed_online_meeting_uri) when "www.twitch.tv" transform_twitch_url(parsed_online_meeting_uri, request_host) else online_meeting_service_url end end |
#embeddable? ⇒ Boolean
30 31 32 33 34 |
# File 'app/services/decidim/meetings/meeting_iframe_embedder.rb', line 30 def return nil if parsed_online_meeting_uri.nil? .include?(parsed_online_meeting_uri.host) end |