Increase the post cloaking threashold, or check first if media is playing before cloaking a post on scroll

A lot of posts on my forum are mixes. If the mix is posted at the top of the thread, and the user hits play, and then scrolls down the page to join the discussion and read the responses, eventually the player is unloaded, and this causes the mix to stop playing. Not ideal.

Is there a way to either specify how many posts before posts are unloaded, or remove this feature entirely?

Example here:
http://bassmusic.io/t/kissee-shhhh-its-a-silent-disco/20322

Hit play and start scrolling.

Thanks,
Adrian

Edit: possibly related similar case for youtube instead of soundcloud:
https://github.com/discourse/discourse/commit/65d7103bdc20d597decaeefa6ae9c782d6d51aaa

Edit2: if this is not possible with stock discourse, I am open to hiring someone to program a discourse plugin that adds this feature. I have hired programmers from this forum in the past and always pay a fair rate, and pay deposit in advance, and final payment immediately upon completion.

Edit3: Possibly also related:
https://github.com/eviltrout/ember-cloaking/issues/20

5 Likes

Interesting use case. You definitely donā€™t want to stop Discourse from offloading any posts, as this is core functionality intended to prevent browser crashes and computers catching on :fire: and such.

But maybe itā€™d be possible to prevent a single post from being offloaded, while ditching the rest like normal.

Another possible way to solve this might be to prevent only the music player from being unloaded, conserving that stream somehow.

I was thinking here, would never offloading the OP (the first post of the topic) work for you use case?

I donā€™t believe this is the correct solution. It is just a bit of a hack. What if there is another post in the thread with a media player?

Honestly, i feel like this is a bit extreme. The way that system unloads posts is immediately when the go out of view. A browser can definitely handle having a bit of post history. I understand the need for cloaking with a really long thread, of 100s of posts, but I donā€™t see the need to begin cloaking after only 1 post has scrolled out of view.

Maybe something like facebookā€™s new ā€˜Magical floating video which follows you everywhereā€™ feature?

Sweet Jesus please no

1 Like

As a plugin naturally, I find fbā€™s implementation pretty annoying too since itā€™s on all the time. But the only thing worse than having sound cut out when you scroll away from the player is having sound playing in your browser and not knowing where itā€™s coming from. :ghost:

9 Likes

Well iā€™m not advocating for auto playing hidden audio, this is audio the user interaction requested to start playing. Iā€™m only trying to avoid a sudden stop of this audio on scroll.

I agree with @codinghorror though, that floating video thing just seems like a bit much. Itā€™s something i would expect to see on a really spammy news website. I would prefer if the post just stayed where it was, and simply did not cloak on scroll.

Is this something that could be accomplished with discourseā€™s plugin functionality? or would this involve some hacks to discourse core to accomplish it?

1 Like

We are fine with core Discourse to have the smarts not to cloak posts with oneboxes that have currently playing sound.

Technically, there is no simple way to ask the DOM: ā€œhi DOM is anything playing in element #tā€ so this means we need to be a specific change to various oneboxes to add this info so we could decide if to unload or not.

If you can get someone to build it cleanly we would be more than happy to consider the PRs required.

1 Like

Yeah, now that i think about it, i donā€™t think you could ever know if a soundcloud player is playing, those are usually iframes, and therefore part of the shadow dom, and completely out of scope. But I think perhaps a suitable work around would be exposing an admin interface that had a bunch of settings like:
never cloak posts with youtube oneboxes
never cloak posts with soundcloud oneboxes
ā€¦ etc

unless you are suggesting an alternative that is more elegant than this?

@gdpelican is this something i could hire you to build? I was quite happy with your work last time.

YouTube communicates the fact it is playing via APIs, in fact we donā€™t cloak YouTube already due to these kind of hacks.

Soundcloud has them as well Widget API - SoundCloud Developers

If wiring all the APIs is too hard I would be fine with a site setting of ā€œdonā€™t cloak posts with potentially playing mediaā€, since the count is so low it probably makes no diff. Then all onebox needs to do is surface the fact that a onebox is ā€œplayableā€ by adding something like a playable class to the element.

1 Like

Very good point, i overlooked the fact that discourse uses the HTML5 widget and not the iframe player for soundcloud. This is definitely the more correct solution, and i think with these types of things it is best to take the most accurate approach. My main focus here is with the soundcloud onebox, but perhaps it will lay the groundwork to have other one boxes added along the way in the future.

@sam can i hire you to add this feature for me?

If you sign up for our business plan we can swing the soundcloud thing for you :slight_smile:

In general core team does not do any kind of contracting to non-customers (and only when it aligns with our goal to yes-customers)

I appreciate the offer, but that forum does not make anywhere near that kind of money in a year, so it is simply not realistic for me to make that kind of decision, unfortunately.

To be honest my current ad revenue doesnā€™t even cover my hosting costs, that forum is mostly a hobby dedicated to my interest in electronic music.

We will eventually get to this, itā€™s just not in the high priority bucket now

In the mean time if any of your forum users happens to be a dev they can contribute a patch

Iā€™m no good for custom Discourse contracts at the moment, although Iā€™m happy to revisit a bit later on if youā€™re still looking for someone.

Thats the problem with ruby. php devs are a dime a dozen. iā€™m sure thereā€™s plenty on my forum. But ruby? ruby devs are like a rare gem. Infact iā€™m personally a developer full time, i work mostly with python and javascript. Iā€™ve dabbled a bit with ruby, but iā€™m no where near good enough to consider submitted a PR. If i did i think it would be best described as a steaming pile of monkey :poop: and immediately rejected.

What if i sign up for 1 month. but donā€™t really use it, so you donā€™t actually have to actually set up the site, just make this patch. @codinghorror