SHARE
TWEET

Untitled

a guest Jul 18th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. /*
  4. Plugin Name: HLSPlayer
  5. Plugin URI:
  6. Description: An HLS based Web Player.
  7. Version: 1.0
  8. Author: arumford
  9. */
  10.  
  11. function hlsplayer($atts){
  12.     wp_enqueue_script('hls', 'hls.js');
  13.     wp_enqueue_script('hlsplayer', 'hlsplayer.js');
  14.  
  15.     // Attributes
  16.     $atts = shortcode_atts(
  17.         array(
  18.             'title' => '',
  19.             'primary' => '',
  20.             'backup' => '',
  21.         ),
  22.         $atts,
  23.         'hlsplayer'
  24.     );
  25.  
  26.     echo '<script type="text/javascript">
  27.            VideoPlayer(\'video1\', ' . $atts['primary'] . ',
  28.            '. $atts['backup'] .');
  29.          </script>';
  30.  
  31.     echo '<p>
  32.        <label>'. $atts['title'] .'</label>
  33.        <video style="margin-top: 5px;" id="video1" controls class="videoCentered" poster="LearfieldIMGCollege_RGB.png"></video>
  34.    </p>';
  35. }
  36.  
  37. add_action('wp_enqueue_scripts', 'hlsplayer');
  38. add_action('wp_enqueue_scripts', 'hls');
  39. add_shortcode( 'hlsplayer', 'hlsplayer' );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top