media.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. var media_count = 0;
  2. function video_paly(src) {
  3. var height = 264;
  4. var width = 640;
  5. var css = "<style lang='css/text'>" + __inline('/node_modules/video.js/dist/video-js.min.css') + " .video-js .vjs-fullscreen-control { display: none;} </style>";
  6. var list = src.split(".");
  7. var videotype = list[list.length - 1]
  8. var html = css + '<video' +
  9. ' id="my-player' + (++media_count) + '"' +
  10. ' class="video-js"' +
  11. ' controls' +
  12. ' preload="auto"' +
  13. ' width="' + width + '" height="' + height + '"' +
  14. ' data-setup=\'{}\'>' +
  15. ' <source src=\'' + src + '\' type="video/' + videotype + '"></source>' +
  16. ' <p class="vjs-no-js">' +
  17. ' To view this video please enable JavaScript, and consider upgrading to a' +
  18. ' web browser that' +
  19. ' <a href="http://videojs.com/html5-video-support/" target="_blank">' +
  20. ' supports HTML5 video' +
  21. ' </a>' +
  22. ' </p>' +
  23. '</video>';
  24. layer.open({
  25. area: [width + "px", height + "px"],
  26. type: 1,
  27. title: false,
  28. closeBtn: 1,
  29. shadeClose: true,
  30. content: "<div id='video_content_div'>" + html + "</div>",
  31. success: function() {
  32. var options = {
  33. };
  34. var player = videojs('my-player' + media_count, options, function onPlayerReady() {
  35. videojs.log('Your player is ready!');
  36. // In this context, `this` is the player that was created by Video.js.
  37. this.play();
  38. // How about an event listener?
  39. this.on('ended', function() {
  40. videojs.log('Awww...over so soon?!');
  41. });
  42. });
  43. }
  44. });
  45. }