AirenSoft / OvenPlayer

OvenPlayer is JavaScript-based LLHLS and WebRTC Player for OvenMediaEngine.
https://airensoft.com/ome.html
MIT License
516 stars 126 forks source link

Feature request: ovenplayer as library to feed existing HTMLMediaElement #276

Open basisbit opened 2 years ago

basisbit commented 2 years ago

I use OvenMediaEngine for streaming video into a small non-commercial webbrowser video game that uses 2D canvas as game surface. So far I use a fork of OvenPlayer from middle of last year before "the big refactoring". However, that refactoring made the current WebRTC client code very hard to use without also having to use all the rest of OvenPlayer, including the event handling and HTMLMediaElement instantiation and so on of it.

In my opinion it would be good for the OvenMediaServer project, to also provide a very easy and lightweight to use library of OvenPlayer, which only contains the bare minimum to add WebRTC and LL-HLS playback support to an existing (not from OvenPlayer) HMLVideoElement + HTMLAudioElement / or existing HTMLMediaElement, so that the consumer of the library can decide what they want to do with it, instead of being forced to also have all the rest of OvenPlayer.

What I am looking for is a ability to build OvenPlayer, so the result only contains /src/js/api/provider/html5/providers/WebRTC.js plus WebRTCLoader.js , as well as the bare minimum to instantiate these classes and feed their functions, as well as being able to emit / respond to events.

For my use case, I need to get the frames from the HTMLVideoElement so that I can then draw those on my in-game canvas.

The "simpleWebRTC" fork that I built from OvenPlayer is super tiny, while OvenPlayer as a whole is a very heavy weight component (mostly because of all those UI components and rarely needed but very heavy helper libraries, and all that UI configuration code). See for example https://raw.githubusercontent.com/basisbit/OvenPlayer/basisbit/simpleWebRTC/dist/production/ovenplayer/WebRTC.js


Additionally, such a super lightweight library just for playing LL-HLS with ABR support would also be nice.

SangwonOh commented 2 years ago

@basisbit Hi. I think that's a good suggestion. After discussing it with our team, I hope to be able to provide a very lightweight player library for webrtc and llhls.