[Vuejs]-How to accelerate video upload vuejs

0👍

several days ago i have thought the same question like your’s
now i have the idea:
first slice the video in several small pieces that has same size(<4MB),at same time create a manifest for the pieces and post the manifest to server.
the manifest like this:

{
    piecescount: 100,
    fileHASH: 'a1c2c3xxxxx',
    pieceslist:[
        {id: 1, piecesname: 'video_1.temp', status: 0}
        {id: 2, piecesname: 'video_2.temp', status: 0}
        ...
        {id: 100, piecesname: 'video_100.temp', status: 0}
    ]
}

status 0 means the file have upload yet
1 means is uploading the file now
2 means the file upload sucess
when begin to upload,loop through pieceslist.status

these are not code,just thinking process

for i in manitest.pieceslist
    if i.status==0
        set i.status=1
        upload the piece name=i.piecesname
        if upload sucess,set i.status=2
    elif i.status==1
        delete the piece named i.piecesname and reupload
        (because if client offline during upload,the piece maybe broken)
    elif i.status==2
        pass

after all of the pieces upload ,organize them to a file,and check the HASH
i think it makes upload more quick ,but also can breakpoint renewal

Leave a comment