Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multiple streams #525

Merged
merged 5 commits into from
Aug 24, 2023

Conversation

dbuezas
Copy link
Contributor

@dbuezas dbuezas commented Jul 11, 2023

Adds support for multiple streams per card, each with a different URL, name and mode (optional)
Kapture 2023-07-11 at 23 41 58

type: custom:webrtc-camera
streams:
  - url: camera_hd_stream
    name: HD
    mode: mse
  - url: camera_sd_stream
    name: SD
    mode: webrtc
ui: true

Closes #523

@dbuezas
Copy link
Contributor Author

dbuezas commented Jul 12, 2023

One detail worth considering is that the stream name button/label shows the next stream instead of the current one. This is because I interprete it as a "button to switch to that stream"

It may be best to show the active stream instead

@AlexxIT
Copy link
Owner

AlexxIT commented Jul 12, 2023

Yes. I think it's better to show current stream name. But tooltip can show next name.

@dbuezas
Copy link
Contributor Author

dbuezas commented Jul 12, 2023

Alright, it now shows the name of the current stream

@direx1
Copy link

direx1 commented Jul 21, 2023

This is a great feature but is this always going to load the first stream in the list or retain current one after a refresh. Really I want to load a low res each time but have the option to switch to HD periodically. Another thought would be possibly to have the option for 2 of these buttons or some option that could say select which camera you want and then whether you want it's main or substream, possibly even another again for mode although this may look crowded on the player.

@Mr-HaleYa
Copy link

@direx1 It looks like the order you put the streams is the order they will load, and the highest quality mode that works will be the one that is shown for that steam.

@dbuezas
Copy link
Contributor Author

dbuezas commented Jul 22, 2023

It loads the first url in the list. f you state a mode (mse, webrtc) it will use it, otherwise it will behave as usual and use the best available.

@gtxaspec
Copy link

This is awesome! I was just wishing this was a feature the other day😀

@dbuezas
Copy link
Contributor Author

dbuezas commented Aug 5, 2023

I've been using this for 2 weeks and it works very well, anything else you wish this PR to have @AlexxIT, or are you just too busy at the moment? :)

@AlexxIT
Copy link
Owner

AlexxIT commented Aug 6, 2023

I'm on vacation. Travelling.

AlexxIT added a commit that referenced this pull request Aug 24, 2023
@AlexxIT AlexxIT merged commit 891396b into AlexxIT:master Aug 24, 2023
@AlexxIT
Copy link
Owner

AlexxIT commented Aug 24, 2023

Thanks!

@AlexxIT AlexxIT added this to the v3.3.0 milestone Aug 24, 2023
@AlexxIT
Copy link
Owner

AlexxIT commented Aug 24, 2023

https://github.com/AlexxIT/WebRTC/releases/tag/v3.3.0

@gtxaspec
Copy link

@dbuezas when switching resolutions is there a way to keep the current "image" on the display, and then switch over right away to the new resolution?

example, current behavior: display SD, switch to HD, black screen while loading, display HD

anyway to avoid the black screen (or poster if configured) while switching resolutions?

@dbuezas
Copy link
Contributor Author

dbuezas commented Aug 27, 2023

It would require quite a bit of a refactoring since the current implementation pretty much restarts all the video logic when the stream is swapped.

Keeping the old stream alive until the new one starts means having two streams in parallel, and the code isn't architected to do that.

I wonder what @AlexxIT thoughts on this are

@dbuezas
Copy link
Contributor Author

dbuezas commented Aug 27, 2023

One cheap fake alternative is to take a screenshot of the old stream and show that while the new one loads

@AlexxIT
Copy link
Owner

AlexxIT commented Aug 27, 2023

Yes. Easiest solution will be to use screenshot as poster

@oNaiPs
Copy link
Contributor

oNaiPs commented Aug 29, 2023

Would this PR also allow to select multiple entities, like:

streams:
  - entity: entity_1_main
    name: HD
    mode: mse
  - entity: entity_1_sub
    name: SD
    mode: webrtc

@AlexxIT
Copy link
Owner

AlexxIT commented Aug 29, 2023

Yes. PR works for entities

@oNaiPs
Copy link
Contributor

oNaiPs commented Aug 29, 2023

Awesome, I should have tried before asking. Definitely works!

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.

SD/HD toggle
6 participants