简体   繁体   English

editly - 创建视频后在哪里可以获得返回值?

[英]editly - Where can I get the return value after a video is created?

Quick question...快速提问...

Following along the README of editly , I managed to create videos after calling editly like this:按照editly 的自述文件,我在像这样调用 editly 后设法创建了视频:

    // create video
    editly(editSpec)
        .catch(console.error);

Unfortunately, I am using ExpressJS to do this and I need to send back a response when video creation completes.不幸的是,我正在使用 ExpressJS 来执行此操作,并且我需要在视频创建完成时发回响应。

However, when I tried to extract any value using.then, it returns undefined:但是,当我尝试使用.then 提取任何值时,它返回未定义:

    // create video
    editly(editSpec)
    .then(r => {
        console.log(`Is this undefined? Probably yes! r: `, r)
        res.json(r)
    })
        .catch(console.error);

How can I accomplish this?我怎样才能做到这一点?

For anyone who got stuck on trying to wait for the return value of editly within the context of ExpressJS, here is how I was able to solve this:对于那些在 ExpressJS 的上下文中试图等待 editly 的返回值的人来说,这是我能够解决这个问题的方法:


        // create video via Promise.all
        Promise.all([
            editly(editSpec).catch(e => { return e } )
        ])
        .then(r => {
            console.log(`r: `, r) // still returns undefined but its ok now!  [ undefined ]
            res.json({message: "complete"})
        })

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM