rx-player icon indicating copy to clipboard operation
rx-player copied to clipboard

[QUESTION] Load experimental features from CDN

Open mkochman opened this issue 1 year ago • 7 comments

Hi 👋 I have a question about features that are not included in the base minified RxPlayer build, basically I load RxPlayer from private cdn but it doesn't include features like metaplaylist, dash wasm etc. Is there some way to have those features separated as e.g. modules/packages that I can load them additionally from cdn?

mkochman avatar Jan 16 '25 08:01 mkochman

Hi,

I've PoCed the possibility of making individual features bundles, but there's some drawbacks and maintenance complexities in doing that on our side.

You're in a case where you have no bundler in your applications? Just bundling a single file like:

import { MULTI_THREAD } from "rx-player/experimental/features";
RxPlayer.addFeatures([MULTI_THREAD]);

Assuming that RxPlayer is here available in global scope, should allow to add the corresponding feature.

peaBerberian avatar Jan 23 '25 14:01 peaBerberian

Also as you wrote about it, do you use the METAPLAYLIST feature?

We're currently wondering how we could make some evolutions with it (or even replace it by something better), so it would be interesting to have a usage example if you do use it.

peaBerberian avatar Jan 23 '25 14:01 peaBerberian

About METAPLAYLIST, so far we want to integrate it, because we have some ideas about streaming experience improvements. And here comes some ideas:

  1. First, we have something like separate video intro feature that so far we load it separately before the main stream starts. I've used your function for structure of metaplaylist generation createMetaplaylist, first of all we switched video intro stream type from mp4 to DASH :D Main stream is DRM Dash, so I've created proper keys for access logic and used metaplaylist for it. It seems to work, but not everything, there are no subtitles(they are not working with metaplaylist). textTrackMode is html and I pass textTrackElement 🤔

  2. For CSAI ads, we have CVP(custom vast parser), so I've created custom logic for VAST parsing and some ads management system to play ads, mostly it was done due CTV requirements, for old TV's and devices where only one video element is allowed in DOM. The player core engine for that is selectable and one from it is RxPlayer and if here we will use METAPLAYLIST then we can reduce unnecessary ads stream loads and create something more like one ad break stream. So far I cannot do that on my side, because ads are provided as mp4 in VAST XD But soon they want to switch to DASH ;)

  3. SGAI, we have small steps in that direction XD I wonder if we can use METAPLAYLIST for this 🤔 Case for us is to add dynamically ads while live stream is playing, so far we have lowest priority for this.

  4. Point 1 and 2 as one METAPLAYLIST, I wonder how it will works and what performance will be there if all are merged ;) I assume CSAI will change to something like SSAI :D

mkochman avatar Jan 27 '25 13:01 mkochman

About bundler, it is more like I would like to generate minified experimental file e.g. MULTI_THREAD and put it in cdn 🤔 Then according to passed config download it and add to features in Rx. There is some kind of possibility to build minified file like that in Rx Player project? That I could e.g. download rx player project directly with selected version, by command generate that file, put in our CDN, then request for that file script and add feature with it in RX player?

mkochman avatar Jan 27 '25 13:01 mkochman

What I did is fork the repo and make the changes (expose the experimental feature) and create my own customized bundle file.

KunXi-Fox avatar Feb 17 '25 07:02 KunXi-Fox

Hi @KunXi-Fox,

If you're doing a bundle, it may not be a mandatory step to fork, or maybe you rely on the RxPlayer's bundler setup also so you don't have one to set?


You could just set-up a supplementary layer with e.g. esbuild as a bundler, the rx-player as a dependency in your package.json and the following js file to bundle:

import RxPlayer from "rx-player";
import { MULTI_THREAD } from "rx-player/experimental/features";
RxPlayer.addFeatures([MULTI_THREAD]);

export default RxPlayer;

peaBerberian avatar Feb 24 '25 16:02 peaBerberian

Hi @KunXi-Fox,

If you're doing a bundle, it may not be a mandatory step to fork, or maybe you rely on the RxPlayer's bundler setup also so you don't have one to set?

You could just set-up a supplementary layer with e.g. esbuild as a bundler, the rx-player as a dependency in your package.json and the following js file to bundle:

import RxPlayer from "rx-player"; import { MULTI_THREAD } from "rx-player/experimental/features"; RxPlayer.addFeatures([MULTI_THREAD]);

export default RxPlayer;

Yeah, that could also works. But we have some extra requirements not only to expose experimental feature to bundle file, but also need to keep es5 build for some legacy CTV devices. So fork the repo and make the changes seems more easier.

KunXi-Fox avatar Feb 26 '25 07:02 KunXi-Fox