Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(playback_speed): playbackSpeed guide #587

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/images/playbackSpeedConfig.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/playbackSpeedConfigNewRange.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/tracksLabelsAudio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/tracksLabelsVideo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
103 changes: 103 additions & 0 deletions docs/playback-speed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Playback Speed Configuration

The Kaltura Player exposes configuration and APIs that are used for controling the playback speed.

The default playback speed is 1
Values less than 1 will result in reducing playback speed relatively to the nornal speed
Values greater 1 will result in increasing playback speed relatively to the nornal speed


### Playback Speed UI control

The playback seepd can be changed using the UI setting => speed controller icon.


![example](./images/playbackSpeedConfig.png)

#### PlaybackRates

PlaybackRates sets the available rates at which the media can be played.

######The player default playbackRates :

```
[
0.5,
1,
1.5,
2
]
```

Application may change the default config by giving new range to the plyer playback config object
giladna marked this conversation as resolved.
Show resolved Hide resolved

```
"playback": {
...
"playbackRates": [
0.25,
0.5,
0.75,
1,
1.25,
1.5,
1.75,
2,
4
],
....
```

![example](./images/playbackSpeedConfigNewRange.png)

Note:

* Player may have issues to serve playack in high playback speed, especially on TV's
* Negative values are not valid
* Playback speed 0 will stop the playback


####Playback Speed API

Application may use the player API to get or set the player speed programatically.
make sure you set values which match the playbackRates Array values, ginving values which are out of that range will not impact the UI selected speed.
giladna marked this conversation as resolved.
Show resolved Hide resolved

* Get API


```
kalturaPlayer.playbackRate = 1

1

```

* Set API

```
kalturaPlayer.playbackRate = 0.5

0.5

```

#### Event: RATE_CHANGE

Application can listent to `RATE_CHANGE` event and be informed that such action was triggered by user
giladna marked this conversation as resolved.
Show resolved Hide resolved

```
const events = [
kalturaPlayer.Event.Core.RATE_CHANGE
];

events.forEach(eventName => {
kalturaPlayer.addEventListener(eventName, event => console.info('Event:', event.type, " ", event.payload));
});
```



#### Example:

**[Playback Speed Example](https://codepen.io/giladna/pen/Poawvre)**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment about Github Pages


121 changes: 121 additions & 0 deletions docs/tracks-labels-configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Tracks Labels Configuration

The Kaltura Player exposes configuration and APIs that are used for controling the tracks and tracks labels.
giladna marked this conversation as resolved.
Show resolved Hide resolved


Every track label can be cahanged using the player `customLabels` which configured on the player root level configuration object.
giladna marked this conversation as resolved.
Show resolved Hide resolved

[Klatura Player config](https://github.com/kaltura/kaltura-player-js/blob/master/docs/configuration.md#configcustomlabels)
[Playkit config](https://github.com/kaltura/playkit-js/blob/master/docs/configuration.md#configcustomlabels)

```
customLabels: {
//qualities: translateVideoQuality,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you leave this in, explain what it's used for

qualities: function (videoTrack) {
if (videoTrack.height > 500) {
return 'High';
}
return 'Low';
},
captions: translateLangCode,
audio: translateLangCode
}
```


### Video Tracks Lables: translation function

Video Track has the following parameters which can be used for implementing the label logic


VideoTrack structure:

```
{
"active": false,
"label": "360p",
"language": "",
"index": 1,
"available": true,
"bandwidth": 719794,
"width": 640,
"height": 360
}
```

```
const translateVideoQuality = (track) => {
if (track.height > 500) {
return 'High';
}
return 'Low';
};
```


### AudioText Tracks Labels: translation function

Audio/Text Tracks have the following parameters which can be used for implementing the labels logic


AudioTrack structure:

```
{
"id": 0,
"active": false,
"label": "English",
"language": "en",
"index": 0,
"available": true
}

```

TextTrack structure:

```
{
"id": 1,
"active": true,
"label": "Esp",
"language": "es",
"index": 1,
"available": true,
"kind": "subtitles",
"default": false
}
```

```
const translateLangCode = (track) => {
giladna marked this conversation as resolved.
Show resolved Hide resolved
if (track.language === "es" || track.language === "spa") {
return 'Spanish';
}
else if (track.language === "en" || track.language === "eng") {
return 'English';
}
return track.label;
};
```

### Tracks UI control

The tracks can be changed using the settings icon for video tracks and the globes icon for audio and text tracks
giladna marked this conversation as resolved.
Show resolved Hide resolved



![example](./images/tracksLabelsVideo.png)

![example](./images/tracksLabelsAudio.png)



#### Example:

**[Tracks Lables configuration](https://codepen.io/giladna/pen/WNyexqO)**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check how to replace with github pages


### Tracks Documentation

**[Tracks Documentation](https://github.com/kaltura/kaltura-player-js/blob/master/docs/managing-tracks.md)**