Advertisement
MikeJaza

EC Header Code

Nov 22nd, 2012
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!-- load SWFObject current folder -->
  2. <script src="http://localhost/wordpress1/wp-content/uploads/jw-player-plugin-for-wordpress/player/swfobject.js"></script>
  3. <script src="http://localhost/wordpress1/wp-content/EasyCaptions.js"></script>
  4. <script src="http://localhost/wordpress1/wp-content/uploads/jw-player-plugin-for-wordpress/player/jwplayer.js"></script>
  5. <script>
  6.  
  7. /* --- For JW Media Player's caption handling ---
  8. The following code is specific to JW Media Player.
  9. You could replace with something else if you
  10. prefer other Flash video players.
  11. */
  12. function playerReady(obj){
  13.     document.getElementById(obj.id).addModelListener("TIME", "jw_timeupdateHandler");
  14. }
  15.  
  16. var jw_timeupdateHandler;
  17. /* --- END JW Media Player code --- */
  18.  
  19.  
  20. //Use SWFObject's addDomLoadEvent function
  21. swfobject.addDomLoadEvent(function (){
  22.  
  23.     var easy = new EasyCaptions({
  24.         videoElementID: "video-html5",
  25.         transcriptElementID: "transcript",
  26.         transcriptEnabledClass: "enabled",
  27.         enableCaptions: false
  28.     });
  29.  
  30.  
  31.     if(!easy.html5_supported){
  32.        
  33.         //Embed SWF
  34.         var flashvars = { file: '<?php echo get_post_meta(get_the_ID(), thinema, true); ?>', controlbar: 'over', autostart: 'false'};
  35.         var parameters = {};
  36.         var attributes = { id: "video-swf", name: "video-swf" };
  37.         var callback = function (){
  38.                        
  39.             //Set up the flash fallback as a callback that occurs AFTER the swf is embedded by SWFObject
  40.             easy.addFallback({
  41.                  
  42.                  elementID: "video-swf",
  43.                  
  44.                  captionHandler: function (video, updateCaption){
  45.                     },
  46.                  
  47.                  transcriptHandler: function (video, position){
  48.                      
  49.                     //The following code is specific to JW Media Player.
  50.                     //You could replace with something else if you
  51.                     //prefer other Flash video players.
  52.                    
  53.                     //Ensure video is playing before trying to SEEK
  54.                     if(video.getConfig().state !== "PLAYING"){
  55.                         video.sendEvent("PLAY", "true");               
  56.                     }
  57.        
  58.                     video.sendEvent('SEEK', position);
  59.                    
  60.                  }
  61.                  
  62.             });
  63.            
  64.         };
  65.             swfobject.embedSWF('http://localhost/wordpress1/wp-content/uploads/jw-player-plugin-for-wordpress/player/player.swf', 'video-html5', '480', '320', '9.0.0', false, flashvars, parameters, attributes, callback);
  66.                
  67.     }
  68.    
  69.  
  70.     //Set up Flash fallback handler.
  71.     //The following code is specific to JW Media Player.
  72.     //You could replace with something else if you
  73.     //prefer other Flash video players.
  74.     jw_timeupdateHandler = function (video){
  75.         easy.updateCaption(parseInt(video.position, 10));
  76.     };
  77.  
  78.  
  79.     /*  Progressive enhancement BONUS:
  80.         Add notice to transcript letting people know it's clickable  */
  81.        
  82.     if(easy.transcript_element){   
  83.         var target_el = easy.transcript_element.getElementsByTagName("h3")[0].nextSibling;
  84.         var new_el = document.createElement("h4");
  85.         new_el.innerHTML = "Click on the text below to play that point in the video.";
  86.         easy.transcript_element.insertBefore(new_el, target_el);
  87.     }
  88.  
  89. });
  90.  
  91. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement