Browse Source

volume notice; better volume up svg

DIYgod 7 years ago
parent
commit
d8cfa122b2
6 changed files with 12 additions and 6 deletions
  1. 0 0
      dist/DPlayer.min.js
  2. 0 0
      dist/DPlayer.min.js.map
  3. 1 1
      package.json
  4. 6 2
      src/DPlayer.js
  5. 4 2
      src/i18n.js
  6. 1 1
      src/options.js

File diff suppressed because it is too large
+ 0 - 0
dist/DPlayer.min.js


File diff suppressed because it is too large
+ 0 - 0
dist/DPlayer.min.js.map


+ 1 - 1
package.json

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

+ 6 - 2
src/DPlayer.js

@@ -868,7 +868,7 @@ class DPlayer {
     /**
     /**
      * Set volume
      * Set volume
      */
      */
-    volume (percentage, nostorage) {
+    volume (percentage, nostorage, nonotice) {
         percentage = parseFloat(percentage);
         percentage = parseFloat(percentage);
         if (!isNaN(percentage)) {
         if (!isNaN(percentage)) {
             percentage = percentage > 0 ? percentage : 0;
             percentage = percentage > 0 ? percentage : 0;
@@ -879,6 +879,10 @@ class DPlayer {
             if (!nostorage) {
             if (!nostorage) {
                 this.user.set('volume', percentage);
                 this.user.set('volume', percentage);
             }
             }
+            if (!nonotice) {
+                this.notice(`${this.tran('Volume')} ${(percentage * 100).toFixed(0)}%`);
+            }
+
             this.video.volume = percentage;
             this.video.volume = percentage;
             if (this.video.muted) {
             if (this.video.muted) {
                 this.video.muted = false;
                 this.video.muted = false;
@@ -1030,7 +1034,7 @@ class DPlayer {
             });
             });
         }
         }
 
 
-        this.volume(this.user.get('volume'), true);
+        this.volume(this.user.get('volume'), true, true);
 
 
         if (this.options.subtitle) {
         if (this.options.subtitle) {
             this.subtitle = new Subtitle(this.container.getElementsByClassName('dplayer-subtitle')[0], this.video, this.options.subtitle, this.events);
             this.subtitle = new Subtitle(this.container.getElementsByClassName('dplayer-subtitle')[0], this.video, this.options.subtitle, this.events);

+ 4 - 2
src/i18n.js

@@ -53,7 +53,8 @@ const tranTxt = {
         'Screenshot': '截图',
         'Screenshot': '截图',
         's': '秒',
         's': '秒',
         'Show subtitle': '显示字幕',
         'Show subtitle': '显示字幕',
-        'Hide subtitle': '隐藏字幕'
+        'Hide subtitle': '隐藏字幕',
+        'Volume': '音量'
     },
     },
     "zh-tw" : {
     "zh-tw" : {
         'Danmaku is loading': '彈幕加載中',
         'Danmaku is loading': '彈幕加載中',
@@ -87,6 +88,7 @@ const tranTxt = {
         'Screenshot': '截圖',
         'Screenshot': '截圖',
         's': '秒',
         's': '秒',
         'Show subtitle': '顯示字幕',
         'Show subtitle': '顯示字幕',
-        'Hide subtitle': '隱藏字幕'
+        'Hide subtitle': '隱藏字幕',
+        'Volume': '音量'
     }
     }
 };
 };

+ 1 - 1
src/options.js

@@ -32,7 +32,7 @@ module.exports = (options) => {
             ],
             ],
             'volume-up': [
             'volume-up': [
                 '0 0 21 32',
                 '0 0 21 32',
-                'M13.728 6.272v19.456q0 0.448-0.352 0.8t-0.8 0.32-0.8-0.32l-5.952-5.952h-4.672q-0.48 0-0.8-0.352t-0.352-0.8v-6.848q0-0.48 0.352-0.8t0.8-0.352h4.672l5.952-5.952q0.32-0.32 0.8-0.32t0.8 0.32 0.352 0.8zM20.576 16q0 1.344-0.768 2.528t-2.016 1.664q-0.16 0.096-0.448 0.096-0.448 0-0.8-0.32t-0.32-0.832q0-0.384 0.192-0.64t0.544-0.448 0.608-0.384 0.512-0.64 0.192-1.024-0.192-1.024-0.512-0.64-0.608-0.384-0.544-0.448-0.192-0.64q0-0.48 0.32-0.832t0.8-0.32q0.288 0 0.448 0.096 1.248 0.48 2.016 1.664t0.768 2.528zM25.152 16q0 2.72-1.536 5.056t-4 3.36q-0.256 0.096-0.448 0.096-0.48 0-0.832-0.352t-0.32-0.8q0-0.704 0.672-1.056 1.024-0.512 1.376-0.8 1.312-0.96 2.048-2.4t0.736-3.104-0.736-3.104-2.048-2.4q-0.352-0.288-1.376-0.8-0.672-0.352-0.672-1.056 0-0.448 0.32-0.8t0.8-0.352q0.224 0 0.48 0.096 2.496 1.056 4 3.36t1.536 5.056zM29.728 16q0 4.096-2.272 7.552t-6.048 5.056q-0.224 0.096-0.448 0.096-0.48 0-0.832-0.352t-0.32-0.8q0-0.64 0.704-1.056 0.128-0.064 0.384-0.192t0.416-0.192q0.8-0.448 1.44-0.896 2.208-1.632 3.456-4.064t1.216-5.152-1.216-5.152-3.456-4.064q-0.64-0.448-1.44-0.896-0.128-0.096-0.416-0.192t-0.384-0.192q-0.704-0.416-0.704-1.056 0-0.448 0.32-0.8t0.832-0.352q0.224 0 0.448 0.096 3.776 1.632 6.048 5.056t2.272 7.552z'
+                'M13.728 6.272v19.456q0 0.448-0.352 0.8t-0.8 0.32-0.8-0.32l-5.952-5.952h-4.672q-0.48 0-0.8-0.352t-0.352-0.8v-6.848q0-0.48 0.352-0.8t0.8-0.352h4.672l5.952-5.952q0.32-0.32 0.8-0.32t0.8 0.32 0.352 0.8zM20.576 16q0 1.344-0.768 2.528t-2.016 1.664q-0.16 0.096-0.448 0.096-0.448 0-0.8-0.32t-0.32-0.832q0-0.384 0.192-0.64t0.544-0.448 0.608-0.384 0.512-0.64 0.192-1.024-0.192-1.024-0.512-0.64-0.608-0.384-0.544-0.448-0.192-0.64q0-0.48 0.32-0.832t0.8-0.32q0.288 0 0.448 0.096 1.248 0.48 2.016 1.664t0.768 2.528zM25.152 16q0 2.72-1.536 5.056t-4 3.36q-0.256 0.096-0.448 0.096-0.48 0-0.832-0.352t-0.32-0.8q0-0.704 0.672-1.056 1.024-0.512 1.376-0.8 1.312-0.96 2.048-2.4t0.736-3.104-0.736-3.104-2.048-2.4q-0.352-0.288-1.376-0.8-0.672-0.352-0.672-1.056 0-0.448 0.32-0.8t0.8-0.352q0.224 0 0.48 0.096 2.496 1.056 4 3.36t1.536 5.056z'
             ],
             ],
             'volume-down': [
             'volume-down': [
                 '0 0 21 32',
                 '0 0 21 32',

Some files were not shown because too many files changed in this diff