選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 
 

56 行
1.7 KiB

  1. /*
  2. * Video.js plugin for Pannellum
  3. * Copyright (c) 2015-2018 Matthew Petroff
  4. * MIT License
  5. */
  6. (function(document, videojs, pannellum) {
  7. 'use strict';
  8. var registerPlugin = videojs.registerPlugin || videojs.plugin; // Use registerPlugin for Video.js >= 6
  9. registerPlugin('pannellum', function(config) {
  10. // Create Pannellum instance
  11. var player = this;
  12. var container = player.el();
  13. var vid = container.getElementsByTagName('video')[0],
  14. pnlmContainer = document.createElement('div');
  15. pnlmContainer.style.zIndex = '0';
  16. config = config || {};
  17. config.type = 'equirectangular';
  18. config.dynamic = true;
  19. config.showZoomCtrl = false;
  20. config.showFullscreenCtrl = false;
  21. config.autoLoad = true;
  22. config.panorama = vid;
  23. pnlmContainer.style.visibility = 'hidden';
  24. player.pnlmViewer = pannellum.viewer(pnlmContainer, config);
  25. container.insertBefore(pnlmContainer, container.firstChild);
  26. vid.style.display = 'none';
  27. // Handle update settings
  28. player.on('play', function() {
  29. if (vid.readyState > 1)
  30. player.pnlmViewer.setUpdate(true);
  31. });
  32. player.on('canplay', function() {
  33. if (!player.paused())
  34. player.pnlmViewer.setUpdate(true);
  35. });
  36. player.on('pause', function() {
  37. player.pnlmViewer.setUpdate(false);
  38. });
  39. player.on('loadeddata', function() {
  40. pnlmContainer.style.visibility = 'visible';
  41. });
  42. player.on('seeking', function() {
  43. if (player.paused())
  44. player.pnlmViewer.setUpdate(true);
  45. });
  46. player.on('seeked', function() {
  47. if (player.paused())
  48. player.pnlmViewer.setUpdate(false);
  49. });
  50. });
  51. })(document, videojs, pannellum);