Skip to content

Instantly share code, notes, and snippets.

@jhenry
Created December 12, 2020 23:49
Show Gist options
  • Save jhenry/09482b3f130c3971378b0ac223d81057 to your computer and use it in GitHub Desktop.
Save jhenry/09482b3f130c3971378b0ac223d81057 to your computer and use it in GitHub Desktop.
jwplayer theater mode button
/* Your theater-mode.svg file for the icon might look something like:
345,93 Bot
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80">
<rect x="5" y="20" width="70" height="35" fill-opacity="0.01" stroke-width="8" stroke="lightgrey" shape-rendering="crispEdges" />
</svg>
*/
const buttonId = 'theater-mode-button';
const iconPath = '/theater-mode.svg';
const tooltipText = 'Theater Mode';
// Call the player's `addButton` API method to add the custom button
playerInstance.addButton(iconPath, tooltipText, buttonClickAction, buttonId);
// This function is executed when the button is clicked
function buttonClickAction() {
// Toggle your width (in this case swapping bootstrap columns)
$("#video-col").toggleClass('col-md-8');
$("#video-col").toggleClass('col-md-12');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment