xgplayer 2.32.0 → 2.32.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xgplayer",
3
- "version": "2.32.0",
3
+ "version": "2.32.2",
4
4
  "description": "video player",
5
5
  "main": "./dist/index.js",
6
6
  "typings": "./types/index.d.ts",
@@ -29,7 +29,7 @@
29
29
  "dependencies": {
30
30
  "chalk": "^2.3.2",
31
31
  "commander": "^2.15.1",
32
- "danmu.js": "^1.1.1",
32
+ "danmu.js": "^1.1.2",
33
33
  "downloadjs": "1.4.7",
34
34
  "draggabilly": "^2.2.0",
35
35
  "event-emitter": "^0.3.5",
@@ -57,11 +57,11 @@
57
57
  "core-js": "^2.5.4",
58
58
  "css-loader": "^0.28.11",
59
59
  "json-loader": "^0.5.7",
60
- "node-sass": "^4.8.3",
61
60
  "postcss-cssnext": "^3.1.0",
62
61
  "postcss-loader": "^2.1.5",
63
62
  "raw-loader": "^2.0.0",
64
- "sass-loader": "^6.0.7",
63
+ "sass": "^1.56.1",
64
+ "sass-loader": "^10.3.1",
65
65
  "style-loader": "^0.20.3",
66
66
  "sugarss": "^1.0.1",
67
67
  "uglifyjs-webpack-plugin": "^2.2.0",
@@ -1,6 +1,7 @@
1
1
  let screenShot = function () {
2
2
  let player = this
3
3
  let screenShotOptions = player.config.screenShot
4
+ let callBack = null
4
5
  if (!screenShotOptions) {
5
6
  return
6
7
  }
@@ -8,7 +9,8 @@ let screenShot = function () {
8
9
  player.video.setAttribute('crossOrigin', 'anonymous')
9
10
 
10
11
  let encoderOptions = 0.92
11
- if(screenShotOptions.quality || screenShotOptions.quality === 0) {
12
+
13
+ if (screenShotOptions.quality || screenShotOptions.quality === 0) {
12
14
  encoderOptions = screenShotOptions.quality
13
15
  }
14
16
  let type = screenShotOptions.type === undefined ? 'image/png' : screenShotOptions.type
@@ -17,9 +19,9 @@ let screenShot = function () {
17
19
  let canvas = document.createElement('canvas')
18
20
  let canvasCtx = canvas.getContext('2d')
19
21
  let img = new Image()
20
- canvas.width = this.config.width || 600
21
- canvas.height = this.config.height || 337.5
22
22
 
23
+ canvas.width = this.config.width || 600
24
+ canvas.height = this.config.height || 337.5
23
25
  let saveScreenShot = function (data, filename) {
24
26
  let saveLink = document.createElement('a')
25
27
  saveLink.href = data
@@ -33,12 +35,19 @@ let screenShot = function () {
33
35
  save = screenShotOptions.saveImg === undefined ? save : screenShotOptions.saveImg
34
36
  canvas.width = player.video.videoWidth || 600
35
37
  canvas.height = player.video.videoHeight || 337.5
38
+ callBack = screenShotOptions.callBack
36
39
  img.onload = (function () {
37
40
  canvasCtx.drawImage(player.video, 0, 0, canvas.width, canvas.height)
38
41
  img.src = canvas.toDataURL(type, encoderOptions).replace(type, 'image/octet-stream')
39
42
  let screenShotImg = img.src.replace(/^data:image\/[^;]+/, 'data:application/octet-stream')
43
+ let saveFileName = screenShotOptions.fileName || player.lang.SCREENSHOT
44
+
40
45
  player.emit('screenShot', screenShotImg)
41
- save && saveScreenShot(screenShotImg, '截图' + format)
46
+ if (save && callBack) {
47
+ callBack(screenShotImg, saveFileName, format)
48
+ } else {
49
+ save && saveScreenShot(screenShotImg, saveFileName + format)
50
+ }
42
51
  })()
43
52
  }
44
53
  player.on('screenShotBtnClick', player.screenShot)
@@ -14,10 +14,12 @@
14
14
  overflow: hidden;
15
15
  z-index: 9;
16
16
  outline: none;
17
+ pointer-events: none;
17
18
  > * {
18
19
  position: absolute;
19
20
  white-space: nowrap;
20
21
  z-index: 9;
22
+ pointer-events: auto;
21
23
  }
22
24
  }
23
25
  }
package/version.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "2.32.0"
2
+ "version": "2.32.2"
3
3
  }
package/webpack.config.js CHANGED
@@ -16,35 +16,40 @@ const rules = [{
16
16
  }
17
17
  },
18
18
  'postcss-loader',
19
- 'sass-loader'
19
+ {
20
+ loader: 'sass-loader',
21
+ options: {
22
+ implementation: require('sass')
23
+ }
24
+ }
20
25
  ]
21
26
  }, {
22
27
  test: /\.svg/,
23
28
  loader: 'raw-loader'
24
- }];
29
+ }]
25
30
 
26
31
  const umdModuleConfig = {
27
32
  rules
28
- };
33
+ }
29
34
 
30
35
  const babelModuleConfig = {
31
36
  rules: rules.concat({
32
- test:/\.(js|jsx)$/,
33
- use:{
34
- loader:'babel-loader',
35
- options:{
36
- presets:[
37
+ test: /\.(js|jsx)$/,
38
+ use: {
39
+ loader: 'babel-loader',
40
+ options: {
41
+ presets: [
37
42
  'es2015'
38
43
  ],
39
44
  plugins: [
40
- "add-module-exports",
41
- "babel-plugin-bulk-import"
45
+ 'add-module-exports',
46
+ 'babel-plugin-bulk-import'
42
47
  ]
43
48
  }
44
49
  },
45
- exclude:/node_modules/
50
+ exclude: /node_modules/
46
51
  })
47
- };
52
+ }
48
53
 
49
54
  const umd = {
50
55
  entry: {
@@ -107,10 +112,10 @@ const client = {
107
112
  }
108
113
  }
109
114
 
110
- const controls = ['airplay', 'cssFullscreen', 'danmu', 'definition', 'download', 'enter', 'error', 'errorRetry',
111
- 'flex', 'fullscreen', 'i18n', 'keyboard', 'loading', 'localPreview', 'memoryPlay', 'miniplayer', 'mobile', 'pc',
112
- 'pip', 'play', 'playbackRate', 'playNext', 'poster', 'progress', 'reload', 'replay', 'rotate', 'screenShot',
113
- 'start', 'textTrack', 'nativeTextTrack', 'time', 'volume'];
115
+ const controls = ['airplay', 'cssFullscreen', 'danmu', 'definition', 'download', 'enter', 'error', 'errorRetry',
116
+ 'flex', 'fullscreen', 'i18n', 'keyboard', 'loading', 'localPreview', 'memoryPlay', 'miniplayer', 'mobile', 'pc',
117
+ 'pip', 'play', 'playbackRate', 'playNext', 'poster', 'progress', 'reload', 'replay', 'rotate', 'screenShot',
118
+ 'start', 'textTrack', 'nativeTextTrack', 'time', 'volume']
114
119
 
115
120
  const umd_es6_controls = controls.map(key => {
116
121
  return {