소스 검색

web full screen, close #30; new option: video.type

DIYgod 8 년 전
부모
커밋
867730d194
8개의 변경된 파일108개의 추가작업 그리고 56개의 파일을 삭제
  1. 45 52
      demo/index.html
  2. 0 0
      dist/DPlayer.min.js
  3. 0 0
      dist/DPlayer.min.js.map
  4. 1 1
      package.json
  5. 0 0
      plugin/flv.min.js
  6. 0 0
      plugin/hls.min.js
  7. 2 1
      src/DPlayer.js
  8. 60 2
      src/DPlayer.scss

+ 45 - 52
demo/index.html

@@ -3,7 +3,7 @@
 <head>
     <meta charset="UTF-8">
     <title>DPlayer Demo</title>
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
     <style>
         body {
             font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
@@ -76,7 +76,8 @@
         hotkey: true,
         video: {
             url: 'http://devtest.qiniudn.com/若能绽放光芒.mp4',
-            pic: 'http://devtest.qiniudn.com/若能绽放光芒.png'
+            pic: 'http://devtest.qiniudn.com/若能绽放光芒.png',
+            type: 'auto',
         },
         danmaku: {
             id: '9E2E3368B56CDBB4',
@@ -88,62 +89,52 @@
     function switchDPlayer() {
         if (dp1.option.danmaku.id !== '5rGf5Y2X55qu6Z2p') {
             dp1.switchVideo({
-                        url: 'http://devtest.qiniudn.com/微小微-江南皮革厂倒闭了.mp4',
-                        pic: 'http://devtest.qiniudn.com/微小微-江南皮革厂倒闭了.jpg'
-                    },
-                    {
-                        id: '5rGf5Y2X55qu6Z2p',
-                        api: 'https://api.prprpr.me/dplayer/',
-                        token: 'tokendemo',
-                        maximum: 3000
-                    });
+                url: 'http://devtest.qiniudn.com/微小微-江南皮革厂倒闭了.mp4',
+                pic: 'http://devtest.qiniudn.com/微小微-江南皮革厂倒闭了.jpg',
+                type: 'auto',
+            },
+                {
+                    id: '5rGf5Y2X55qu6Z2p',
+                    api: 'https://api.prprpr.me/dplayer/',
+                    token: 'tokendemo',
+                    maximum: 3000
+                });
         }
         else {
             dp1.switchVideo({
-                        url: 'http://devtest.qiniudn.com/若能绽放光芒.mp4',
-                        pic: 'http://devtest.qiniudn.com/若能绽放光芒.png'
-                    },
-                    {
-                        id: '9E2E3368B56CDBB4',
-                        api: 'https://api.prprpr.me/dplayer/',
-                        token: 'tokendemo',
-                        maximum: 3000
-                    });
+                url: 'http://devtest.qiniudn.com/若能绽放光芒.mp4',
+                pic: 'http://devtest.qiniudn.com/若能绽放光芒.png',
+                type: 'auto',
+            },
+                {
+                    id: '9E2E3368B56CDBB4',
+                    api: 'https://api.prprpr.me/dplayer/',
+                    token: 'tokendemo',
+                    maximum: 3000
+                });
         }
     }
 
     // Bilibili video and danmaku support
-    const xhr = new XMLHttpRequest();
-    xhr.onreadystatechange = () => {
-        if (xhr.readyState === 4) {
-            if (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) {
-                const response = JSON.parse(xhr.responseText);
-                var dp2 = new DPlayer({
-                    element: document.getElementById('dplayer2'),
-                    autoplay: false,
-                    theme: '#FADFA3',
-                    loop: true,
-                    screenshot: false,
-                    video: {
-                        url: response.durl[0].url,
-                        pic: 'http://devtest.qiniudn.com/微小微-江南皮革厂倒闭了.jpg'
-                    },
-                    danmaku: {
-                        id: '5rGf5Y2X55qu6Z2p',
-                        api: 'https://api.prprpr.me/dplayer/',
-                        token: 'tokendemo',
-                        maximum: 3000,
-                        addition: ['https://api.prprpr.me/dplayer/bilibili?aid=4045652']
-                    }
-                });
-            }
-            else {
-                console.log('Request was unsuccessful: ' + xhr.status);
-            }
+    var dp2 = new DPlayer({
+        element: document.getElementById('dplayer2'),
+        autoplay: false,
+        theme: '#FADFA3',
+        loop: true,
+        screenshot: false,
+        video: {
+            url: 'https://api.prprpr.me/dplayer/video/bilibili?aid=4045652',
+            pic: 'http://devtest.qiniudn.com/微小微-江南皮革厂倒闭了.jpg',
+            type: 'auto',
+        },
+        danmaku: {
+            id: '5rGf5Y2X55qu6Z2p',
+            api: 'https://api.prprpr.me/dplayer/',
+            token: 'tokendemo',
+            maximum: 3000,
+            addition: ['https://api.prprpr.me/dplayer/bilibili?aid=4045652']
         }
-    };
-    xhr.open('get', 'https://api.prprpr.me/dplayer/video/bilibili?aid=4045652', true);
-    xhr.send(null);
+    });
 
     // Live Video (HTTP Live Streaming, M3U8 format) support
     var dp3 = new DPlayer({
@@ -155,7 +146,8 @@
         hotkey: true,
         video: {
             url: 'http://devtest.qiniudn.com/若能绽放光芒5.m3u8',
-            pic: 'http://devtest.qiniudn.com/若能绽放光芒.png'
+            pic: 'http://devtest.qiniudn.com/若能绽放光芒.png',
+            type: 'hls',
         },
         danmaku: {
             id: '9E2E3368B56CDBB42',
@@ -175,7 +167,8 @@
         hotkey: true,
         video: {
             url: 'http://devtest.qiniudn.com/【微小微】玖月奇迹-踩踩踩.flv',
-            pic: 'http://devtest.qiniudn.com/【微小微】玖月奇迹-踩踩踩.jpg'
+            pic: 'http://devtest.qiniudn.com/【微小微】玖月奇迹-踩踩踩.jpg',
+            type: 'flv',
         },
         danmaku: {
             id: '9E2E3368B56CDBB43',

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/DPlayer.min.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/DPlayer.min.js.map


+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "dplayer",
-  "version": "1.1.3",
+  "version": "1.1.4",
   "description": "Wow, such a lovely HTML5 danmaku video player",
   "main": "dist/DPlayer.min.js",
   "scripts": {

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
plugin/flv.min.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
plugin/hls.min.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2 - 1
src/DPlayer.js


+ 60 - 2
src/DPlayer.scss

@@ -5,9 +5,13 @@
     line-height: 1;
 
     &:-webkit-full-screen {
-        width: 100% !important;
-        height: 100% !important;
+        width: 100%;
+        height: 100%;
         background: #000;
+        position: fixed;
+        z-index: 100000;
+        left: 0;
+        top: 0;
 
         .dplayer-danmaku {
             .dplayer-danmaku-top,
@@ -94,6 +98,41 @@
             opacity: 1;
         }
     }
+    &.dplayer-fulled {
+        position: fixed;
+        z-index: 100000;
+        left: 0;
+        top: 0;
+        width: 100%;
+        height: 100%;
+    }
+    &.dplayer-mobile {
+        .dplayer-volume,
+        .dplayer-camera-icon {
+            display: none !important;
+        }
+
+        .dplayer-full-in-icon {
+            position: static !important;
+            display: inline-block !important;
+        }
+
+        .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-comment-input {
+            width: 200px;
+        }
+
+        .dplayer-comment-setting-title {
+            display: none;
+        }
+
+        .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-comment-setting-box {
+            left: 17px;
+        }
+
+        .dplayer-controller .dplayer-icons .dplayer-icon {
+            width: 40px;
+        }
+    }
 
     .dplayer-mask {
         position: absolute;
@@ -602,6 +641,25 @@
                 }
             }
 
+            .dplayer-full {
+                display: inline-block;
+                height: 100%;
+                position: relative;
+
+                &:hover {
+                    .dplayer-full-in-icon {
+                        display: block;
+                    }
+                }
+
+                .dplayer-full-in-icon {
+                    position: absolute;
+                    top: -30px;
+                    z-index: 1;
+                    display: none;
+                }
+            }
+
             .dplayer-comment {
                 display: inline-block;
                 height: 100%;

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.