SoundCloud:切换播放速度
工具栏操作:在 1x、1.25x、1.5x 和 2x 之间循环切换 SoundCloud 曲目的播放速度。
可复制的代码
// SoundCloud: cycle the audio playback speed 1x to 1.25x to 1.5x to 2x.
(function () {
var steps = [1, 1.25, 1.5, 2];
var media = document.querySelector('audio, video');
if (!media) { alert('No SoundCloud audio is playing right now.'); return; }
var i = steps.indexOf(media.playbackRate);
var next = steps[(i + 1) % steps.length];
try {
media.playbackRate = next;
alert('Playback speed set to ' + next + 'x.');
} catch (e) {
alert('Could not change playback speed: ' + e.message);
}
})();
如何使用此示例
- 用上方按钮复制代码。
- 安装 JustZix(2 分钟),在目标页面打开扩展。
- 添加一条匹配该页面的新规则。
- 启用操作面板,在「操作」选项卡中添加按钮并粘贴代码 — 一键运行。
为此示例评分
暂无评分 — 成为第一个。