Speed Selection plugin
With the Speed Selection plugin, you can add support for viewers to select playback speed within the player. Being able to select playback speed can enhance the viewing experience by improving accessibility, enhancing learning and productivity, and providing better control. To see the Speed Selection plugin in action, view this demo.
Before you start
Before you use this plugin with the standalone player, we recommend the following steps:
- Read about embedding the core player in your site by adding the minimum CSS and JavaScript player components.
- Make sure you have a player token. For more, see Token configuration . Tokens aren't needed for local development.
- The instructions on this page generally assume you're using the Wowza Flowplayer CDN to embed the player in your site. If you're using npm, see our npm instructions or our TypeScript guide .
Install the plugin
To install the Speed Selection plugin, load it next to the core player:
<!-- Load standard player skin -->
<link rel="stylesheet" href="https://cdn.flowplayer.com/releases/native/3/stable/style/flowplayer.css">
<!-- Load player script -->
<script src="//cdn.flowplayer.com/releases/native/3/stable/flowplayer.min.js"></script>
<!-- Load plugin -->
<script src="//cdn.flowplayer.com/releases/native/3/stable/plugins/speed.min.js"></script>
// Import player library and basic CSS for player
import flowplayer from "@flowplayer/player";
import "@flowplayer/player/flowplayer.css";
// Import plugin
import Speed from "@flowplayer/player/plugins/speed";
Add HTML elements
Add the HTML components to render the player elements on your page:
<div id="player"></div>
Configure the plugin
The plugin can be set up at the top-level configuration under the speed
namespace. Configuration properties are outlined in the following table.
Property | Description |
---|---|
options array |
Sets up an array of speed factors where 1 is normal speed. If you don't specify anything in the configuration, the default [0.2, 0.5, 1, 2, 10] options are used. |
labels array |
Sets up an array where speed labels can be customized. By default, labels indices match entries in the options array. If custom labels aren't configured, entries from the options array are used with a playback speed multiplier or x . For example, if options contains [0.5, 1, 2] , the labels would be [0.5x, 1x, 2x] . |
Example
An example configuration for the Speed Selection plugin looks similar to this:
const player = flowplayer("#player", {
src : "//edge.flowplayer.org/functional.m3u8",
title: "Functional with speed menu",
token: "[your-player-token]",
speed: {
options: [0.5, 1, 2],
labels: ["Slow", "Normal", "Fast"]
}
});