How to build a server video with cutom Tag on each video?
I want to build a backend that returns me videos regarding their tag (like TikTok).
What are the best things to use as a database to store the videos but also to create the api?
Thank you for your answers.
do you know?
how many words do you know
See also questions close to this topic
-
Images with Firebase and Python Flask API
I am currently developing an API using Firebase from google and Python's Flask libraries. It is a proyect where I am in need of saving images to the DB and then adress them in the API. I would also like to know how to relate the image to an item in the database, say posting an image of Juan, and that is linked with ALL the information from Juan inside the DB. Thanks!
-
Need help finding an api or real world data related to read time of people
I need to create a project for which I require real world data of reading time per page or article. Can anyone help me find data or api in which I can get this data I tried to search for some api but they had information related to books instead of their reading time of a person.
-
Using Websocket Channel in React
I am working on a project where I have to make an api call to a websocket, and display certain information based on that call. As you can see I have used the subscribe portion of the channel in my call. Now I'm not sure what to do if anything with the 2nd two set of bracket. Do I need to include them my call as well, or do they come along with the subscription? And from which of them would I be using the information I need to display? In other words which one is the information I am recieving?
'''
const ws = new WebSocket("wss://ws-feed.exchange.coinbase.com"); const apiCall = { type: "subscribe", product_ids: [ "ETH-USD", "BTC-USD" ], channels: ["level2"] }; ws.onopen = (event) => { ws.send(JSON.stringify(apiCall)); }; ws.onmessage = function (event) { const json = JSON.parse(event.data); console.log(`[message] Data received from server: ${json}`); };
'''
-
Having error with .cer file for As2 communication for validation
Trying to setup the As2 communication for walmart vendor. Using the as2gateway site and have everything correct for communication on both sides. Receiving the email on site but getting error.
MDN report
Message Disposition Notification
Reporting-UA: AdroitLogic AS2-X/latest Original-Recipient: rfc822; Larry-Smith1 Final-Recipient: rfc822; Larry-Smith1 Original-Message-ID: <CLEO-20220507_032305226-77N95E@08925485US00_Larry-Smith1-K> Disposition: automatic-action/MDN-sent-automatically;failed/error: authentication-failed Received-Content-MIC: u722DTqJUUlmR35anz0AUcEfbhc=, sha1
MDN for Message-ID: <CLEO-20220507_032305226-77N95E@08925485US00_Larry-Smith1-K> From: 08925485US00 To: Larry-Smith1 Received on: Sat May 07 03:23:05 UTC 2022 Status: failed Comment: Message processing failed due to the following errors Errors encountered : error: Cannot validate message signers of : <CLEO-20220507_032305226-77N95E@08925485US00_Larry-Smith1-K> - Cause : Trust anchor for certification path not found. - Signers : CN=Larry-Smith1, OU=Prod, O=WM, L=Bentonville, C=US
Original Message Tracking Information (provided by Harmony):
Sent-Content-MIC: u722DTqJUUlmR35anz0AUcEfbhc=, sha1 Sent-Message-ID: CLEO-20220507_032305226-77N95E@08925485US00_Larry-Smith1-K Transfer-ID: AS2-20220506_222305222-K;40771661-61a7-494b-b8f6-301405e2c918 Original-Filename: sendTest_X12 Original-Subject: EDIINTDATA Original-Send-Date: Sat, 07 May 2022 03:23:05 GMT Signed-Request: true Encrypted-Request: true Compressed-Request: false Encryption-Algorithm: TripleDES Key-Algorithm: RSA Signature-Algorithm: RSA Hash-Algorithm: SHA-1 Response-Method: synchronous Sender: 08925485US00 Recipient: Larry-Smith1 Host: 48794_TestConn Mailbox: 48794_TestConn Restart-On-Failure: false Signed-MDN: true Signed-By: C=us,ST=X,L=X,OU=EDI Integration,O=Larry Smith Books,CN=X Serial-No: 1806D466C49 Signer-Signature-Algorithm: rsaEncryption Signer-Hash-Algorithm: SHA1
It is a private encryption. This could be why getting error but don't know how to resolve. Have been reading articles to try to find a solution or how to get certificate authority validation.
-
How to make code run every request for a GET api
const http = require('http'); const url = require('url'); const fs = require("fs"); const host = 'ip'; const port = 1234; let requestListener = function (req, res) { //some code }; const server = http.createServer(requestListener); server.listen(port, host, () => { console.log(`Server is running on http://${host}:${port}`); });
Is it possible to make the code in requestListener run every time someone makes a request? Currently its just when the program runs for the first time, then if there's something in there, such as reading from a file, and it won't update.
-
How to create a folder insisde server depending on how many times user has uploaded files?
I have a form where users can send 1,2,3,...,x files to upload to server. When user uploads x files for first time, inside folder it must create a new folder with versions like
version-1
when user uploads new files how can i know what is the current version to create a new folder with this new version uploaded from user.I am trying to get something similar to image bellow.
Iam using
PHP
but i think it's irrelevant because it's a logical problem -
Streaming RTSP Locally through HTML5
I am attempting to host a local website on my RaspberryPi using raspivid, and HTML 5. So far, I have managed to get the RTSP link, and view this live stream on VLC player across various devices. The link looks as follows:
RTSP://1XX.1XX.X.1XX:PORT/
Now attempting to embed this stream into the server site, I have tried the video tag;
<video src="rtsp://1XX.1XX.X.1XX:PORT"> Your browser does not support the VIDEO tag and/or RTP streams. </video>
which returns the error:
Failed to load resource: net::ERR_UNKNOWN_URL_SCHEME
I have also tried the to directly embed the VLC player;
<OBJECT classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab" width="640" height="480" id="vlc" events="True"> <param name="Src" value="rtsp://1XX.1XX.X.1XX:PORT" /> <param name="ShowDisplay" value="True" /> <param name="AutoLoop" value="False" /> <param name="AutoPlay" value="True" /> <embed id="vlcEmb" type="application/x-google-vlc-plugin" version="VideoLAN.VLCPlugin.2" autoplay="yes" loop="no" width="640" height="480" target="rtsp://1XX.1XX.X.1XX:PORT" ></embed> </OBJECT>
this method displays 'plug in not supported' on chrome, and doesn't show at all on safari. I would preferably like to find a method of embedding this stream, without requiring specific browser plug-ins, as the server will be accessed by various devices and browsers on the network.
If anyone has any advice or ideas on how to get this up and running, or if this is possible at all, I'd be super grateful, as I've spent a couple of days on this now, and can't seem to find any relevant/up-to-date guidance on this anywhere.
If possible, I would like to avoid any port forwarding. I am happy to implement simple APIs if necessary, however I want to keep the project fairly 'bare bones', and not overcomplicate things. The website is static, and I'd prefer to not require any backend/PHP type stuff.
-
Streaming M3U8 Format
I have build VoD platform and i need to stream the recorded video file (with 4k resoluation, Mp4 format). I'm using AWS Elastic Transcoder and AWS Cloudfront for streaming. Sometime i'm facing streaming issue.
Below steps for transcoding flow.
- Upload the Recorded Video in AWS S3.
- Create the Job in AWS Elastic Transcoder with preset value as HLS 1M, HLS 2M and HLS 400k formats. It is generate the m3u8 as playlist and ts chunk.
- Pointing the S3 bucket into cloudfront
- In Web player, mapped the cloudfront url to play the video.
Need help, how to resolve the streaming issue.
-
nginx live streaming only audio not webcam
I have implemented the recommended steps as described in several sites (https://www.digitalocean.com/community/tutorials/how-to-set-up-a-video-streaming-server-using-nginx-rtmp-on-ubuntu-20-04) to have live streaming from nginx web server but at the end I listen only the audio but not webcam. The instructions are too simple to make a mistake. I set up an Ubundu 20.04, install nginx with rtmp module, no ufw (firewall), configure the nginx.conf file as it needs etc... I use OBS to capture my audio and webcam and send it as RTMP streaming to nginx. No error in the nginx log. As player to play the RTMP stream I use the VLC. I tested the OBS to send RTMP to YouTube and everything ok. Also when I change the device capture in OBS from webcam to desktop then it works!!! Why only the webcam doesn't show when I use nginx? Thanks
-
How can I pass in an unknown amount of objects in a dynamic react form to my sql database?
I'm having trouble connecting 0-6 dynamically rendered form elements to the backend/database using react. Perhaps the way I'm attempting to do this is not supported? Any advice would be really appreciated.
Index.js file in "backend" directory:
const express = require('express'); const bodyParser = require('body-parser'); const cors = require('cors'); const mysql = require('mysql'); //const { restart } = require('nodemon'); const app = express(); app.use(cors()); app.use(bodyParser.urlencoded({extended: true})); app.use(express.json()); app.listen('3001', () => { console.log("Running on port 3001."); }); const db = mysql.createPool ({ host: '[redacted]', user: '[redacted]', password: '[redacted]', database: '[redacted]' }); app.get('/', function(req, res){ res.send("backend"); }); app.post('/', function (req, res) { db.getConnection(function (err, db) { const lastName = req.body.lastName; const firstName = req.body.firstName; const address = req.body.address; const street = req.body.street; const apartment = req.body.apartment; const city = req.body.city; const zipcode = req.body.zipcode; const phone = req.body.phone; const dateOfArrival = req.body.dateOfArrival; const dateReceived = req.body.dateReceived; const countryOfOrigin = req.body.countryOfOrigin; const immigrationStatus = req.body.immigrationStatus; const speaksEnglish = req.body.speaksEnglish; const notes = req.body.notes; const childField = req.body.childField; //and array of information about the children const sqlInsertParent = "INSERT INTO Parent (parent_id, lastName, firstName, address, street, apartment, city, zipcode, " + "phone, dateOfArrival, dateReceived, countryOfOrigin, immigrationStatus, speaksEnglish, notes) VALUES " + "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; const sqlInsertChild = "INSERT INTO Children (child_id, parent_id, childFirstName, gender, age, shoe, childNotes) VALUES (?, ?, ?, ?, ?, ?, ?)"; //insert the parent into the database db.query(sqlInsertParent, ["", lastName, firstName, address, street, apartment, city, zipcode, phone, dateOfArrival, dateReceived, countryOfOrigin, immigrationStatus, speaksEnglish, notes], (err, result) => { console.log(err); }); //Get the max parent_id from the Parent table (this will go into the Children table) db.query('SELECT max(parent_id) FROM Parent', function (error, results, fields) { /*NOTE: The Parent table will never be null because even if it's empty at first, the insert into the parent table comes before the insert into the child table.*/ if (error) { throw error; } //Convert the result into a number: var s = JSON.stringify(results); var json = JSON.parse(s); var obj = json[0]; objVal = Object.values(obj); var maxParentID = Number(objVal); //Insert the children into the database //https://stackoverflow.com/questions/51193704/react-input-setstate-for-array-of-objects // for(let i = 0; i < childField.length; i++) { // db.query(sqlInsertChild, ["", maxParentID,childField[i].childFirstName, childField[i].gender, childField[i].age, // childField[i].shoe, childField[i].childNotes], (err, result) => { // console.log(err); // }); // } }); }); });
help.js in "frontend" directory -- this is where the form is:
import Sponsors from "./Sponsors"; import ChildForm from "./ChildForm"; import React, { useState } from "react"; import axios from 'axios'; //allows us to create api requests // this component renders the request help page const Help = () => { const [sample, sampleSet] = useState(null); console.log(sample); const addChild = (e) => { var children = [] switch (e.target.value) { case '0' : setChildrenState(null); case '1' : setChildrenState( <ChildForm childTitle={'Child 1'} sampleSet={sampleSet}/> ) break; case '2' : setChildrenState( <> <ChildForm childTitle={'Child 1'}/> <ChildForm childTitle={'Child 2'}/> </> ) break; case '3' : setChildrenState( <> <ChildForm childTitle={'Child 1'}/> <ChildForm childTitle={'Child 2'}/> <ChildForm childTitle={'Child 3'}/> </> ) break; case '4' : setChildrenState( <> <ChildForm childTitle={'Child 1'}/> <ChildForm childTitle={'Child 2'}/> <ChildForm childTitle={'Child 3'}/> <ChildForm childTitle={'Child 4'}/> </> ) break; case '5' : setChildrenState( <> <ChildForm childTitle={'Child 1'}/> <ChildForm childTitle={'Child 2'}/> <ChildForm childTitle={'Child 3'}/> <ChildForm childTitle={'Child 4'}/> <ChildForm childTitle={'Child 5'}/> </> ) break; case '6' : setChildrenState( <> <ChildForm childTitle={'Child 1'}/> <ChildForm childTitle={'Child 2'}/> <ChildForm childTitle={'Child 3'}/> <ChildForm childTitle={'Child 4'}/> <ChildForm childTitle={'Child 5'}/> <ChildForm childTitle={'Child 6'}/> </> ) break; default: //no default because the user can only select 1-> 6 } } const [lastName, setLastName] = useState(''); const [firstName, setFirstName] = useState(''); const [address, setAddress] = useState(''); const [street, setStreet] = useState(''); const [apartment, setApartment] = useState(''); const [city, setCity] = useState(''); const [zipcode, setZipcode] = useState(''); const [phone, setPhone] = useState(''); const [dateOfArrival, setDateOfArrival] = useState(null); const [dateReceived, setDateReceived] = useState(null); const [countryOfOrigin, setCountryOfOrigin] = useState(''); const [immigrationStatus, setImmigrationStatus] = useState(null); const [speaksEnglish, setSpeaksEnglish] = useState(null); const [notes, setNotes] = useState(''); //const [childField, setChildrenState] = useState(null); const submitHelpForm = () => { console.log(childField); axios.post('http://localhost:3001/', {lastName: lastName, firstName: firstName, address: address, street: street, apartment: apartment, city: city, zipcode: zipcode, phone: phone, dateOfArrival: dateOfArrival, dateReceived: dateReceived, countryOfOrigin: countryOfOrigin, immigrationStatus: immigrationStatus, speaksEnglish: speaksEnglish, notes: notes, /*childField: childField*/ }).then(() => { alert('successful insert'); }); }; return ( <div className="help-request-container"> <h3 className="request-header"> If you are a newcomer and your children need basic necessities, please complete the form below. We will contact you soon with more information about becoming a Starting Point family. </h3> <form className="request-help-form" /*onSubmit={submitHelpForm} */> <input type={'text'} placeholder='Parent Last Name' maxlength='250' required onChange={(e) => {setLastName(e.target.value)}}/> <input type={'text'} placeholder='Parent First Name' maxlength='250' required onChange={(e) => {setFirstName(e.target.value)}}/> <input type={'text'} placeholder='Street Number - example: 2311' maxlength='10' required onChange={(e) => {setAddress(e.target.value)}}/> <input type={'text'} placeholder='Street Name - example: Hamlet Way' maxlength='250' required onChange={(e) => {setStreet(e.target.value)}}/> <input type={'text'} placeholder='Apt/Suite/Unit/Building/Floor - example: Apt. 4' maxlength='20' onChange={(e) => {setApartment(e.target.value)}}/> <input type={'text'} placeholder='City - example: Manhattan' maxlength='25' required onChange={(e) => {setCity(e.target.value)}}/> <input type={'text'} placeholder='Postal Code - example: 80456' maxlength='15' required onChange={(e) => {setZipcode(e.target.value)}}/> <input type={'text'} placeholder="Phone Number" required onChange={(e) => {setPhone(e.target.value)}}/> <label for="date">Input Date arrived in US:</label> <input type={'date'} placeholder='Date arrived in US' required onChange={(e) => {setDateOfArrival(e.target.value)}}/> <label for="date">Input Current Date:</label> <input type={'date'} placeholder='Current Date' required onChange={(e) => {setDateReceived(e.target.value)}}/> <input type={'text'} placeholder='Country of Origin - example: Afghanistan' maxlength='250' required onChange={(e) => {setCountryOfOrigin(e.target.value)}}/> <label for="Immigration Status">Select an Immigration Status:</label> <select id="immigration status" name="immigrationStatus" onChange={(e) => {setImmigrationStatus(e.target.value)}}> <option value="Other">Other</option> <option value="SIV">SIV</option> <option value="Evacuee">Evacuee</option> <option value="Parolee">Parolee</option> <option value="Asylee">Asylee</option> <option value="Diversity Visa Holder">Diversity Visa Holder</option> </select> <label for="language">Do you speak English?</label> <select id="language" name="language" onChange={(e) => {setSpeaksEnglish(e.target.value)}}> <option value="No">No</option> <option value="Yes">Yes</option> </select> <input type={"text"} placeholder='Notes About Parent' maxlength='250' onChange={(e) => {setNotes(e.target.value)}}/> <label for="children">How many children do you have?</label> <select id="children" name="children" onChange={addChild}> <option value={0}>No Response</option> <option value={1}>1</option> <option value={2}>2</option> <option value={3}>3</option> <option value={4}>4</option> <option value={5}>5</option> <option value={6}>6</option> </select> <div className="child-add-form"> {childField} </div> <input type="submit" value="Submit" onClick={submitHelpForm}></input> </form> {/*{ console.log(child) }*/} {/* render sponsors component at bottom of page. */} <Sponsors /> </div> ) } export default Help
-
REST client API data types with laravel
What form of data should I choose as input for a rest api with laravel? form-data, raw, urlencoded or others?
-
MongoDB aggregate and then flatten
FULL DISCLOSURE: I'm a MongoDB noob
I'm dealing with a legacy DB structure. A part of my MongoDB looks like this currently:
- Events (_id, name (string), ...)
- Orders (_id, eventId (as string), products (array of {prodIdentifier (string), quantity (number)}), customer_ID (string), signee (string), sign_time (date), ...)
- Products (_id, prodIdentifier (string), price (number), sku (string), ...)
The relations are as follows:
- Event 1..N Orders (via eventId)
- Orders 1..N Products (via products array)
I need to query in a way that given an eventId, I return
Order ID
Customer Name (can be a cascade request / premeditated by frontend),
Product SKU,
Product Name,
Quantity,
Value (quantity * price),
Signee Name,
Sign timeMind that, my interface requires filters and sorts on all of the above fields along with limit and offset for pagination, to reduce query time, fast UI, etc.
I could use
populate
on orders, but how am I supposed to honor the limit and offset via mongoose then. I'm wondering if I should make a view, in which case how should I flatten it to send/receive a list that honors the limit and offset.Or will it have to be a very manual, step-by-step build of the resulting list?
UPDATE:
Sample data in the DB:
Event Object:
{ "_id" : ObjectId("6218b9266487367ba1c20258"), "name" : "XYZ", "createdAt" : ISODate("2022-02-03T13:25:43.814+0000"), "updatedAt" : ISODate("2022-02-14T09:34:47.819+0000"), ... }
Order(s):
[ { "_id" : ObjectId("613ae653d0112f6b49fdd437"), "orderItems" : [ { "quantity" : NumberInt(2), "productCode" : "VEO001", }, { "quantity" : NumberInt(2), "productCode" : "VEO002", }, { "quantity" : NumberInt(1), "productCode" : "VEO003", } ], "orderCode" : "1000", "customerCode" : "Customer 1", "createdAt" : ISODate("2021-09-10T05:00:03.496+0000"), "updatedAt" : ISODate("2022-02-08T10:06:42.255+0000"), "eventId" : "6218b9266487367ba1c20258" } ]
Products:
[ { "_id" : ObjectId("604206685f25b8560a1cd48d"), "Product name" : "ABC", "createdAt" : ISODate("2021-03-05T10:22:32.085+0000"), "tag" : "VEO001", "updatedAt" : ISODate("2022-03-28T07:29:21.939+0000"), "Product Price" : NumberInt(0), "photo" : { "_id" : ObjectId("6042071a5f25b8560a1cd4a9"), "key" : "e8c9a085-4e8d-4ac4-84e9-bb0a83a59145", "name" : "Screenshot 2021-03-05 at 11.24.50.png" }, "name" : "ABC", "_costprice" : NumberInt(12), "_sku" : "SKUVEO001", }, { "_id" : ObjectId("604206685f25b8560a1cd48a"), "Product name" : "DEF", "createdAt" : ISODate("2021-03-05T10:22:32.085+0000"), "tag" : "VEO002", "updatedAt" : ISODate("2022-03-28T07:29:21.939+0000"), "Product Price" : NumberInt(0), "photo" : { "_id" : ObjectId("6042071a5f25b8560a1cd4a9"), "key" : "e8c9a085-4e8d-4ac4-84e9-bb0a83a59145", "name" : "Screenshot 2021-03-05 at 11.24.50.png" }, "name" : "DEF", "_costprice" : NumberInt(13), "_sku" : "SKUVEO002", }, { "_id" : ObjectId("604206685f25b8560a1cd48a"), "Product name" : "GHI", "createdAt" : ISODate("2021-03-05T10:22:32.085+0000"), "tag" : "VEO003", "updatedAt" : ISODate("2022-03-28T07:29:21.939+0000"), "Product Price" : NumberInt(0), "photo" : { "_id" : ObjectId("6042071a5f25b8560a1cd4a9"), "key" : "e8c9a085-4e8d-4ac4-84e9-bb0a83a59145", "name" : "Screenshot 2021-03-05 at 11.24.50.png" }, "name" : "GHI", "_costprice" : NumberInt(13), "_sku" : "SKUVEO003", }, ]
Expected output: