aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--assets/js/lustiges-script.js22
-rw-r--r--index.php3
-rw-r--r--template/assemblies/embed-form.phtml10
-rw-r--r--template/assemblies/player/video.phtml4
-rw-r--r--view/embed.php2
5 files changed, 32 insertions, 9 deletions
diff --git a/assets/js/lustiges-script.js b/assets/js/lustiges-script.js
index 0aa87ff..fff3896 100644
--- a/assets/js/lustiges-script.js
+++ b/assets/js/lustiges-script.js
@@ -524,16 +524,28 @@ $(function() {
// embed-form
$(function() {
- $('.embed-form #size').on('click', function() {
+ var originalsrc;
+ $('.embed-form #size, .embed-form #autoplay').on('click', function() {
var
- $size = $(this),
+ $size = $('.embed-form #size'),
selected = $size.val().split(','),
- $codefield = $('#embed-code')
+ $size = $('.embed-form #size'),
+ $codefield = $('#embed-code'),
+ $urlfield = $('#embed-url'),
$iframe = $( $codefield.val() ),
- $iframe.attr({width: selected[0], height: selected[1]});
+ autoplay = $('.embed-form #autoplay').prop('checked');
+
+ if(!originalsrc)
+ originalsrc = $iframe.attr('src');
+
+ var src = originalsrc + (autoplay ? '' : 'no-autoplay/');
+
+ $iframe.attr({width: selected[0], height: selected[1]});
+ $iframe.attr({src: src});
$codefield.val( $iframe.prop('outerHTML') );
- }).trigger('click');
+ $urlfield.val( src );
+ })
$('.embed-form').on('click', 'input[type=text]', function() {
$(this).select();
diff --git a/index.php b/index.php
index 11495df..4d2bfc7 100644
--- a/index.php
+++ b/index.php
@@ -143,12 +143,13 @@ try {
require('view/room.php');
}
- else if(preg_match('@^embed/([^/]+)/(hd|sd|audio|slides)/(native|translated|stereo)$@', $route, $m))
+ else if(preg_match('@^embed/([^/]+)/(hd|sd|audio|slides)/(native|translated|stereo)(/no-autoplay)?$@', $route, $m))
{
$_GET = array(
'room' => $m[1],
'selection' => $m[2],
'language' => $m[3],
+ 'autoplay' => !isset($m[4]),
);
require('view/embed.php');
}
diff --git a/template/assemblies/embed-form.phtml b/template/assemblies/embed-form.phtml
index 7e545f8..617f477 100644
--- a/template/assemblies/embed-form.phtml
+++ b/template/assemblies/embed-form.phtml
@@ -17,6 +17,12 @@
<option selected value="1920,1080">1920×1080</option>
<? endif ?>
</select>
+
+ <div class="checkbox">
+ <label>
+ <input checked="checked" type="checkbox" id="autoplay"> Autoplay
+ </label>
+ </div>
</div>
</div>
@@ -30,8 +36,8 @@
</div>
<div class="form-group">
- <label for="url">Embed URL:</label>
- <input type="text" id="url" class="form-control" readonly value="<?=h($stream->getEmbedUrl())?>">
+ <label for="embed-url">Embed URL:</label>
+ <input type="text" id="embed-url" class="form-control" readonly value="<?=h($stream->getEmbedUrl())?>">
</div>
</div>
</div>
diff --git a/template/assemblies/player/video.phtml b/template/assemblies/player/video.phtml
index 3ffc333..9149a4f 100644
--- a/template/assemblies/player/video.phtml
+++ b/template/assemblies/player/video.phtml
@@ -1,6 +1,8 @@
<div style="max-width: <?=h($stream->getVideoWidth())?>px; max-height: <?=h($stream->getVideoHeight())?>px;" class="video-wrap">
<video
- autoplay="autoplay"
+ <? if(!isset($autoplay) || $autoplay == true): ?>
+ autoplay="autoplay"
+ <? endif ?>
preload="auto"
width="<?=h($stream->getVideoWidth())?>"
height="<?=h($stream->getVideoHeight())?>"
diff --git a/view/embed.php b/view/embed.php
index b5bc49b..ccd4b98 100644
--- a/view/embed.php
+++ b/view/embed.php
@@ -14,4 +14,6 @@ echo $tpl->render(array(
'title' => $stream->getDisplay(),
'room' => $room,
'stream' => $stream,
+
+ 'autoplay' => @$_GET['autoplay'],
));