<media-context-menu>
A customizable context menu for video elements. This component allows you to provide your own menu items for video playback. Common use cases include “Copy video URL”, attribution links, or other media-related actions accessible via right-click on the video element.
Remember to add the separate menu module for the menu components.
import "media-chrome";
import "media-chrome/menu";
Default usage
Section titled Default usageMenu Items
Section titled Menu ItemsMenu items are added as <media-context-menu-item> elements inside <media-context-menu>.
Each item can include links, buttons, or custom elements.
<media-context-menu>
<media-context-menu-item>
<a href="https://mux.com" target="_blank">Powered by Mux</a>
</media-context-menu-item>
<media-context-menu-item>
<button invoke="copy">Copy Video URL</button>
<input slot="copy" type="hidden" value="https://stream.mux.com/your-video-url.mp4">
</media-context-menu-item>
</media-context-menu>
Using the Copy Function
Section titled Using the Copy FunctionThe invoke="copy" attribute on a button triggers copying of the value from an input element with slot="copy" inside the same menu item.
To use it:
- Add a
<button invoke="copy">inside a<media-context-menu-item>. - Add an
<input slot="copy" type="hidden" value="...">containing the text or URL to copy. - When the button is clicked, the input’s value is copied to the clipboard automatically.
<media-context-menu-item>
<button invoke="copy">Copy Video URL</button>
<input slot="copy" type="hidden" value="https://stream.mux.com/example.mp4">
</media-context-menu-item>