xgplayer 2.31.7 → 2.31.8
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/browser/controls/errorRetry.js +1 -1
- package/browser/controls/nativeTextTrack.js +1 -1
- package/browser/controls/screenShot.js +1 -1
- package/browser/core_player.js +1 -1
- package/browser/core_player.js.map +1 -1
- package/browser/index.js +2 -2
- package/browser/index.js.map +1 -1
- package/browser/simple_player.js +1 -1
- package/browser/simple_player.js.map +1 -1
- package/dist/controls/errorRetry.js +1 -1
- package/dist/controls/nativeTextTrack.js +1 -1
- package/dist/controls/screenShot.js +1 -1
- package/dist/core_player.js +1 -1
- package/dist/core_player.js.map +1 -1
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/simple_player.js +1 -1
- package/dist/simple_player.js.map +1 -1
- package/es/controls/errorRetry.js +1 -1
- package/es/controls/nativeTextTrack.js +1 -1
- package/es/controls/screenShot.js +1 -1
- package/es/core_player.js +1 -1
- package/es/core_player.js.map +1 -1
- package/es/index.js +2 -2
- package/es/index.js.map +1 -1
- package/es/simple_player.js +1 -1
- package/es/simple_player.js.map +1 -1
- package/package.json +1 -2
- package/src/controls/screenShot.js +13 -4
- package/version.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1221,7 +1221,7 @@ module.exports = exports["default"];
|
|
|
1221
1221
|
/* 8 */
|
|
1222
1222
|
/***/ (function(module) {
|
|
1223
1223
|
|
|
1224
|
-
module.exports = JSON.parse("{\"version\":\"2.31.
|
|
1224
|
+
module.exports = JSON.parse("{\"version\":\"2.31.8\"}");
|
|
1225
1225
|
|
|
1226
1226
|
/***/ }),
|
|
1227
1227
|
/* 9 */
|
|
@@ -8094,6 +8094,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8094
8094
|
var screenShot = function screenShot() {
|
|
8095
8095
|
var player = this;
|
|
8096
8096
|
var screenShotOptions = player.config.screenShot;
|
|
8097
|
+
var callBack = null;
|
|
8097
8098
|
if (!screenShotOptions) {
|
|
8098
8099
|
return;
|
|
8099
8100
|
}
|
|
@@ -8101,6 +8102,7 @@ var screenShot = function screenShot() {
|
|
|
8101
8102
|
player.video.setAttribute('crossOrigin', 'anonymous');
|
|
8102
8103
|
|
|
8103
8104
|
var encoderOptions = 0.92;
|
|
8105
|
+
|
|
8104
8106
|
if (screenShotOptions.quality || screenShotOptions.quality === 0) {
|
|
8105
8107
|
encoderOptions = screenShotOptions.quality;
|
|
8106
8108
|
}
|
|
@@ -8110,9 +8112,9 @@ var screenShot = function screenShot() {
|
|
|
8110
8112
|
var canvas = document.createElement('canvas');
|
|
8111
8113
|
var canvasCtx = canvas.getContext('2d');
|
|
8112
8114
|
var img = new Image();
|
|
8115
|
+
|
|
8113
8116
|
canvas.width = this.config.width || 600;
|
|
8114
8117
|
canvas.height = this.config.height || 337.5;
|
|
8115
|
-
|
|
8116
8118
|
var saveScreenShot = function saveScreenShot(data, filename) {
|
|
8117
8119
|
var saveLink = document.createElement('a');
|
|
8118
8120
|
saveLink.href = data;
|
|
@@ -8128,12 +8130,19 @@ var screenShot = function screenShot() {
|
|
|
8128
8130
|
save = screenShotOptions.saveImg === undefined ? save : screenShotOptions.saveImg;
|
|
8129
8131
|
canvas.width = player.video.videoWidth || 600;
|
|
8130
8132
|
canvas.height = player.video.videoHeight || 337.5;
|
|
8133
|
+
callBack = screenShotOptions.callBack;
|
|
8131
8134
|
img.onload = function () {
|
|
8132
8135
|
canvasCtx.drawImage(player.video, 0, 0, canvas.width, canvas.height);
|
|
8133
8136
|
img.src = canvas.toDataURL(type, encoderOptions).replace(type, 'image/octet-stream');
|
|
8134
8137
|
var screenShotImg = img.src.replace(/^data:image\/[^;]+/, 'data:application/octet-stream');
|
|
8138
|
+
var saveFileName = screenShotOptions.fileName || player.lang.SCREENSHOT;
|
|
8139
|
+
|
|
8135
8140
|
player.emit('screenShot', screenShotImg);
|
|
8136
|
-
save &&
|
|
8141
|
+
if (save && callBack) {
|
|
8142
|
+
callBack(screenShotImg, saveFileName, format);
|
|
8143
|
+
} else {
|
|
8144
|
+
save && saveScreenShot(screenShotImg, saveFileName + format);
|
|
8145
|
+
}
|
|
8137
8146
|
}();
|
|
8138
8147
|
};
|
|
8139
8148
|
player.on('screenShotBtnClick', player.screenShot);
|