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

Add ability to play/pause and mute/unmute video using props #384

Merged
merged 6 commits into from
Jun 7, 2022

Conversation

AnthonyUtt
Copy link
Contributor

Needed for a current application, figured I would add a PR upstream in case anyone else wants this sort of functionality.

Both props are completely optional, omitting both will not impose any breaking changes to existing cropper setups.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 2, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 78090a5:

Sandbox Source
react-easy-crop Configuration

@AnthonyUtt
Copy link
Contributor Author

Here's a working CodeSandbox example: https://codesandbox.io/s/react-easy-crop-forked-0mf3nf

@ValentinH
Copy link
Owner

Thanks for this PR!

I'm wondering if we could actually make this more generic and cover more use cases by directly exposing the video ref (same for the image). What do you think?

@AnthonyUtt
Copy link
Contributor Author

That's a great idea! Let me jam on it a bit and I will update shortly.

@AnthonyUtt
Copy link
Contributor Author

AnthonyUtt commented Jun 6, 2022

@ValentinH I have updated with optional callback props to set both the image and video refs in the parent component. Theoretically, this could be updated to use a single mediaRef object, but that implementation would require a bit more of a refactor of the existing component so I opted for the simpler solution. Please let me know if there are any issues.

Edit: CodeSandbox working example: https://codesandbox.io/s/react-easy-crop-forked-6rtj6b?file=/src/index.js

@ValentinH ValentinH added enhancement New feature or request minor Increment the minor version when merged labels Jun 7, 2022
@ValentinH
Copy link
Owner

Thanks for the contribution!

@ValentinH ValentinH merged commit 619683c into ValentinH:main Jun 7, 2022
@github-actions
Copy link

github-actions bot commented Jun 7, 2022

🚀 PR was released in v4.3.0 🚀

@github-actions github-actions bot added the released This issue/pull request has been released. label Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request minor Increment the minor version when merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants