_includes/video-player.html in wai-website-theme-1.2 vs _includes/video-player.html in wai-website-theme-1.3
- old
+ new
@@ -1,18 +1,55 @@
+{%- assign langs = site.data.lang -%}
<div class="video-container" data-video-type="">
- <video preload="metadata" data-youtube-id="{{include.yt-id}}" width="450">
- {%- assign captions = include.captions | split: ',' %}{% for caption in captions %}{% assign c = caption | split: '|' %}<track src="{{c[0] | relative_url }}" label="{{c[2]}}" kind="captions" srclang="{{c[1]}}" {% if forloop.first %}default{% endif %} />{% endfor -%}
- {%- assign subtitles = include.subtitles | split: ',' %}{% for subtitle in subtitles %}{% assign s = subtitle | split: '|' %}<track src="{{s[0] | relative_url }}" label="{{s[2]}}" kind="subtitles" srclang="{{s[1]}}" />{% endfor -%}
- {%- assign descriptions = include.descriptions | split: ',' %}{% for desc in descriptions %}{% assign d = desc | split: '|' %}<track src="{{ d[0] | relative_url }}" label="{{d[2]}}" kind="descriptions" srclang="{{d[1]}}" />{% endfor -%}
+ <video preload="metadata" data-youtube-id="{{include.yt-id}}" data-youtube-nocookie="true" width="450"{% if page.lang == "nl" %} data-lang="nl"{% endif %}>
+ {%- assign captions = include.captions | split: ',' -%}
+ {%- for caption in captions -%}
+ {%- assign c = caption | split: '|' -%}
+ {%- assign clangcode = c[1] -%}
+ {%- assign l = langs[clangcode].nativeName -%}
+ <track src="{{ include.path | append: c[0] | relative_url }}" label="{{l}}" kind="captions" srclang="{{c[1]}}" {% if c[2] == "default" %}default{% endif %}>
+ {%- endfor -%}
+ {%- assign subtitles = include.subtitles | split: ',' -%}
+ {%- for subtitle in subtitles -%}
+ {%- assign s = subtitle | split: '|' -%}
+ {%- assign slangcode = s[1] -%}
+ {%- assign l = langs[slangcode].nativeName -%}
+ <track src="{{ include.path | append: s[0] | relative_url }}" label="{{l}}" kind="subtitles" srclang="{{s[1]}}" {% if s[2] == "default" %}default{% endif %}>
+ {%- endfor -%}
+ {%- assign descriptions = include.descriptions | split: ',' -%}
+ {%- for desc in descriptions -%}
+ {%- assign d = desc | split: '|' -%}
+ {%- assign dlangcode = d[1] -%}
+ {%- assign l = langs[dlangcode].nativeName -%}
+ <track src="{{ include.path | append: d[0] | relative_url }}" label="{{l}}" kind="descriptions" srclang="{{d[1]}}" {% if d[2] == "default" %}default{% endif %}>
+ {%- endfor -%}
</video>
</div>
{% if include.yt-id-ad %}
<div class="video-container" data-video-type="audio-described">
- <video preload="metadata" data-youtube-id="{{include.yt-id-ad}}" width="450">
- {%- assign captions = include.captions-ad | split: ',' %}{% for caption in captions %}{% assign c = caption | split: '|' %}<track src="{{c[0] | relative_url }}" label="{{c[2]}}" kind="captions" srclang="{{c[1]}}" {% if forloop.first %}default{% endif %} />{% endfor -%}
- {%- assign subtitles = include.subtitles-ad | split: ',' %}{% for subtitle in subtitles %}{% assign s = subtitle | split: '|' %}<track src="{{s[0] | relative_url }}" label="{{s[2]}}" kind="subtitles" srclang="{{s[1]}}" />{% endfor -%}
- {%- assign descriptions = include.descriptions-ad | split: ',' %}{% for desc in descriptions %}{% assign d = desc | split: '|' %}<track src="{{ d[0] | relative_url }}" label="{{d[2]}}" kind="descriptions" srclang="{{d[1]}}" />{% endfor -%}
+ <video preload="metadata" data-youtube-id="{{include.yt-id-ad}}" data-youtube-nocookie="true" width="450">
+ {%- assign captions = include.captions-ad | split: ',' -%}
+ {%- for caption in captions -%}
+ {%- assign c = caption | split: '|' -%}
+ {%- assign clangcode = c[1] -%}
+ {%- assign l = langs[clangcode].nativeName -%}
+ <track src="{{ include.path | append: c[0] | relative_url }}" label="{{l}}" kind="captions" srclang="{{c[1]}}" {% if c[2] == "default" %}default{% endif %}>
+ {%- endfor -%}
+ {%- assign subtitles = include.subtitles-ad | split: ',' -%}
+ {%- for subtitle in subtitles -%}
+ {%- assign s = subtitle | split: '|' -%}
+ {%- assign slangcode = s[1] -%}
+ {%- assign l = langs[slangcode].nativeName -%}
+ <track src="{{ include.path | append: s[0] | relative_url }}" label="{{l}}" kind="subtitles" srclang="{{s[1]}}" {% if s[2] == "default" %}default{% endif %}>
+ {%- endfor -%}
+ {%- assign descriptions = include.descriptions-ad | split: ',' -%}
+ {%- for desc in descriptions -%}
+ {%- assign d = desc | split: '|' -%}
+ {%- assign dlangcode = d[1] -%}
+ {%- assign l = langs[dlangcode].nativeName -%}
+ <track src="{{ include.path | append: d[0] | relative_url }}" label="{{l}}" kind="descriptions" srclang="{{d[1]}}" {% if d[2] == "default" %}default{% endif %}>
+ {%- endfor -%}
</video>
</div>
<p><button id="audio_description_button"><svg aria-hidden="true" class="icon-audio-description "><use xlink:href="{{ "/assets/images/icons.svg#icon-audio-description" | relative_url }}"></use></svg> <span>Enable Audio Description</span></button></p>
{% endif %}
@@ -62,10 +99,12 @@
}
}
var audiodescribed = document.querySelectorAll('[data-video-type="audio-described"]');
+ if (audiodescribed) {
+
Array.prototype.forEach.call(audiodescribed, function(el, i){
el.setAttribute('hidden', true);
});
var adbutton = document.querySelector('#audio_description_button');
@@ -95,7 +134,9 @@
e.target.setAttribute('data-status', 'audio-described');
e.target.querySelector('span').innerHTML = 'Disable Audio Description';
}
});
+ }
+
}());
-</script>
\ No newline at end of file
+</script>