Example HLS Server!

I made a server for broadcasting videos.


This is a very small server, so it does not take much time for reading its code. I want to be able to write a better Rust code through the project :smiley:

Thank you!


You're use of the rocket library could be more sophisticated (sorry, struggling to think of the right word). What I mean is that there are good features you aren't making use of. I think you'll enjoy using them though :slight_smile:
These 2 links should point you in the right direction.

The main rust improvements in my eyes are in error handling. The unwrap playlist and main functions should return result instead of panicking if the filesystem operations fail.

I am impressed :slight_smile: though, I doubt you'll have too much trouble adding error handling but please post to the forums if you do, we'll help you out.

Just 2 nitpicks left:
I haven't tested but I don't think the playlist needs to be mutable. This...

let mut playlist = Playlist::new();

Looks like it calls for the builder pattern:

let playlist = Playlist::new()

You'll need to change the function signatures to make this work, left as an exercise for the reader...

(If they are mutated by the server I haven't realised!)

I should also point out I'm not familiar with the m3u8_rs library.


Thank you for reviewing!

I'll write error handling codes and show here! thanks.

Thank you, I'll change the part shortly :smirk_cat:

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.