Skip to content

Alexadar/videoediting_api

Repository files navigation

videoediting_api

Video editing REST API Done as "Proof of skils" test task

Required software

NodeJS, PM2, ffmpeg, mongodb

Start/Stop

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

Test client

http://localhost:15000 will run test client
You can test 'failed job' or 'rerun job' flows if you will login with user 'luckyStrike'

Known limitations

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

API

Endpoints

{client} stands for client type. Currently IOS
{v} stands for API version, currently 1
API requests are 'application/json'

IOS

/api/{client}/{v}/getUser

Request should pass user name, and in responce it will receive authorisation string for other api calls and socket connect:

request

    {
        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" } }

/api/{client}/{v}/createFileTrimJob

Request should pass variables like trim start/end, desirable job name and file
##Request should be multipart/formdata
request: trimFileUpload - videoFile
name
trimStart
trimEnd

/api/{client}/{v}/restartJob

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

/files/{fileName}

You can download any video file from ths route.
File url being passed on login in jobs[] array, or during socket event on notify

Socket

/ws

You can connect to websocket for job notifications
Socket url is /ws?accesstoken=yourAccessToken

/onJobCompleeted

Emmited on job completed. Job states could be failed/completed/rerunable

About

Video editing REST API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published