You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+14-1Lines changed: 14 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,19 @@
2
2
3
3
All notable changes to this project will be documented in this file.
4
4
5
+
## [1.0.14]
6
+
7
+
### Audio & Subtitle Tracks
8
+
9
+
-**Switch by name (label)** – `setAudioTrack(languageName)` / `setSubtitleTrack(languageName | null)` switch tracks by **label/name** (no numeric ids required).
10
+
-**Set defaults by name** – New attributes:
11
+
-`default-audio-track="French"`
12
+
-`default-subtitle-track="English"`
13
+
-**Cleaner track lists** – `getAudioTracks()` / `getSubtitleTracks()` now avoid duplicate entries when multiple tracks share the same label.
14
+
-**Better events for integrations**
15
+
-`fastpixtracksready` includes the **full current track objects** (`currentAudioTrackLoaded`, `currentSubtitleLoaded`) in addition to the track lists.
16
+
-`fastpixaudiochange` / `fastpixsubtitlechange` include the **current track object** (`currentTrack`) so you can log/update UI easily.
17
+
5
18
## [1.0.13]
6
19
7
20
### Readme.md
@@ -147,4 +160,4 @@ All notable changes to this project will be documented in this file.
147
160
-**Placeholder**: Added placeholder support for loading states.
148
161
-**offline/online control**: Provided control mechanisms for offline/online scenarios.
149
162
-**Title Display**: Implemented title display options for videos.
150
-
-**Overriding Default Behaviors**: Allowed users to override default player behaviors.
163
+
-**Overriding Default Behaviors**: Allowed users to override default player behaviors.
Copy file name to clipboardExpand all lines: README.md
+65-1Lines changed: 65 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,70 @@ This SDK simplifies HLS video playback by offering a wide range of customization
44
44
45
45
- Users can switch between available subtitles and audio tracks during playback, offering a personalized viewing experience. This feature allows viewers to choose their preferred language or audio option easily.
46
46
47
+
-## Audio & Subtitle Tracks (integration guide)
48
+
49
+
This section documents **how to read tracks, set defaults, switch tracks, and consume events**.
50
+
For the full API reference, see **`AUDIO_SUBTITLE_TRACKS_API.md`** (in this folder).
51
+
52
+
-**Integration steps (recommended)**:
53
+
- Include the player script (`dist/player.js`) and add a `<fastpix-player>` element with a `playback-id`.
54
+
- Optionally set defaults by **name/label** using:
55
+
-`default-audio-track="French"`
56
+
-`default-subtitle-track="English"`
57
+
- Attach listeners for:
58
+
-`fastpixtracksready` (initial track snapshot; may re-emit once subtitle `textTracks` attach)
59
+
-`fastpixaudiochange` / `fastpixsubtitlechange` (only for explicit changes)
60
+
- Build your UI from `getAudioTracks()` / `getSubtitleTracks()` and call `setAudioTrack(...)` / `setSubtitleTrack(...)` to switch.
61
+
62
+
-**Important behavior**:
63
+
-**Track switching is label-only**: no numeric ids are accepted by `setAudioTrack` / `setSubtitleTrack`.
64
+
-**Duplicate labels are de-duped** (case-insensitive): if multiple tracks share the same label/name, the player keeps one entry (prefers the currently active one).
65
+
-**`fastpixtracksready` timing**: audio tracks are known at HLS `MANIFEST_PARSED`, but subtitle `textTracks` can attach slightly later, so the player may emit `fastpixtracksready` again with populated subtitle tracks.
66
+
67
+
-**Attributes**:
68
+
69
+
| Attribute | Type | Meaning |
70
+
|---|---:|---|
71
+
|`default-audio-track`| string | Default **audio** track by label/name (case-insensitive) |
72
+
|`default-subtitle-track`| string | Default **subtitle** track by label/name (case-insensitive) |
73
+
|`disable-hidden-captions`| boolean | Disables subtitles/captions automatically on load |
74
+
75
+
-**Methods**:
76
+
77
+
| Method | Purpose |
78
+
|---|---|
79
+
|`getAudioTracks()`| Returns de-duped audio track list (each track has `label`, `language`, `isCurrent`) |
80
+
|`getSubtitleTracks()`| Returns de-duped subtitle list (each track has `label`, `language`, `isCurrent`) |
81
+
|`setAudioTrack(languageName)`| Switch audio by **label/name**|
82
+
|`setSubtitleTrack(languageName \| null)`| Switch subtitles by **label/name**, or `null` to turn Off |
83
+
|`disableSubtitles()`| Turns subtitles Off (equivalent to UI “Off”) |
84
+
85
+
-**Events**:
86
+
87
+
| Event | When it fires |`event.detail` (key fields) |
88
+
|---|---|---|
89
+
|`fastpixtracksready`| After manifest parse; may re-emit when subtitle `textTracks` attach |`audioTracks`, `subtitleTracks`, `currentAudioTrackLoaded`, `currentSubtitleLoaded` (plus legacy ids) |
90
+
|`fastpixaudiochange`| Only when audio is explicitly changed (menu click or `setAudioTrack`) |`tracks`, `currentId`, `currentTrack`|
91
+
|`fastpixsubtitlechange`| Only when subtitles are explicitly changed (menu click / Off / programmatic) |`tracks`, `currentId`, `currentTrack`|
92
+
|`fastpixsubtitlecue`| Whenever a cue changes for the active subtitle track |`{ text, language, startTime, endTime }`|
93
+
94
+
-**Demo explained (`test/index.html`)**:
95
+
-**Markup**:
96
+
-`<fastpix-player ... default-audio-track="French" default-subtitle-track="English">` sets initial tracks by **name**.
97
+
- Each `.player-container` includes a `<div class="custom-subtitle" data-role="custom-subtitle"></div>` overlay for custom-rendered subtitles.
- The demo attaches a `fastpixsubtitlecue` listener to **every**`fastpix-player` on the page.
100
+
- It scopes rendering to the player’s own container using `closest('.player-container')`, so multiple players don’t overwrite each other.
101
+
- The overlay is `display: none` by default and only shown when a subtitle is enabled and a non-empty cue arrives.
102
+
-**Track UI**:
103
+
- On `fastpixtracksready`, the demo calls `getAudioTracks()` and renders buttons.
104
+
- Subtitles can appear later, so it **polls**`getSubtitleTracks()` briefly and renders subtitle buttons once available.
105
+
-**Logging current track details**:
106
+
-`fastpixaudiochange` / `fastpixsubtitlechange` listeners log the **current track object** (`detail.currentTrack`), regardless of whether the change came from the built-in menu or the programmatic API.
107
+
108
+
-**Full reference**:
109
+
- See **`AUDIO_SUBTITLE_TRACKS_API.md`** for the complete API, examples, and best practices.
110
+
47
111
-## Styling and color customization:
48
112
49
113
- Customize the player’s visual elements using the `accent-color`, `primary-color`, and `secondary-color` attributes:
@@ -1576,4 +1640,4 @@ For a full **Shorts-style feed** in React 19 (multiple vertical shorts, scroll s
You can reuse the HTML/CSS/script above in your own page or adapt the pattern from the React demo to get your own seekbar design while keeping FastPix thumbnail hover previews and seeking behavior.
1643
+
You can reuse the HTML/CSS/script above in your own page or adapt the pattern from the React demo to get your own seekbar design while keeping FastPix thumbnail hover previews and seeking behavior.
0 commit comments