Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/video play after upload #160

Open
wants to merge 3 commits into
base: mnt
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions public/javascripts/spacedeck_directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ function setup_directives() {
var el = this.el;
var scope = this.vm.$root;
var video = el.querySelectorAll("video")[0];
var play_button = el.querySelectorAll(".play")[0];
var pause_button = el.querySelectorAll(".pause")[0];
var stop_button = el.querySelectorAll(".stop")[0];
// var play_button = el.querySelectorAll(".play")[0];
// var pause_button = el.querySelectorAll(".pause")[0];
// var stop_button = el.querySelectorAll(".stop")[0];
var player_state = "stop";

var update_view = function() {
Expand All @@ -52,9 +52,9 @@ function setup_directives() {
}

var play_func = function() {
var playPromise = video.play();
if (playPromise !== undefined) {
playPromise.then(_ => {
const video_promise = video.play();
if (video_promise !== undefined) {
video_promise.then(_ => {
// Automatic playback started!
player_state = "playing";
update_view();
Expand Down Expand Up @@ -92,24 +92,24 @@ function setup_directives() {
el.addEventListener("remote_pause",pause_func);
el.addEventListener("remote_stop",stop_func);

play_button.addEventListener(edown, function(evt) {
try {
play_func();
spacedeck.presenter_send_media_action(a._id,"video","play",video.currentTime);
} catch (e) {
// catch InvalidStateError
}
}, false);

pause_button.addEventListener(edown, function(evt) {
pause_func();
spacedeck.presenter_send_media_action(a._id,"video","pause",video.currentTime);
}, false);

stop_button.addEventListener(edown, function(evt) {
stop_func();
spacedeck.presenter_send_media_action(a._id,"video","stop",0);
}, false);
// play_button.addEventListener(edown, function(evt) {
// try {
// play_func();
// spacedeck.presenter_send_media_action(a._id,"video","play",video.currentTime);
// } catch (e) {
// // catch InvalidStateError
// }
// }, false);

// pause_button.addEventListener(edown, function(evt) {
// pause_func();
// spacedeck.presenter_send_media_action(a._id,"video","pause",video.currentTime);
// }, false);

// stop_button.addEventListener(edown, function(evt) {
// stop_func();
// spacedeck.presenter_send_media_action(a._id,"video","stop",0);
// }, false);
}
});

Expand Down
20 changes: 18 additions & 2 deletions views/partials/space.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,27 @@
</div>

<!-- video -->
<div v-if="a.view.major_type == 'video'" class="video">
<div v-if="a.view.major_type == 'video'" v-videoplayer="a" class="video" v-bind:style="a.view.inner_style + ';background-image: url('+a.view.thumbnail_uri+');'">
<video preload="metadata" controls="auto" v-bind:poster="a.view.thumbnail_uri">
<source v-for="rep in a.view.payload_alternatives" v-bind:src="rep.payload_uri" v-bind:type="rep.mime" />
<source v-if="a.view.payload_uri && a.view.mime" v-bind:src="a.view.payload_uri" v-bind:type="a.view.mime" />
<source v-if="a.view.payload_uri && a.mime" v-bind:src="a.view.payload_uri" v-bind:type="a.view.mime" />
</video>
<!-- <div class="tl-controls">
<div class="btn btn-md btn-toggle btn-round" v-bind:class="{alt:a.player_view.state=='playing'}">
<span class="btn-option play">
<span class="icon icon-controls-play"></span>
</span>

<span class="btn-option pause">
<span class="icon icon-controls-pause"></span>
</span>
</div>

<span class="btn btn-md btn-round btn-icon stop" v-show="a.player_view.state=='playing' || a.player_view.state=='paused'">
<span class="icon icon-controls-stop"></span>
</span>

</div> -->
<div class="spinner"></div>
<div class="progress" v-bind:style="{width: a.view.progress+'%'}">{{a.description}}</div>
</div>
Expand Down