Skip to content

Commit

Permalink
Merge pull request #764 from jikkai/feat/playback-speed
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed May 23, 2020
2 parents af4d697 + 811e530 commit b319779
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 19 deletions.
1 change: 1 addition & 0 deletions docs/guide.md
Expand Up @@ -106,6 +106,7 @@ You can custom your player instance by those options
| hotkey | true | enable hotkey, support FF, FR, volume control, play & pause |
| preload | 'auto' | values: 'none', 'metadata', 'auto' |
| volume | 0.7 | default volume, notice that player will remember user setting, default volume will not work after user set volume themselves |
| playbackSpeed | [0.5, 0.75, 1, 1.25, 1.5, 2] | default playback speed, or or you can set a custom one |
| logo | - | showing logo in the top left corner, you can adjust its size and position by CSS |
| apiBackend | - | getting and sending danmaku in your way, see [#live](#live) |
| video | - | video info |
Expand Down
1 change: 1 addition & 0 deletions docs/zh/guide.md
Expand Up @@ -96,6 +96,7 @@ DPlayer 有丰富的参数可以自定义你的播放器实例
| hotkey | true | 开启热键,支持快进、快退、音量控制、播放暂停 |
| preload | 'auto' | 视频预加载,可选值: 'none', 'metadata', 'auto' |
| volume | 0.7 | 默认音量,请注意播放器会记忆用户设置,用户手动设置音量后默认音量即失效 |
| playbackSpeed | [0.5, 0.75, 1, 1.25, 1.5, 2] | 默认播放速率,可以设置成自定义的数组 |
| logo | - | 在左上角展示一个 logo,你可以通过 CSS 调整它的大小和位置 |
| apiBackend | - | 自定义获取和发送弹幕行为,见[#直播](#直播) |
| video | - | 视频信息 |
Expand Down
1 change: 0 additions & 1 deletion src/css/controller.scss
Expand Up @@ -434,7 +434,6 @@
}
&.dplayer-setting-box-narrow {
width: 70px;
height: 180px;
text-align: center;
}
&.dplayer-setting-box-speed {
Expand Down
1 change: 1 addition & 0 deletions src/js/options.js
Expand Up @@ -14,6 +14,7 @@ export default (options) => {
hotkey: true,
preload: 'metadata',
volume: 0.7,
playbackSpeed: [0.5, 0.75, 1, 1.25, 1.5, 2],
apiBackend: defaultApiBackend,
video: {},
contextmenu: [],
Expand Down
23 changes: 5 additions & 18 deletions src/template/player.art
Expand Up @@ -170,24 +170,11 @@
</div>
</div>
<div class="dplayer-setting-speed-panel">
<div class="dplayer-setting-speed-item" data-speed="0.5">
<span class="dplayer-label">0.5</span>
</div>
<div class="dplayer-setting-speed-item" data-speed="0.75">
<span class="dplayer-label">0.75</span>
</div>
<div class="dplayer-setting-speed-item" data-speed="1">
<span class="dplayer-label">{{ tran('Normal') }}</span>
</div>
<div class="dplayer-setting-speed-item" data-speed="1.25">
<span class="dplayer-label">1.25</span>
</div>
<div class="dplayer-setting-speed-item" data-speed="1.5">
<span class="dplayer-label">1.5</span>
</div>
<div class="dplayer-setting-speed-item" data-speed="2">
<span class="dplayer-label">2</span>
</div>
{{ each options.playbackSpeed }}
<div class="dplayer-setting-speed-item" data-speed="{{ $value }}">
<span class="dplayer-label">{{ $value === 1 ? tran('Normal') : $value }}</span>
</div>
{{ /each }}
</div>
</div>
</div>
Expand Down

0 comments on commit b319779

Please sign in to comment.