我正在尝试创建一个Angular应用程序,其中包含用户需要在几分钟不活动后注销的视频.
如果用户正常或全屏观看视频,则无需注销.
如果选项卡处于非活动状态且视频正在播放,我需要在不活动后将其注销.
我正在尝试使用此处Core UI's
找到的反应模板构建反应仪表板。
CSS
.top-stick {
position: sticky !important;
position: -webkit-sticky;
top: 5rem;
overflow-y: auto;
height: calc(100vh - 5rem);
}
Run Code Online (Sandbox Code Playgroud)
JSX
<div className="animated fadeIn">
<Row className="app-scrollable-body">
<Col xs="12" sm="4" md="3" className="top-stick">
<Card className="toic">
<CardBody>
Lorem ipsum dolor sit amet
</CardBody>
</Card>
</Col>
<Col xs="12" sm="8" md="9">
<Card>
<CardHeader>Card title</CardHeader>
<CardBody>
Lorem ipsum dolor sit amet
</CardBody>
</Card>
</Col>
</Row>
<div className="app-fixed-footer">
<span>
<a href="https://coreui.io">CoreUI</a> © 2018
creativeLabs.
</span>
<span className="ml-auto">
Powered by{" "}
<a href="https://coreui.io/react">CoreUI for React</a>
</span> …
Run Code Online (Sandbox Code Playgroud) 我正在构建一个CRA App
usingnpm run build
然后当我尝试部署它或使用时serve build/
我收到以下错误。
Error: "Loading chunk 1 failed.
(error: http://localhost:5000/admin/static/js/1.d30b6723.chunk.js)"
react-dom.production.min.js:4406
Unhandled promise rejection Error: "Loading chunk 1 failed.
(error: http://localhost:5000/admin/static/js/1.d30b6723.chunk.js)"
es6.promise.js:145
Run Code Online (Sandbox Code Playgroud)
新来的反应,我该如何解决这个问题?用Core UI
我的模板。
控制台中的网络给出 404。
我正在尝试将文件从本地主机上传到服务器,但在我的网络控制台中出现以下错误,状态代码为 500:
Content-Type 中没有多部分边界参数
我已经启用cors
了我的 nginx 反向代理。我的 AJAX 请求是这样的:
var files = document.getElementById('candidatePhoto').files;
if (!files.length) {
return alert('Please choose a file to upload first.');
}
var file = files[0];
var form = new FormData();
form.append("files", file);
var settings = {
"async": true,
"crossDomain": true,
"url": "http://example.com",
"method": "POST",
"headers": {
"Content-Type": "multipart/form-data"
},
"processData": false,
"contentType": false,
"data": form,
success: function(data) {
console.log("Success", data);
addPhoto(data);
},
error: function(err) {
console.log("Error", err);
alert("Error: " + err);
}
}
Run Code Online (Sandbox Code Playgroud)
我的 …
我已经在类似于此的Angular组件的构造函数中实现了Visibility API
constructor() {
var hidden, state, visibilityChange;
if (typeof document.hidden !== "undefined") {
hidden = "hidden";
visibilityChange = "visibilitychange";
state = "visibilityState";
}
document.addEventListener(visibilityChange, function() {
if(status == hidden){
console.log("Hidden");
}
else if(status != hidden){
console.log("Visible");
}
}, false);
}
pauseVideo(){
//Video pause code
}
Run Code Online (Sandbox Code Playgroud)
我需要暂停视频,即pauseVideo()
在“可见性”更改为“隐藏”时调用该方法,该怎么办?
我正在尝试使用整页 PDF puppeteer
,我的代码是这样的,但结果是多个页面的高度等于页面的高度。
我如何解决这个问题?TIA。
const puppeteer = require("puppeteer");
function sleep(ms) {
return new Promise(resolve => {
setTimeout(resolve, ms);
});
}
(async () => {
const browser = await puppeteer.launch({
headless: true
});
const page = await browser.newPage();
await page.goto("http://localhost:3000/longpage", {
waitUntil: "networkidle2"
});
let height = await page.evaluate(
() => document.documentElement.offsetHeight
);
console.log("Height", height);
await page.pdf({
path: "hni.pdf",
printBackground: true,
margin: "none",
height: height + "px"
});
await browser.close();
})();
Run Code Online (Sandbox Code Playgroud) 我正在尝试将视频另存为.avi
格式,但是我不断收到错误消息"could not demultiplex stream"
。我主要想保存灰度视频。
有什么codec
我需要使用的吗?
现在我尝试了 XVID, DIVX
import imutils
import cv2
import numpy as np
interval = 30
outfilename = 'output.avi'
threshold=100.
fps = 10
cap = cv2.VideoCapture("video.mp4")
ret, frame = cap.read()
height, width, nchannels = frame.shape
fourcc = cv2.cv.CV_FOURCC(*'DIVX')
out = cv2.VideoWriter( outfilename,fourcc, fps, (width,height))
ret, frame = cap.read()
frame = imutils.resize(frame, width=500)
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY)
while(True):
frame0 = frame
ret, frame = cap.read()
frame = imutils.resize(frame, width=500)
frame = cv2.cvtColor(frame, …
Run Code Online (Sandbox Code Playgroud) 我正在尝试删除MongoDB文档,但没有被删除
我的架构是
const mongoose = require("mongoose");
const InvestorSchema = mongoose.Schema({
name: {
type: String,
index: true,
required: true
},
logoUrl: {
type: String,
required: true
},
website: {
type: String,
index: true,
unique: true,
required: true
}
});
module.exports = mongoose.model("Investor", InvestorSchema);
Run Code Online (Sandbox Code Playgroud)
并且我尝试使用这些文件,但没有一个文件删除了该文件。此外,我还在localhost
没有用户和角色的情况下运行。
// Required models
const InvestorModel = require("mongoose").model("Investor");
const deletedInvestor = InvestorModel.remove({ _id });
const deletedInvestor = InvestorModel.deleteOne({ _id });
const deletedInvestor = InvestorModel.findByIdAndRemove(_id);
const deletedInvestor = InvestorModel.findOneAndRemove({_id});
const deletedInvestor = InvestorModel.findByIdAndDelete(_id);
const deletedInvestor = InvestorModel.findOneAndDelete({_id}); …
Run Code Online (Sandbox Code Playgroud)