Skip to content

Conversation

@huyenltnguyen
Copy link
Member

@huyenltnguyen huyenltnguyen commented Sep 28, 2019

  • Get stream based on bitrate and number of listeners
  • Switch stream if there is an error

Closes #38

@ahmaxed
Copy link
Member

ahmaxed commented Jan 3, 2020

@huyenltnguyen any progress on this solution?

@huyenltnguyen
Copy link
Member Author

@ahmadabdolsaheb sorry I haven't made any progress on the error handling. Reading the Nchan doc (https://nchan.io/) requires more time (and brains) than I thought, and I haven't been able to invest enough time on this.

Do you think it's okay to have this PR merged first, to enable the auto stream switching, and we will tackle the error handling in a future PR?

@ahmaxed
Copy link
Member

ahmaxed commented Jan 30, 2020

No worries.
Sure, I will give this a proper review before the weekend and merge if all is well.
Please feel free to work in parallel on error handling so you don't have to wait for me.

@ahmaxed
Copy link
Member

ahmaxed commented Feb 13, 2020

@huyenltnguyen it seems like we have an outage with remote streams, it might be an ideal time to test error handling.

@huyenltnguyen huyenltnguyen force-pushed the auto-stream-switching branch from a20305d to 80847d5 Compare April 3, 2020 19:12
@huyenltnguyen huyenltnguyen marked this pull request as ready for review April 3, 2020 19:16
@huyenltnguyen
Copy link
Member Author

@ahmadabdolsaheb Sooo sorry for dragging this too long. I have found a way to switch audio source when an error occurs, finally, by using the onError event of the audio element.

I believe all of the relay urls are having issue at the moment, so I was able to test this by selecting a relay url, then observe the app automatically switches to another audio source.

Check this out when you have a moment (I know things are crazy over the main repo), and let me know if there is any changes I should make :)

data-meta="stream-select"
defaultValue={this.props.url}
onChange={this.handleChange.bind(this)}
value={this.props.url}
Copy link
Member Author

Choose a reason for hiding this comment

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

This change is to make the dropdown renders the correct selected url.

@ahmaxed
Copy link
Member

ahmaxed commented Apr 4, 2020

Thanks for the update.
I am glad to hear you were able to resolve the error handling.
The interesting things is that if you go to https://coderadio-admin.freecodecamp.org/api/nowplaying
and click on the urls for the mounts in firefox after accepting the security alert, you can play it on the browser :). we need to figure out what is causing that.

@ahmaxed
Copy link
Member

ahmaxed commented Apr 4, 2020

I think the ssl certificate needs updating.

@ahmaxed
Copy link
Member

ahmaxed commented Apr 6, 2020

The issue with the certificate and the relays has been resolved.

@ahmaxed
Copy link
Member

ahmaxed commented Apr 6, 2020

The logic is great.
I am just thinking of situations where this would cause issues on the main repo.
Let say if coderadio goes down, the playerError could go to an infinite loop and crash the platform.
Should we add a logic so when it tests all existing streams it would stop resetting the url?

@huyenltnguyen
Copy link
Member Author

huyenltnguyen commented Apr 6, 2020

Yeah to be honest, I personally don't like the solution, since I fell into infinite loop a lot when I tested this, but I decided to pushed it up anyway to it is still a progress 😅

I'll try to find a way to improve this 😄

@ahmaxed
Copy link
Member

ahmaxed commented Apr 7, 2020

we could have a state that keeps the streams with the errors, so each time something errors out we only select one of the streams that has not been already in use.

make sure to change the state first and then change url. (I think you can pass a function that you would like to be called after state change as a parameter to setState).

@huyenltnguyen huyenltnguyen force-pushed the auto-stream-switching branch from 883e253 to eedf951 Compare April 9, 2020 16:15
@huyenltnguyen
Copy link
Member Author

@ahmadabdolsaheb This PR is ready for another look (I pushed the changes yesterday but forgot to notify you 😅)

@ahmaxed ahmaxed merged commit 7ba0fde into freeCodeCamp:master Apr 12, 2020
@ahmaxed
Copy link
Member

ahmaxed commented Apr 12, 2020

Thank you for your hard work.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

automatic stream switching

2 participants