AugustoMarcelo / mcuapi

🦸 Marvel Cinematic Universe API
https://mcuapi.herokuapp.com/docs
67 stars 3 forks source link

Question: Trailer URL #31

Open mpurcella opened 1 year ago

mpurcella commented 1 year ago

Full disclosure first, I'm still somewhat new at web development, so I may be approaching this issue incorrectly.

I would love to be able to play/embed the trailers in my own app, but it seems that the ways I've tried haven't worked (I keep getting a CORB error). It looks like the Trailer URL provided is the URL to watch the trailer, rather than a URL to embed it. Would it be possible to change that trailer_url field to just the ID of the video – that way we would be able to create our own embed link and just use that ID?

AugustoMarcelo commented 1 year ago

Hey, man. Can you share how you are doing this? I think using the ID is not the best way to handle it because it does not indicate from where that ID comes (youtube, vimeo)

mpurcella commented 1 year ago

I don't have a working example of trying to embed the trailers as I opted to just create an external link for them. I was playing around with The Movie Database not too long ago, and while they don't have the best way of doing it (in my opinion), it works. Maybe some sort of structure like this:

This is part of the returned data from an API request to TMDB:

Screenshot 2023-04-14 at 11 32 09 AM

So maybe something like:

trailers: [
    0: {
        id: <id>
        key: <key>
        name: <name>
        site: <site>
    }
    1: {
        ...
    }
]

With Youtube videos it'd be easy, but I'm not sure how the Brightcove videos would work. Just a thought.