Skip to content
Snippets Groups Projects
Commit fc513c9c authored by Arnaud Levy's avatar Arnaud Levy
Browse files

wip

parent 1b98fb0d
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,10 @@ class Communication::Block::Template::Video < Communication::Block::Template::Ba
video_provider.embed
end
def video_embed_with_defaults
video_provider.embed_with_defaults
end
protected
def video_provider
......
class Video::Provider::Dailymotion < Video::Provider::Default
DOMAINS = [
'dailymotion.com',
'www.dailymotion.com',
'dai.ly'
]
......
......@@ -37,6 +37,10 @@ class Video::Provider::Default
iframe_url
end
def embed_with_defaults
embed
end
def iframe_tag(**iframe_options)
content_tag(:iframe, nil, default_iframe_options.merge(iframe_options))
end
......
......@@ -7,13 +7,9 @@ class Video::Provider::Peertube < Video::Provider::Default
video_url.split('/w/').last
end
def host
video_url.split('/w/').first
end
# https://docs.joinpeertube.org/support/doc/api/embeds#quick-start
def iframe_url
"#{host}/videos/embed/#{identifier}"
"#{instance}/videos/embed/#{identifier}"
end
def correct?
......@@ -22,6 +18,10 @@ class Video::Provider::Peertube < Video::Provider::Default
protected
def instance
video_url.split('/w/').first
end
def url_looks_like_peertube?
"/w/".in?(video_url) || "/videos/watch/".in?(video_url)
end
......
......@@ -24,4 +24,9 @@ class Video::Provider::Youtube < Video::Provider::Default
def iframe_url
"https://www.youtube.com/embed/#{identifier}"
end
# L'autoplay est à 1 uniquement parce que l'iframe n'est pas chargée
def embed_with_defaults
"#{iframe}?autoplay=1"
end
end
......@@ -10,6 +10,8 @@
<%= block.template.video_poster %>
embed: >-
<%= block.template.video_embed %>
embed_with_defaults: >-
<%= block.template.video_embed_with_defaults %>
iframe: >-
<%= block.template.video_iframe %>
<% end %>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment