Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add (string & import) remote src support #63

Merged
merged 10 commits into from
Oct 2, 2023
Merged

Conversation

luwes
Copy link
Collaborator

@luwes luwes commented Sep 18, 2023

This PR adds support for creating a Mux clip from a remote source url.
A Next.js API is required in the web app to handle the /api/video route.

// pages/api/video/[[...handler]].ts
export { default } from '@mux/next-video/request-handler'
// app/page.tsx
import Video from '@mux/next-video';

export default function Home() {
  return <Video style={{ width: 640, aspectRatio: 2.4 }} src="https://stream.mux.com/A3VXy02VoUinw01pwyomEO3bHnG4P32xzV7u1j1FSzjNg/high.mp4" />;
}

saved in

// videos/https_stream.mux.com_A3VXy02VoUinw01pwyomEO3bHnG4P32xzV7u1j1FSzjNg_high.mp4.json
{
  "status":"ready",  
  "originalFilePath": "https://stream.mux.com/A3VXy02VoUinw01pwyomEO3bHnG4P32xzV7u1j1FSzjNg/high.mp4", 
  "externalIds":{"assetId":"0102502PiOVxFuSEdNESe7m00wrs00XBARJWZRBlFdTUcGxg","playbackId":"ohIr601A4CISlBV87dZZCfdL4yzvdgzlikajrvSjk8Hc"}, 
  "createdAt": 1695323804937, 
  "updatedAt": 1695323810259, 
  "blurDataURL": 
  "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAOCAYAAABO3B6yAAAHWklEQVR4AQC..."
}

@luwes luwes self-assigned this Sep 18, 2023
@luwes luwes changed the title feat: add remote src support (WIP) feat: add remote (string) src support Sep 21, 2023
@heff
Copy link
Contributor

heff commented Sep 26, 2023

Does the Readme need to change at all based on this?

Can you go ahead an update the readme as needed?

@luwes
Copy link
Collaborator Author

luwes commented Sep 29, 2023

Will do, I'm still working out a bug where the JSON changes doesn't trigger a fast refresh (HMR)

@luwes luwes changed the title feat: add remote (string) src support feat: add (string & import) remote src support Sep 29, 2023
@heff
Copy link
Contributor

heff commented Oct 2, 2023

👍 Looks ok to me. I think we should get it in and then I'll do a more rigorous user test.

@luwes luwes merged commit 316365d into muxinc:main Oct 2, 2023
@luwes luwes deleted the remote-src branch October 2, 2023 23:02
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