@byomakase/omakase-player 1.3.0 → 1.3.1-RC2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -269,12 +269,17 @@ It could be that one-time-only user interaction (such as clicking on play button
269
269
 
270
270
  ### Playback engine
271
271
 
272
- We can get the playback engines used for the main media. If HLS media is loaded, then hls.js instance can be fetched.
272
+ We can get the playback engine of the loaded main media. It returns `undefined` if no main media is loaded. If HLS media is loaded, then hls.js instance can be fetched.
273
273
 
274
274
  ```javascript
275
- // Get hls.js instance and hook onto hls.js events
276
- let hlsPlaybackEngine = omakasePlayer.player.getPlaybackEngine(MainMediaType.HLS);
277
- hlsPlaybackEngine.hls.on('hlsManifestParsed', (event, data) => {
275
+ // Playback engine of the loaded main media, narrow it by its mainMediaType
276
+ let playbackEngine = omakasePlayer.player.getPlaybackEngine();
277
+ if (playbackEngine?.mainMediaType === MainMediaType.HLS) {
278
+ console.log(`hls.js version`, playbackEngine.hls?.constructor.version);
279
+ }
280
+
281
+ // Or pass the expected main media type, returns undefined if loaded main media is of a different type
282
+ omakasePlayer.player.getPlaybackEngine(MainMediaType.HLS)?.hls?.on('hlsManifestParsed', (event, data) => {
278
283
  console.log(`HLS manifest parsed`, data);
279
284
  });
280
285
  ```