Video editing REST API Done as "Proof of skils" test task
NodeJS, PM2, ffmpeg, mongodb
Run start.sh and stop.sh scripts to run or stop app.
start.sh will start pm2 process manager with api and worker node processes. Allso, it will
start mongod daemon in data foldr
stop.sh will stop node processes and mongodb instance
http://localhost:15000 will run test client
You can test 'failed job' or 'rerun job' flows if you will login with user 'luckyStrike'
Output file allways .mp4
todo: Do a filesize check, filetype check for uploading source video.
todo: gracefull stop of worker
todo: omit internal data from responces
todo: user security for /files/done folder
{client} stands for client type. Currently IOS
{v} stands for API version, currently 1
API requests are 'application/json'
Request should pass user name, and in responce it will receive authorisation string for other api calls and socket connect:
{
body: {
userId: 'userName'
}
}
## responce
{ "data": { "userId": "userId, - your user name", "jobs": [ { "_id": "jobId", "type": "Job type. Currently trimJob", "state": "job state", "createDate": "date", "updateDate": "date", "data": { "name": "jobName", "trimStart": "f.e. 1", "trimEnd": "f.e. 2", "resultFile": "url to download" }, "userId": "Owner id" } ], "constants": "dictionaries for states, types etc", "accessHeaders": "headers for API calls and socket security" } }
Request should pass variables like trim start/end, desirable job name and file
##Request should be multipart/formdata
request:
trimFileUpload - videoFile
name
trimStart
trimEnd
Request should pass job id and new state
Request:
{
body: {
state: constants.jobStates.created,
_id: job._id
}
}
Responce:
If responce contain no errors, job updtaed succesfully
You can download any video file from ths route.
File url being passed on login in jobs[] array, or during socket event on notify
You can connect to websocket for job notifications
Socket url is /ws?accesstoken=yourAccessToken
Emmited on job completed. Job states could be failed/completed/rerunable