Skip to content

Refactor Mux provider to use new operations generator#30

Open
plcdnl wants to merge 2 commits intomagicasaservice:mainfrom
plcdnl:patch-2
Open

Refactor Mux provider to use new operations generator#30
plcdnl wants to merge 2 commits intomagicasaservice:mainfrom
plcdnl:patch-2

Conversation

@plcdnl
Copy link
Copy Markdown

@plcdnl plcdnl commented Sep 1, 2025

Description

Completed the Mux provider implementation that was left unfinished. The provider now works correctly with Mux's image API.

Changes Made

Fixed the provider to work with Mux playback IDs as src
Implemented proper URL generation for both static thumbnails and animated content
Added automatic detection for animated content based on start/end times
Added size validation (640px limit as per Mux requirements)

Usage

<template>
  <!-- Static thumbnail -->
  <NuxtImg
    provider="mux"
    src="your-playback-id-here"
    :modifiers="{ width: 400, height: 300 }"
  />
  
  <!-- Animated content -->
  <NuxtImg
    provider="mux"
    src="your-playback-id-here"
    :modifiers="{ start: 5, end: 10, fps: 15 }"
  />
</template>

The provider now generates correct URLs like:

https://image.mux.com/{playback-id}/thumbnail.webp?width=400&height=300
https://image.mux.com/{playback-id}/animated.gif?start=5&end=10&fps=15

@robinscholz
Copy link
Copy Markdown
Contributor

@plcdnl I am getting a lot of type errors, most likely due to an upstream bug: nuxt/image#1942

Once this is fixed, I'll gladly take another look!

@plcdnl
Copy link
Copy Markdown
Author

plcdnl commented Sep 2, 2025

Hi @robinscholz, this will be fixed in nuxt/image v2, which also includes Shopify Image CDN integration. I had updated the package locally but forgot to push the update to the repo — I’m already using the alpha release of nuxt/image v2.

I’m happy to have contributed, thanks for all the work you’re doing!

@robinscholz
Copy link
Copy Markdown
Contributor

In that case I’d like to wait until v2 is stable and update this package then, so to not introduce an alpha-versioned peer dependency. I'll leave this PR up until then. We’ll most likely also need to update the maas provider once v2 is stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants