|
@@ -1,11 +1,15 @@
|
|
|
-// var utils = require('/src/lib/utils.js')
|
|
|
var utils = require("../utils");
|
|
|
var tipsMaskTmpl = __inline("../../tpl/tips-mask.tmpl");
|
|
|
+
|
|
|
class Index {
|
|
|
constructor() {
|
|
|
this.init();
|
|
|
this.id = utils.getParam("id");
|
|
|
this.getVideoInfo();
|
|
|
+ this.resize = false;
|
|
|
+ if (utils.isMobile()) {
|
|
|
+ this.onResize();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
init() {
|
|
@@ -48,9 +52,15 @@ class Index {
|
|
|
}
|
|
|
|
|
|
onResize() {
|
|
|
+ this.resize = true;
|
|
|
var $video = $("video").eq(0);
|
|
|
+ if (utils.isMobile()) {
|
|
|
+ $video.addClass("full-screen");
|
|
|
+ } else {
|
|
|
+ $video.removeClass("full-screen");
|
|
|
+ }
|
|
|
$(".shade").css("visibility", "visible");
|
|
|
- $('.btn-play').css("visibility", "visible");
|
|
|
+ $(".btn-play").css("visibility", "visible");
|
|
|
$("#title").css({ left: $video.css("marginLeft") });
|
|
|
$(".btn").css({
|
|
|
right: `${parseFloat($video.css("marginRight").slice(0, -2)) +
|
|
@@ -79,15 +89,17 @@ class Index {
|
|
|
var data = ret.data;
|
|
|
var self = this;
|
|
|
$("video")
|
|
|
- .attr("poster", data.cover)
|
|
|
- .attr("src", data.url)
|
|
|
.on("loadedmetadata", function() {
|
|
|
self.onResize();
|
|
|
- });
|
|
|
+ })
|
|
|
+ .on("error", function(error) {
|
|
|
+ alert(error);
|
|
|
+ })
|
|
|
+ .attr("poster", data.cover)
|
|
|
+ .attr("src", data.url);
|
|
|
$("#title").text(data.description);
|
|
|
document.title = data.name;
|
|
|
}
|
|
|
-
|
|
|
openApp() {
|
|
|
var self = this;
|
|
|
var downloadLink = $(".btn")
|