mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-17 10:01:20 -08:00
Add subtitle name to track label
This commit is contained in:
1 parent
3d8d22a98a
commit
ce99b73d04
8 files changed
+13
-7
No files matched your search
@@ -174,6 +174,7 @@ export default class Artplayer extends Emitter {
|
||||
url: '',
|
||||
type: '',
|
||||
style: {},
|
||||
name: '',
|
||||
escape: true,
|
||||
encoding: 'utf-8',
|
||||
onVttLoad: (vtt) => vtt,
|
||||
|
||||
@@ -106,6 +106,7 @@ export default {
|
||||
},
|
||||
subtitle: {
|
||||
url: s,
|
||||
name: s,
|
||||
type: s,
|
||||
style: o,
|
||||
escape: b,
|
||||
|
||||
@@ -120,7 +120,7 @@ export default class Setting extends Component {
|
||||
remove(name) {
|
||||
const item = this.find(name);
|
||||
errorHandle(item, `Can't find [${name}] from the [setting]`);
|
||||
const parent = item.$parentItem?.selector || this.option;
|
||||
const parent = item.$parentItem ? item.$parentItem.selector : this.option;
|
||||
parent.splice(parent.indexOf(item), 1);
|
||||
this.option = Setting.makeRecursion(this.option);
|
||||
this.destroy();
|
||||
|
||||
@@ -84,14 +84,14 @@ export default class Subtitle extends Component {
|
||||
}
|
||||
|
||||
createTrack(kind, url) {
|
||||
const { template, proxy } = this.art;
|
||||
const { template, proxy, option } = this.art;
|
||||
const { $video, $track } = template;
|
||||
|
||||
const $newTrack = createElement('track');
|
||||
$newTrack.default = true;
|
||||
$newTrack.kind = kind;
|
||||
$newTrack.src = url;
|
||||
$newTrack.label = 'Artplayer';
|
||||
$newTrack.label = option.subtitle.name || 'Artplayer';
|
||||
$newTrack.track.mode = 'hidden';
|
||||
|
||||
this.eventDestroy();
|
||||
|
||||
Reference in new issue
Block a user