Flare-k

Connect with Mongo Atlas

import "@babel/polyfill";
import dotenv from "dotenv";
import express from "express";
import morgan from "morgan";
......
/* eslint-disable no-console */
import getBlobDuration from "get-blob-duration";
const videoContainer = document.getElementById("jsVideoPlayer");
const videoPlayer = document.querySelector("#jsVideoPlayer video");
const playBtn = document.getElementById("jsPlayButton");
......@@ -89,8 +92,12 @@ const formatDate = (seconds) => {
function getCurrentTime() {
currentTime.innerHTML = formatDate(Math.floor(videoPlayer.currentTime));
}
function setTotalTime() {
const totalTimeString = formatDate(videoPlayer.duration);
async function setTotalTime() {
const blob = await fetch(videoPlayer.src).then((response) => response.blob());
const duration = await getBlobDuration(blob);
console.log(duration);
const totalTimeString = formatDate(duration);
totalTime.innerHTML = totalTimeString;
setInterval(getCurrentTime, 1000);
}
......
......@@ -4,7 +4,7 @@ import dotenv from "dotenv";
dotenv.config();
mongoose.connect(process.env.MONGO_URL, {
mongoose.connect(process.env.MONGO_URL_PROD, {
useNewUrlParser: true,
useFindAndModify: false,
});
......
......@@ -16,6 +16,7 @@
"author": "Kang Yeon Wook",
"license": "ISC",
"dependencies": {
"@babel/cli": "^7.10.3",
"@babel/core": "^7.9.6",
"@babel/node": "^7.8.7",
"@babel/polyfill": "^7.10.1",
......@@ -32,6 +33,7 @@
"express": "^4.17.1",
"express-session": "^1.17.1",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"get-blob-duration": "^1.1.1",
"helmet": "^3.22.0",
"mongoose": "^5.9.15",
"morgan": "^1.10.0",
......
This diff is collapsed. Click to expand it.