Commit 93bfa0ca authored by Pavel Mishakov's avatar Pavel Mishakov

пытаюсь понять почему на сервере не работает getDisplayMedia, плюс некоторые мелкие ошибки исправил

parent a44401a0
Pipeline #337 passed with stages
in 2 minutes and 14 seconds
const helpers = require('./helpers');
const express = require('express');
const router = express.Router();
const auth = require('./middleware/auth.js');
const upload = require('./middleware/upload.js');
const permit = require('./middleware/permit.js');
const axios = require('axios');
const moment = require('moment')
const BigBrother = require('./models/BigBrother');
const config = require('./config');
const multer = require('multer')
const {nanoid} = require('nanoid')
const storage = multer.diskStorage({
destination: (req, file, cb) => {
// try {
// fs.opendir("./" + moment().format("DD_MM_YYYY"), (err) => {
// console.log("directory exists")
// })
// } catch {
// console.log(req.body)
// fs.mkdir("./public/" + moment().format("DD_MM_YYYY"), { recursive: true }, (err) => {
// if (err) throw err;
// });
// }
cb(null, config.uploadPath + "/contentLinks");
},
filename:(req, file, cb) => {
cb(null, nanoid() + (file.originalname !== "blob" ? path.extname(file.originalname) : ".jpg"));
}
});
const upload = multer({storage});
router.get('/', async(req, res) => {
......
*
!.gitignore
!invoice.jpg
\ No newline at end of file
!invoice.jpg
!/contentLinks
\ No newline at end of file
......@@ -40,19 +40,19 @@ const BigBrother = () => {
}
function getUserMedia(options) {
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
// if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
return navigator.mediaDevices.getUserMedia(options)
}
if (navigator.getUserMedia) {
return navigator.getUserMedia(options)
}
if (navigator.webkitGetUserMedia) {
return navigator.webkitGetUserMedia(options)
}
if (navigator.mozGetUserMedia) {
return navigator.mozGetUserMedia(options)
}
throw new Error('getUserMedia is not defined')
// }
// if (navigator.getUserMedia) {
// return navigator.getUserMedia(options)
// }
// if (navigator.webkitGetUserMedia) {
// return navigator.webkitGetUserMedia(options)
// }
// if (navigator.mozGetUserMedia) {
// return navigator.mozGetUserMedia(options)
// }
// throw new Error('getUserMedia is not defined')
}
async function takeScreenshotStream() {
......@@ -92,6 +92,7 @@ const BigBrother = () => {
})
} catch (ex) {
errors.push(ex)
setLoader(false)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment