mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 08:51:20 -08:00
精简eslinet
This commit is contained in:
1 parent
fba16c2432
commit
6fb1b0eb6e
7 files changed
+14
-40
No files matched your search
@@ -5,31 +5,9 @@
|
|||||||
"browser": true,
|
"browser": true,
|
||||||
"es6": true
|
"es6": true
|
||||||
},
|
},
|
||||||
"globals": {
|
|
||||||
"Artplayer": false,
|
|
||||||
"jQuery": false
|
|
||||||
},
|
|
||||||
"rules": {
|
"rules": {
|
||||||
"class-methods-use-this": 2,
|
|
||||||
"no-console": 0,
|
|
||||||
"import/no-cycle": 1,
|
|
||||||
"no-const-assign": 1,
|
|
||||||
"no-shadow": 0,
|
"no-shadow": 0,
|
||||||
"no-this-before-super": 1,
|
"no-param-reassign": 0
|
||||||
"no-undef": 1,
|
|
||||||
"no-unreachable": 1,
|
|
||||||
"no-unused-vars": 1,
|
|
||||||
"constructor-super": 1,
|
|
||||||
"valid-typeof": 1,
|
|
||||||
"indent": [2, 4, { "SwitchCase": 1 }],
|
|
||||||
"quotes": [2, "single", "avoid-escape"],
|
|
||||||
"semi": [2, "always"],
|
|
||||||
"eqeqeq": [2, "always"],
|
|
||||||
"one-var": [2, "never"],
|
|
||||||
"comma-dangle": [2, "always-multiline"],
|
|
||||||
"spaced-comment": [2, "always"],
|
|
||||||
"no-restricted-globals": 2,
|
|
||||||
"no-param-reassign": [2, { "props": false }]
|
|
||||||
},
|
},
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"sourceType": "module"
|
"sourceType": "module"
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ class ArtplayerToolThumbnail extends Emitter {
|
|||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
this.emit('error', err.message);
|
this.emit('error', err.message);
|
||||||
console.error(err);
|
throw err;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,7 +135,7 @@ class ArtplayerToolThumbnail extends Emitter {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error(err);
|
throw err;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -150,13 +150,13 @@ class ArtplayerToolThumbnail extends Emitter {
|
|||||||
.catch(err => {
|
.catch(err => {
|
||||||
this.processing = false;
|
this.processing = false;
|
||||||
this.emit('error', err.message);
|
this.emit('error', err.message);
|
||||||
console.error(err);
|
throw err;
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
this.processing = false;
|
this.processing = false;
|
||||||
this.emit('error', err.message);
|
this.emit('error', err.message);
|
||||||
console.error(err);
|
throw err;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ function nativePip(art, player) {
|
|||||||
if (value) {
|
if (value) {
|
||||||
$video.requestPictureInPicture().catch(error => {
|
$video.requestPictureInPicture().catch(error => {
|
||||||
notice.show(error, true, 3000);
|
notice.show(error, true, 3000);
|
||||||
console.warn(error);
|
throw error;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
document.exitPictureInPicture().catch(error => {
|
document.exitPictureInPicture().catch(error => {
|
||||||
notice.show(error, true, 3000);
|
notice.show(error, true, 3000);
|
||||||
console.warn(error);
|
throw error;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export default function playMix(art, player) {
|
|||||||
if (promise !== undefined) {
|
if (promise !== undefined) {
|
||||||
promise.then().catch(err => {
|
promise.then().catch(err => {
|
||||||
notice.show(err, true, 3000);
|
notice.show(err, true, 3000);
|
||||||
console.warn(err);
|
throw err;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ export default function screenshotMix(art, player) {
|
|||||||
return canvas.toDataURL('image/png');
|
return canvas.toDataURL('image/png');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notice.show(error);
|
notice.show(error);
|
||||||
console.warn(error);
|
throw error;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export default function localPreview(art) {
|
export default function localPreview(art) {
|
||||||
const { append, setStyle, setStyles, sleep } = art.constructor.utils;
|
const { append, setStyle, setStyles, sleep, errorHandle } = art.constructor.utils;
|
||||||
const {
|
const {
|
||||||
events: { proxy },
|
events: { proxy },
|
||||||
option,
|
option,
|
||||||
@@ -37,7 +37,7 @@ export default function localPreview(art) {
|
|||||||
} else {
|
} else {
|
||||||
const tip = `${i18n.get('Playback of this file format is not supported')}: ${file.type}`;
|
const tip = `${i18n.get('Playback of this file format is not supported')}: ${file.type}`;
|
||||||
notice.show(tip, true, 3000);
|
notice.show(tip, true, 3000);
|
||||||
console.warn(tip);
|
errorHandle(false, tip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,17 +59,14 @@ export default class Subtitle {
|
|||||||
return response.text();
|
return response.text();
|
||||||
})
|
})
|
||||||
.then(text => {
|
.then(text => {
|
||||||
let vttUrl = '';
|
|
||||||
if (/x-subrip/gi.test(type)) {
|
if (/x-subrip/gi.test(type)) {
|
||||||
vttUrl = vttToBlob(srtToVtt(text));
|
return vttToBlob(srtToVtt(text));
|
||||||
} else {
|
|
||||||
vttUrl = url;
|
|
||||||
}
|
}
|
||||||
return vttUrl;
|
return url;
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
notice.show(err);
|
notice.show(err);
|
||||||
console.warn(err);
|
throw err;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user