product.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  6. <title></title>
  7. <link href="css/mui.min.css" rel="stylesheet" />
  8. <link href="css/main.css" rel="stylesheet" />
  9. <link href="css/mediaelementplayer.css" rel="stylesheet" />
  10. </head>
  11. <body>
  12. <header class="mui-bar mui-bar-nav">
  13. <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
  14. <h1 class="mui-title" id="title">温室</h1>
  15. </header>
  16. <div class="mui-content">
  17. <div class="mui-control-content mui-active">
  18. <div id="player" style="display: none; width: 7.5rem;height: 4.2187rem;">
  19. <video preload="metadata" width="100%" height="10" webkit-playsinline controls="controls">
  20. </video>
  21. </div>
  22. <iframe id="product" src="" style="width:100%;overflow: hidden;border:0px;"></iframe>
  23. </div>
  24. </div>
  25. <script src="js/mui.min.js"></script>
  26. <script src="js/main.js"></script>
  27. <script src="js/jquery-1.8.3.min.js"></script>
  28. <script src="js/mediaelement-and-player.js"></script>
  29. <script type="text/javascript" charset="utf-8">
  30. (function($, self) {
  31. $.init();
  32. $.plusReady(function() {
  33. plus.webview.currentWebview().setStyle({scrollIndicator:'none'});
  34. var self = plus.webview.currentWebview();
  35. var id = self.vid;
  36. var name = self.name;
  37. document.getElementById('title').innerText = name;
  38. var page = document.getElementById("product");
  39. //alert(winSize().height);
  40. page.setAttribute('height', winSize().height);
  41. //alert(page.getAttribute('height'));
  42. page.setAttribute('src', config.host + 'product?&header=false&id='+id);
  43. window.addEventListener('resize', function() {
  44. oauthArea.style.display = document.body.clientHeight > 400 ? 'block' : 'none';
  45. }, false);
  46. //"http://pili-media.live.ol-img.com/recordings/z1.beauty_live.OL_20160708144523_383le/383.m3u8";
  47. var m3u8Url = self.live_url;
  48. if(m3u8Url.indexOf(".m3u8")==-1){
  49. return;
  50. }
  51. //允许内联播放
  52. plus.webview.currentWebview().nativeInstanceObject().plusSetAttribute("allowsInlineMediaPlayback", true);
  53. //plus.webview.currentWebview().nativeInstanceObject().plusSetAttribute("mediaPlaybackRequiresUserAction", false);
  54. (function ($) {
  55. var qiniuvu = m3u8Url;
  56. var poster = "";//视频封面图
  57. var height = plus.screen.resolutionWidth*4.2187/7.5;
  58. $("#product").css('margin-top',height-66);
  59. $("video").width(plus.screen.resolutionWidth).height(height);
  60. $("video").attr("src", m3u8Url);
  61. $("video").attr("poster", poster);
  62. var videoExt = qiniuvu.substring(qiniuvu.lastIndexOf('.') + 1).toLowerCase();
  63. if (videoExt == "m3u8") {// 手动支持m3u8格式
  64. $("video").attr("type", "video/m3u8");
  65. }
  66. var ele_player = document.getElementById("player");
  67. ele_player.style.display = "block";
  68. $("video").mediaelementplayer({
  69. pluginPath: './'
  70. , success: function(media, node, player) {
  71. letvPlayer = media;
  72. // 开始播放
  73. // media.play();
  74. if (plus.os.name == "Android") {
  75. player.fullscreenBtn.on("tap", function () {
  76. if (!player.isFullScreen) {
  77. // 进全屏
  78. //plus.pgpassport.changeStatusBarOrientation('landscape-primary');
  79. $("footer").hide();
  80. } else {
  81. // 退出全屏
  82. //plus.pgpassport.changeStatusBarOrientation('portrait-primary');
  83. setTimeout(function () {
  84. $("footer").show();
  85. }, 1000);
  86. }
  87. });
  88. } else {
  89. $("video")[0].addEventListener('webkitbeginfullscreen', function () {
  90. // 进全屏
  91. //plus.pgpassport.changeStatusBarOrientation('landscape-primary');
  92. }, false);
  93. $("video")[0].addEventListener('webkitendfullscreen', function () {
  94. // 退出全屏
  95. //plus.pgpassport.changeStatusBarOrientation('portrait-primary');
  96. }, false);
  97. }
  98. }
  99. });
  100. })(jQuery);
  101. });
  102. }(mui, document));
  103. </script>
  104. </body>
  105. </html>