phpface

StreamTube - Custom VideoJS Skin

Jul 10th, 2022 (edited)
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. /**
  2.  * Loads videojs skin css file
  3.  */
  4. function streamtube_child_enqueue_videojs_custom_skin() {
  5.  
  6.     $css_skin_file = '/your-videojs-skin/your-custom-skin.css';
  7.  
  8.     wp_enqueue_style(
  9.         'videojs-custom-myskin',
  10.         get_stylesheet_directory_uri() . $css_skin_file ,
  11.         array(),
  12.         filemtime( get_stylesheet_directory() . $css_skin_file )
  13.     );
  14. }
  15. add_action( 'wp_enqueue_scripts', 'streamtube_child_enqueue_videojs_custom_skin' );
  16. add_action( 'enqueue_embed_scripts', 'streamtube_child_enqueue_videojs_custom_skin' );
  17.  
  18.  
  19. /**
  20.  * Add CSS class to player
  21.  */
  22. add_filter( 'streamtube/player/file/setup', function( $setup, $source ){
  23.  
  24.     // Define your own skin class name
  25.     $skin_class_name = 'your-custom-skin-class-goes-here';
  26.  
  27.     $setup['classes'] = array(
  28.         'position-absolute',
  29.         'videojs-streamtube',
  30.         $skin_class_name
  31.     );
  32.  
  33.     return $setup;
  34. }, 10, 2 );
Add Comment
Please, Sign In to add comment