(2020-12-30 16:48)wholesomesoul Wrote: (2020-12-30 3:33)qqqsss2 Wrote: (2020-12-29 22:31)wholesomesoul Wrote: Any plans to make the source code available and perhaps allowing people to contribute?
This is quite handy, thanks a bunch!
I thought about making it open source, but decided against because I'm a bit paranoid.
Would be happy to share it with anyone who asks though, and may add you as a contributor if you want. Do you have any additional things you'd want to add?
For now adding the option to select the resolution on Stripchat as well. And maybe figuring out why it takes a bit longer for the cams to load there.
Unfortunately, I don't think it's feasible for this app (Edit: nevermind, it is, you can skip to the end if you don't care about the details) and the reason is that the way stripchat's HLS streams work is very stupid. But it requires some explanation.
For those not familiar with HLS, it's what's known as an adaptive bitrate protocol, essentially meaning the video is available at a number of different bitrates, or qualities (e.g. 1080, 720, 360 etc.) and when streaming, the player will select an appropriate bitrate for your internet connection. Everyone's seen this in action - you're watching youtube or netflix or something, your internet shits the bed and the video stalls and when it starts playing again it's all terrible and pixelated for a little while until it kicks back up into high quality.
This also means that the player is able to select whatever quality video it wants. For Chaturbate, the player in the app will automatically limit the video quality to the appropriate level for the viewport of the player (which most of the time is not max quality). When you have multiple streams going, this is incredibly helpful - there's a huge difference between running 3 1080p streams and running 3 720p or 480p streams. You can test this by running 3 separate chaturbate.com tabs running 1080p cams, then running those 3 streams in the app.
Anyway, one of the main points of HLS is that the video quality is handled automatically as part of the protocol. However, Stripchat, being the geniuses they are, have an entirely separate stream for *each quality level* instead of just specifying them in the manifest and letting the protocol handle it automatically.
The next question is, of course, why not just deal with that and make a switcher anyway? And the reason for that is because the only quality I know every model has is the top quality (regardless of the actual resolution). Apart from that, models may or may not have 1080, 720, 480, 360 available, and many of them have non-standard resolutions, depending on their setup.
(Here's where I figured out it's possible)
I didn't think it was possible because I thought these levels were only specified in the model-level API, not the model list API.
The app can not access any per-model APIs because doing so may produce enough requests to get blocked by cloudflare. For both CB and SC, the APIs (or, in CB's case, the literal web page that the app scrubs for info) are served from the main domains (chaturbate.com and stripchat.com), which have both cloudflare protection that will block if too many requests are made, and same-origin protection that prevents requests to them on the client side. As a solution, the app server acts as a proxy - the app makes a request for 'page 1 of chaturbate.com/female-cams', and the server makes the request and sends it back (the server doesn't give a shit about origin headers).
This means that all requests for models for all users on the app are coming from cb-mfc.herokuapp.com from the perspective of CB and SC, which means I must be judicious in how many requests are made. Right now, the only requests done this way are for listing pages of models. Adding any per-model requests would increase the number of requests by several orders of magnitude, which would almost certainly get me blocked.
I didn't think that the model list API had the available video qualities, but after looking again I realized it does.
Code:
{
"broadcastSettings": {
"width": 960,
"height": 540,
"presets": {
"default": {
"240p": "-240p"
},
"testing": {
"240p": "_240p"
}
}
}
}
TL;DR - I can add it, and so I will. Probably later today or tomorrow. I'll make it default to 720p or lower, which should hopefully improve start-up time for SC streams, though that's not guaranteed. Any slowness in the streams is 100% due to SC itself.