fix: video 没有返回宽度会造成无法显示

This commit is contained in:
yanmao 2021-12-18 17:49:27 +08:00
parent 27798432aa
commit 53fae937e8
3 changed files with 23 additions and 8 deletions

View File

@ -325,9 +325,10 @@ class VideoComponent extends Card<VideoValue> {
height = Math.round(width * this.rate);
}
this.container?.css({
width: `${width}px`,
width: width > 0 ? `${width}px` : '',
});
this.videoContainer.css('width', `${width}px`);
this.videoContainer.css('width', width > 0 ? `${width}px` : '');
//this.videoContainer.css('height', `${height}px`);
}
@ -350,12 +351,13 @@ class VideoComponent extends Card<VideoValue> {
width = Math.round(width);
height = Math.round(height);
this.videoContainer?.css({
width: `${width}px`,
width: width > 0 ? `${width}px` : '',
//height: `${height}px`,
});
this.container?.css({
width: `${width}px`,
width: width > 0 ? `${width}px` : '',
});
this.setValue({
width,
height,

View File

@ -3,6 +3,7 @@ const path = require('path');
const sendToWormhole = require('stream-wormhole');
const ffmpeg = require('fluent-ffmpeg');
const { Controller } = require('egg');
const os = require('os');
class UploadController extends Controller {
constructor(cxt) {
@ -166,12 +167,24 @@ class UploadController extends Controller {
name: sourceName,
};
try {
const platform = os.platform();
const osDir = platform === 'linux' ? 'linux' : 'win';
ffmpeg.setFfmpegPath(
path.join(app.baseDir, './app/ffmpeg/win/ffmpeg.exe'),
path.join(
app.baseDir,
`./app/ffmpeg/${osDir}/ffmpeg${
osDir === 'win' ? '.exe' : ''
}`,
),
);
ffmpeg.setFfprobePath(
path.join(app.baseDir, './app/ffmpeg/win/ffprobe.exe'),
const probePath = path.join(
app.baseDir,
`./app/ffmpeg/${osDir}/ffprobe${
osDir === 'win' ? '.exe' : ''
}`,
);
if (osDir !== 'win') fs.chmod('777', probePath);
ffmpeg.setFfprobePath(probePath);
ffmpeg.ffprobe(filePath, (err, metadata) => {
const fileName = new Date().getTime() + '-v-image.png'; // stream对象也包含了文件名大小等基本信息

View File

@ -13,7 +13,7 @@ module.exports = (appInfo, appConfig = {}) => {
const files =
'.docx, .doc, .dotx, .dot, .rtf, .txt, .html, .htm, .pdf, .xls, .xlsx, .xltx, .xlsm, .xlt, .csv, .pptx, .ppt, .potx, .pot, .ppsx, .pps, .pages, .numbers, .nmbtemplate, .template, .key, .keynote, .kth, .et, .ett, .dps, .dpt, .wps, .wpt, .txt, .md, .mark, .markdown, .xmind, .graffle, .gtemplate, .gstencil, .mindnode, .vpp, .mmap, .mpp, .svg, .png, .bmp, .jpg, .jpeg, .gif, .tif, .tiff, .emf, .webp, .sketch, .psd, .ai, .rp, .rplib, .aep, .c4d, .fbx, .xd, .ai, .mp4, .mp3, .zip, .rar, .gz, .tgz, .gzip, .7z, .tar, .abap, .ada, .adp, .ahk, .as, .as3, .asc, .ascx, .asm, .asp, .awk, .bash, .bash_login, .bash_logout, .bash_profile, .bashrc, .bat, .bib, .bsh, .build, .builder, .c, .c++, .capfile, .cc, .cfc, .cfm, .cfml, .cl, .clj, .cls, .cmake, .cmd, .coffee, .config, .cpp, .cpt, .cpy, .cs, .cshtml, .cson, .csproj, .css, .ctp, .cxx, .dart, .d, .ddl, .di, .diff, .disco, .dml, .dtd, .dtml, .el, .emakefile, .erb, .erl, .f, .f90, .f95, .fs, .fsi, .fsscript, .fsx, .gemfile, .gemspec, .gitconfig, .go, .groovy, .gvy, .Hcp, .h, .h++, .haml, .handlebars, .hbs, .hh, .hpp, .hrl, .hs, .htc, .hxx, .html, .htm, .idl, .iim, .inc, .inf, .ini, .inl, .ipp, .irbrc, .pug, .jade, .jav, .java, .js, .json, .jsp, .jsx, .l, .less, .lhs, .lisp, .log, .lst, .ltx, .lua, .m, .mak, .make, .manifest, .master, .md, .markdn, .markdown, .mdown, .mkdn, .ml, .mli, .mll, .mly, .mm, .mud, .makefile, .nfo, .opml, .osascript, .p, .pas, .patch, .php, .php2, .php3, .php4, .php5, .phtml, .pl, .plx, .perl, .pm, .pod, .pp, .profile, .ps1, .ps1xml, .psd1, .psm1, .pss, .pt, .py, .pyw, .proto, .r, .rake, .rb, .rbx, .rc, .rdf, .re, .reg, .rest, .resw, .resx, .rhtml, .rjs, .rprofile, .rpy, .rs, .rss, .rst, .ruby, .rxml, .s, .sass, .scala, .scm, .sconscript, .sconstruct, .script, .scss, .sgml, .sh, .shtml, .sml, .svn-base, .swift, .sql, .sty, .tcl, .tex, .textile, .tld, .tli, .tmpl, .tpl, .ts, .tsx, .vb, .vi, .vim, .vmg, .webpart, .wsp, .wsdl, .xhtml, .xml, .xoml, .xsd, .xslt, .yaml, .yaws, .yml, .zsh';
config.multipart = {
fileSize: 10485760,
fileSize: '20mb',
whitelist: files.split(',').map((name) => name.trim()),
};
config.assets = {