Advertisement
ramh

Brightcove Embed

Nov 16th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!-- Requires jQuery-->
  2.  
  3. <!-- Hides the video ID in the display and makes the container 100% of the parent width-->
  4. <style type="text/css">
  5.     .field-name-field-brightcove-id{display: none;}
  6.     .BrightcoveExperience{max-width:100%; width:100%;}
  7. </style>
  8.  
  9. <!--Required Brightcove Library -->
  10. <script language="JavaScript" type="text/javascript" src="https://sadmin.brightcove.com/js/BrightcoveExperiences.js">
  11. </script>
  12.  
  13. <!-- This is where the magic begins -->
  14. <script>
  15. (function($) {
  16.         $('.node-video').each(function(){
  17.             var videoID = $(this).find('.views-field-field-brightcove-id .field-content').text();
  18.             var myExperience = '"myExperience'+videoID+'"';
  19.             var videoPlayer = '"'+videoID+'"';
  20.             //console.log(videoPlayer);
  21.  
  22.             $('#block-views-1video-block .view-content, #block-system-main .content .node-video-test .content').prepend('<object class="BrightcoveExperience" id='+myExperience+'><param name="secureConnections" value="true" />'+
  23.             '<param name = "secureHTMLConnections" value = "true" /> '+
  24.             '<param name = "bgcolor" value = "#FFFFFF" /> '+
  25.             '<param name = "width" value = "575" /> '+
  26.             '<param name = "autoStart" value = "false" /> '+
  27.             '<param name = "height" value = "340" /> '+
  28.             '<param name = "playerID" value = "2855309428001" /> '+
  29.             '<param name = "playerKey" value = "AQ~~,AAABrzqJ7DE~,Rv6eFjTvDM4P9aYNsV80DfkR8BKbfJLf" /> '+
  30.             '<param name = "isVid" value = "true" /> '+
  31.             '<param name = "isUI" value = "true" /> '+
  32.             '<param name = "dynamicStreaming" value = "true" /> '+
  33.             '<param name = "@videoPlayer" value ='+videoPlayer+' /> '+
  34.             '</object><!-- This script tag will cause the Brightcove Players defined above it to be created as soon as the line is read by the browser.If you wish to have the player instantiated only after the rest of the HTML is processed and the page load is complete, remove the line.-- >');
  35.             brightcove.createExperiences();
  36.         });
  37. })(jQuery);
  38. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement