Giter Site home page Giter Site logo

Comments (6)

apettenati avatar apettenati commented on June 10, 2024 1

Yes, thank you! I have this working, I just thought I'd recommend adding an example as well.

from mux-node-sdk.

dylanjha avatar dylanjha commented on June 10, 2024 1

We recently refreshed the guide for doing signed playback URLs (w/ optional playback restrictions): https://docs.mux.com/guides/secure-video-playback

Closing because this is not a specific issue related to the node SDK

from mux-node-sdk.

dylanjha avatar dylanjha commented on June 10, 2024

Hi @apettenati, thanks for bringing this up! I hope you figured it out, and we can definitely add more documentation.

As of right now we have one example here with the node SDK if you click the "node" tab

Short answer is you pass in playback_restriction_id: in with the extra params

const { JWT } = require('@mux/mux-node');

JWT.sign(playbackId, {
  params: { playback_restriction_id: YOUR_PLAYBACK_RESTRICTION_ID },
})

let me know if that helps!

from mux-node-sdk.

rubenheymans avatar rubenheymans commented on June 10, 2024

how do you create the playback restriction?
when do you create the signed playback id?
how do you insert it to you mux-player?
how do you know the signed playback id is expired and you need to create a new one?
this is so confusing

from mux-node-sdk.

rubenheymans avatar rubenheymans commented on June 10, 2024

ok so I can create the playback restriction using postman (is there a ui option coming?)
https://www.youtube.com/watch?v=rd1os9jDTtg

I create the signed playback id everytime I load the video asset but this makes loading the asset slower

Insert it into mux-player like this:
[attr.playback-id]="file.playbackId"
[attr.playback-token]="signedUrls.playback"
[attr.thumbnail-token]="signedUrls.thumbnail"
[attr.storyboard-token]="signedUrls.storyboard"

How do you know the signed playback id is expired and you need to create a new one?
Can't find any info about this?

from mux-node-sdk.

dylanjha avatar dylanjha commented on June 10, 2024

@rubenheymans you'll want to set the expiration to a timeframe longer than the length of the video, with some buffer because a user might pause and come back later, scrub, etc.

If the token is expired the player will throw a 403 error and you can catch that, make an API request to get refreshed tokens.

from mux-node-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.