Skip to content

Commit

Permalink
warn IOS users when stream is live
Browse files Browse the repository at this point in the history
  • Loading branch information
DaWe35 committed Oct 10, 2020
1 parent 405d8aa commit 1930248
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion get/player.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$portal = '';
}

$stmt = $db->prepare("SELECT streamid, userid, title, description, scheule_time, visibility FROM stream WHERE streamid = ? LIMIT 1");
$stmt = $db->prepare("SELECT streamid, userid, title, description, scheule_time, visibility, finished FROM stream WHERE streamid = ? LIMIT 1");
if (!$stmt->execute([$_GET['s']])) {
exit('Database error');
}
Expand Down
11 changes: 11 additions & 0 deletions view/player.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
<div class="container">
<div class="row">
<div class="col-sm-12 col-md-9 p-0">
<div id="ios_warning">
Sorry, IOS does not support HLS streaming.<br>
<a href="vlc-x-callback://x-callback-url/stream?url=<?= $stream_url ?>">Open in VLC</a><br>
If it's not working, open VLC and play this network file: <?= URL . $stream_url ?>
</div>
<video id="my_video_1" controls preload="auto" poster="<?= image_print($stream['streamid'], 1920) ?>">Sorry, HTML5 video is not supported in your browser</video>
</div>
<div class="col-sm-8 col-md-3 p-0 minnit-chat-container">
Expand All @@ -44,6 +49,12 @@
</button> -->

<script>

// Display warning on IOS
var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
if (iOS && <?= $stream['streamid'] ?> == 0) {
$('#ios_warning').css('display', 'initial')
}

// Create HLS video element
var video = document.getElementById('my_video_1');
Expand Down

0 comments on commit 1930248

Please sign in to comment.