Skip to content

Commit

Permalink
fix(subtitles): use key 'url' for vtt url instead of 'subtitle'
Browse files Browse the repository at this point in the history
  • Loading branch information
ngyyuusora committed May 13, 2022
1 parent fa4835d commit 1f512ef
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ function initPlayers() {
subtitle: {
url: [
{
subtitle: 'https://s-sh-17-dplayercdn.oss.dogecdn.com/hikarunara.vtt',
url: 'https://s-sh-17-dplayercdn.oss.dogecdn.com/hikarunara.vtt',
lang: 'zh-cn',
name: '光',
},
{
subtitle: 'https://gist.githubusercontent.com/samdutton/ca37f3adaf4e23679957b8083e061177/raw/e19399fbccbc069a2af4266e5120ae6bad62699a/sample.vtt',
url: 'https://gist.githubusercontent.com/samdutton/ca37f3adaf4e23679957b8083e061177/raw/e19399fbccbc069a2af4266e5120ae6bad62699a/sample.vtt',
lang: 'en-us',
name: 'github',
},
Expand Down
2 changes: 1 addition & 1 deletion src/template/player.art
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
<div class="dplayer-subtitles-box">
<div class="dplayer-subtitles-panel">
{{ each options.subtitle.url }}
<div class="dplayer-subtitles-item" data-subtitle="{{ $value.subtitle }}">
<div class="dplayer-subtitles-item" data-subtitle="{{ $value.url }}">
<!-- if lang, show tran(lang). if lang and name, show name + (tran(lang)). if name, show name. off option use lang for translation. -->
<span class="dplayer-label">{{ $value.lang ? $value.name ? $value.name+' ('+tran($value.lang)+')' : tran($value.lang) : $value.name }}</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/template/video.art
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
{{ if url }}src="{{ url }}"{{ /if }}
>
{{ if enableSubtitle }}
<track class="dplayer-subtrack" kind="metadata" default src="{{ typeof subtitle.url === 'string' ? subtitle.url : subtitle.url[subtitle.index].subtitle }}"></track>
<track class="dplayer-subtrack" kind="metadata" default src="{{ typeof subtitle.url === 'string' ? subtitle.url : subtitle.url[subtitle.index].url }}"></track>
{{ /if }}
</video>

0 comments on commit 1f512ef

Please sign in to comment.