This support forum is no longer in use. Please use the Cloudinary Community at https://community.cloudinary.com/ to receive assistance from other members of the community and from Cloudinary's support team. For account-specific questions or if you believe that you've encountered a bug, please contact the Cloudinary team directly via the "submit a request" option on this support site.

How to parse video public Id from url and add to AvancedVideo

Comments

4 comments

  • Avatar
    Andres De Jesus

    Found this post that helped https://support.cloudinary.com/hc/en-us/community/posts/360006941639-How-to-programmatically-retrieve-public-id-from-URL-

    Made this function:

    const extractPublicId = (url) =>{

    let first = url.slice(url.indexOf('upload') + 7)

    let second = first.slice(first.indexOf('/') + 1, first.lastIndexOf('.'))

    return second

    }
    0
    Comment actions Permalink
  • Avatar
    Andres De Jesus

    Still no luck, got a 401 deny or ACL failure, so I added the signature to the url but now it returns a 404 again,
    https://res.cloudinary.com/cloudID/video/upload/v1/s--somesecret--/v323232/courses/NAME/videos/VideoNAME.ogg?_a=ATAJZAA0

    What is that 'v1' added after upload now?

    0
    Comment actions Permalink
  • Avatar
    Danny Valentine

    Hey Andres. Thanks for getting in touch. My name is Danny and I'm on the Customer Success team here at Cloudinary.

    AdvancedVideo expects a Public ID to be passed to cldVid, rather than the full URL of the video The public ID is returned in the upload response, so it's best to store this alongside the URL in your DB for future reference.

    Looking at the URL you've shared above, I see you have v1/ and v323232/ - This relates to the asset version, and it seems that the extractPublicId function has grabbed the version from the URL and saved it as part of the public ID.

    To test, could you please try referencing "samples/elephants" and let me know if that works for you? The delivery type for that asset is just upload, so you shouldn't need to provide a signature or anything for it to work.

    Thanks,
    -Danny

    0
    Comment actions Permalink
  • Avatar
    Andres De Jesus

    Hey Danny,

    Yes it did work when passed the publicId rather than the full url, thanks!

    0
    Comment actions Permalink

Post is closed for comments.