code style cleanup
This commit is contained in:
parent
452fa34b36
commit
7c43c185f5
3 changed files with 12 additions and 19 deletions
|
@ -1,5 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
const flvjs = require("flv.js");
|
||||||
const iosCorrectedInnerHeight = require("ios-inner-height");
|
const iosCorrectedInnerHeight = require("ios-inner-height");
|
||||||
const router = require("../router.js");
|
const router = require("../router.js");
|
||||||
const views = require("../util/views.js");
|
const views = require("../util/views.js");
|
||||||
|
@ -50,19 +51,15 @@ class PostMainView {
|
||||||
postContainerNode.querySelector(".post-overlay"),
|
postContainerNode.querySelector(".post-overlay"),
|
||||||
ctx.post
|
ctx.post
|
||||||
);
|
);
|
||||||
// suppurt flv play
|
if (ctx.post.mimeType === "video/x-flv" && flvjs.isSupported()) {
|
||||||
if (ctx.post.mimeType === "video/x-flv") {
|
const video = document.querySelector(".post-content video");
|
||||||
const flvjs = require("flv.js");
|
const src = video.querySelector("source").src
|
||||||
if (flvjs.isSupported()) {
|
const player = flvjs.createPlayer({
|
||||||
const video = document.querySelector(".post-content video");
|
type: 'flv',
|
||||||
const src = video.querySelector("source").src
|
url: src,
|
||||||
const player = flvjs.createPlayer({
|
});
|
||||||
type: 'flv',
|
player.attachMediaElement(video);
|
||||||
url: src,
|
player.load();
|
||||||
});
|
|
||||||
player.attachMediaElement(video);
|
|
||||||
player.load();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx.post.type === "video" || ctx.post.type === "flash") {
|
if (ctx.post.type === "video" || ctx.post.type === "flash") {
|
||||||
|
|
|
@ -66,12 +66,8 @@ def get_extension(mime_type: str) -> Optional[str]:
|
||||||
def is_flash(mime_type: str) -> bool:
|
def is_flash(mime_type: str) -> bool:
|
||||||
return mime_type.lower() == "application/x-shockwave-flash"
|
return mime_type.lower() == "application/x-shockwave-flash"
|
||||||
|
|
||||||
def is_flv(mime_type: str) -> bool:
|
|
||||||
return mime_type.lower() == "video/x-flv"
|
|
||||||
|
|
||||||
|
|
||||||
def is_video(mime_type: str) -> bool:
|
def is_video(mime_type: str) -> bool:
|
||||||
return mime_type.lower() in ("application/ogg", "video/mp4", "video/webm")
|
return mime_type.lower() in ("application/ogg", "video/mp4", "video/webm", "video/x-flv")
|
||||||
|
|
||||||
|
|
||||||
def is_image(mime_type: str) -> bool:
|
def is_image(mime_type: str) -> bool:
|
||||||
|
|
|
@ -619,7 +619,7 @@ def update_post_content(post: model.Post, content: Optional[bytes]) -> None:
|
||||||
post.type = model.Post.TYPE_ANIMATION
|
post.type = model.Post.TYPE_ANIMATION
|
||||||
else:
|
else:
|
||||||
post.type = model.Post.TYPE_IMAGE
|
post.type = model.Post.TYPE_IMAGE
|
||||||
elif mime.is_video(post.mime_type) or mime.is_flv(post.mime_type):
|
elif mime.is_video(post.mime_type):
|
||||||
post.type = model.Post.TYPE_VIDEO
|
post.type = model.Post.TYPE_VIDEO
|
||||||
else:
|
else:
|
||||||
raise InvalidPostContentError(
|
raise InvalidPostContentError(
|
||||||
|
|
Reference in a new issue