Fixed autoplay

This commit is contained in:
Papick Garcia Taboada committed 2015-05-21 17:34:34 +02:00
1 parent dbb5b8cb65
commit 61bfbe6806
2 files changed
+5 -39

No files matched your search

@@ -1,8 +1,6 @@
package com.sap.sailing.gwt.home.client.shared.media;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.event.dom.client.ClickEvent;
@@ -137,13 +135,5 @@ public class MediaPage extends Composite {
videoDisplayUi = new VideoJSPlayer(true, autoplay);
videoDisplayUi.setSource(videoCandidateInfo.getSourceRef(), videoCandidateInfo.getMimeType());
videoDisplayHolderUi.setWidget(videoDisplayUi);
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
if (videoCandidateInfo.getThumbnailRef() == null) {
GWT.log(videoDisplayUi.getThumbnailData());
}
}
});
}
}
@@ -71,7 +71,7 @@ public class VideoJSPlayer extends Widget {
@Override
protected void onLoad() {
_onLoad();
_onLoad(autoplay);
}
@@ -112,7 +112,7 @@ public class VideoJSPlayer extends Widget {
*
* @param uniqueId
*/
native void _onLoad() /*-{
native void _onLoad(boolean autoplay) /*-{
var player = $wnd
.videojs(
@@ -120,13 +120,12 @@ public class VideoJSPlayer extends Widget {
{
"width" : "auto",
"height" : "auto",
"playsInline" : true,
"customControlsOnMobile" : true
},
function() {
if (this.@com.sap.sailing.gwt.ui.client.media.VideoJSPlayer::autoplay) {
}, function() {
console.log("play: " + autoplay);
if (autoplay) {
this.play();
}
});
@@ -135,27 +134,4 @@ public class VideoJSPlayer extends Widget {
}-*/;
public native String getThumbnailData() /*-{
var player = this.@com.sap.sailing.gwt.ui.client.media.VideoJSPlayer::player;
var oImg = document.createElement("img");
oImg.setAttribute('src', player.poster());
oImg.style.display = "none";
document.body.appendChild(oImg);
var canvas = document.createElement("canvas");
canvas.width = oImg.width;
canvas.height = oImg.height;
// Copy the image contents to the canvas
var ctx = canvas.getContext("2d");
ctx.drawImage(oImg, 0, 0);
var dataURL = canvas.toDataURL("image/png");
return dataURL;
}-*/;
}