Skip to content

Conversation

@adrums86
Copy link
Collaborator

@adrums86 adrums86 commented Feb 1, 2025

Description

  • add getHlsParser functionality to the service locator.
  • add basic service locator tests

Specific Changes proposed

expose the full HLS parser through the a getHlsParser function and add tests.

Requirements Checklist

  • Feature implemented / Bug fixed
  • Change has been verified in an actual browser (Chrome, Firefox, Safari, Edge) (if applicable)
  • Unit Tests updated or fixed (if applicable)
  • Docs/guides updated (if applicable)

@codecov
Copy link

codecov bot commented Feb 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.28%. Comparing base (756c570) to head (fb16cea).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #50      +/-   ##
==========================================
+ Coverage   63.95%   64.28%   +0.33%     
==========================================
  Files         114      114              
  Lines        4830     4833       +3     
  Branches      633      635       +2     
==========================================
+ Hits         3089     3107      +18     
+ Misses       1733     1719      -14     
+ Partials        8        7       -1     
Flag Coverage Δ
dash-parser 64.28% <100.00%> (+0.33%) ⬆️
env-capabilities 64.28% <100.00%> (+0.33%) ⬆️
hls-parser 64.28% <100.00%> (+0.33%) ⬆️
playback 64.28% <100.00%> (+0.33%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@netlify
Copy link

netlify bot commented Feb 1, 2025

Deploy Preview for videojsdev ready!

Name Link
🔨 Latest commit fb16cea
🔍 Latest deploy log https://app.netlify.com/sites/videojsdev/deploys/67bf4b13c3c1bc00086090a3
😎 Deploy Preview https://deploy-preview-50--videojsdev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions
Copy link

github-actions bot commented Feb 1, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
dash-parser/dist/cjs/index.min.js 3.65 KB (0%) 73 ms (0%) 433 ms (+277.41% 🔺) 505 ms
dash-parser/dist/es/index.min.js 2.67 KB (0%) 54 ms (0%) 87 ms (+39.48% 🔺) 141 ms
dash-parser/dist/iife/index.min.js 3.65 KB (0%) 74 ms (0%) 40 ms (-88.58% 🔽) 113 ms
hls-parser/dist/cjs/index.min.js 5.77 KB (0%) 116 ms (0%) 247 ms (-25.42% 🔽) 362 ms
hls-parser/dist/es/index.min.js 3.37 KB (0%) 68 ms (0%) 145 ms (-37.72% 🔽) 212 ms
hls-parser/dist/iife/index.min.js 5.78 KB (0%) 116 ms (0%) 80 ms (-83.32% 🔽) 196 ms
playback/dist/player/core/cjs/index.min.js 5.93 KB (+0.07% 🔺) 119 ms (+0.07% 🔺) 84 ms (-46.76% 🔽) 202 ms
playback/dist/player/core/es/index.min.js 3.42 KB (0%) 69 ms (0%) 113 ms (-65.24% 🔽) 181 ms
playback/dist/player/core/iife/index.min.js 5.94 KB (+0.04% 🔺) 119 ms (+0.04% 🔺) 230 ms (-19.57% 🔽) 349 ms
playback/dist/player-with-worker/core/cjs/index.min.js 8.2 KB (-0.06% 🔽) 164 ms (-0.06% 🔽) 399 ms (+11.65% 🔺) 563 ms
playback/dist/player-with-worker/core/es/index.min.js 6.23 KB (-0.08% 🔽) 125 ms (-0.08% 🔽) 371 ms (+10.12% 🔺) 496 ms
playback/dist/player-with-worker/core/iife/index.min.js 8.2 KB (-0.11% 🔽) 164 ms (-0.11% 🔽) 295 ms (-9.5% 🔽) 459 ms
env-capabilities/dist/cjs/index.min.js 1.61 KB (0%) 33 ms (0%) 24 ms (-4.88% 🔽) 56 ms
env-capabilities/dist/es/index.min.js 0 B (+100% 🔺) 0 ms (+100% 🔺) 5 ms (+1.97% 🔺) 5 ms
env-capabilities/dist/iife/index.min.js 1.62 KB (0%) 33 ms (0%) 14 ms (-57.8% 🔽) 46 ms

@adrums86 adrums86 marked this pull request as ready for review February 4, 2025 00:33
});
return new HlsPipeline(dependencies);
}
}
Copy link
Collaborator

@dzianis-dashkevich dzianis-dashkevich Feb 5, 2025

Choose a reason for hiding this comment

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

So, the flow is following:
user registers pipeline-loaders via pipelineLoaderFactory storage, or via separate api for worker-based player (so it is opt-in operation)
user calls load with some payload includeing mimeType
player checks and finds match for loaded mimeType and pipeline-loader-factory
player creates pipeline-loader instace via found factory and injects core deps
player passes loadPlayload to the created loader instance
loader creates parser via registered factory and injects core deps
loader loads manifest/playlist
loader parses received data
loader creates pipeline via registered factories and passes core deps and parser instance and returns this instance back to the player.
so as you can see there is a layer of dependency injections
so, we should have a static members to register hls parser factory (not instance) in the hls-pipeline-loader (not pipeline itself)
anticipated follow-up question:
why do we need pipeline-loader? can’t we just create pipeline directly in the player?
because we want separate classes for live and vod pipelines and we don’t know ahead of time which one to create. We can understand it only once we load and parse playlist/manifest.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

so, we should have a static members to register hls parser factory (not instance) in the hls-pipeline-loader (not pipeline itself)

For clarification, do we want to expose the instance of the parser (this.parser_) from the hls-pipeline-loader via the service-locator or do we want to simply expose the factory? I refactored to expose registered factory, per the feedback above, however the rfc example indicates we would want to expose the current instance of the parser instead:

const hlsParser = serviceLocator.getHlsParser();

hlsParser.parse(playlist);


public static getHlsParser(): typeof ChunkPlaylistParser | null {
return HlsPipelineLoader.hlsParserFactory_;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we rename getters and setter as getHlsParserFactory and setHlsParserFactory?


public getHlsParser(): typeof ChunkPlaylistParser | null {
return HlsPipelineLoader.getHlsParser();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

lets just remove HLS parser from service locator for now

const parser = ChunkHlsParser ? ChunkHlsParser.create({}) : null;
expect(parser).toBeInstanceOf(ChunkPlaylistParser);
});
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we remove this test for now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants