Listening to/Watching Now blocks

gary.moncrieff
gary.moncrieff
@garymoncrieff
11 years ago
865 posts
Hey Guys

Would be nice to see a module that added would display up to 10 current songs being listening too and similarly 10 videos currently being watched.

Anyone any thoughts?
updated by @garymoncrieff: 11/14/14 09:10:32AM
brian
@brian
11 years ago
10,148 posts
This is already doable. You need to:

1) install the Event Tracer module:

https://www.jamroom.net/the-jamroom-network/networkmarket/92/event-tracer

2) Enable the "jrCore_stream_file" event in the Event Tracer Global Config

3) you can then use a jrCore_list call for the Event Tracer module - i.e.

{jrCore_list module="jrTrace" search="trace_event = stream_file" order_by="_item_id desc" ...(template params, etc)... }

Which would create a list of "whos streaming right now".

Hope this helps!

Which


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
gary.moncrieff
gary.moncrieff
@garymoncrieff
11 years ago
865 posts
Thanks for the reply Brian, I am not entirely sure that will work as the event tracer triggers on opening the items page and not just on actually initiating a stream.

For instance visit a video page, check the datastore and the event has been registered, same visit an audio file page and the event has been registered.

It doesn't catch youtube plays either, but depending how that module works it may not be possible.
brian
@brian
11 years ago
10,148 posts
gary.moncrieff:
Thanks for the reply Brian, I am not entirely sure that will work as the event tracer triggers on opening the items page and not just on actually initiating a stream.

That should not be true - the stream_file event is an actual trigger for when the file is streamed.

Quote:
For instance visit a video page, check the datastore and the event has been registered, same visit an audio file page and the event has been registered.

If you have the audio player set to autoplay, this will be true.

Quote:
It doesn't catch youtube plays either, but depending how that module works it may not be possible.

Yeah - that's likely not possible.

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
brian
@brian
11 years ago
10,148 posts
I've just tested here and I'm not seeing the stream_file event firing when viewing an audio page.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
gary.moncrieff
gary.moncrieff
@garymoncrieff
11 years ago
865 posts
Not set to autoplay.

Here's a short video
Event tracer
brian
@brian
11 years ago
10,148 posts
What browser are you using? I'm testing the same thing here and don't see an issue.

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
gary.moncrieff
gary.moncrieff
@garymoncrieff
11 years ago
865 posts
IE 11, your right it works fine in Chrome, so IE must be registering the event earlier for whatever reason.
brian
@brian
11 years ago
10,148 posts
OK - I will test in IE11. It can be a bit tricky since almost all the browsers except Firefox do several calls to the stream file in quick succession - they aren't meant to actually play the file, but want to get the first XXXXX bytes of the file to scan the file header. So there's code to try and determine which plays are "real" plays versus these scans.

Sounds like IE11 might be doing something different now, so I will check that out.

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
brian
@brian
11 years ago
10,148 posts
I've tested this out now on IE11 and unfortunately I'm not seeing any way to detect that the first scan is just an exploratory scan - all the incoming headers are identical to when there is an actual "play". So for now IE11 users are going to increment the play key on any page they view a player.

I'm looking into workarounds, but it needs to be secure, so am not sure at this point.

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
gary.moncrieff
gary.moncrieff
@garymoncrieff
11 years ago
865 posts
Thanks for checking Brian

Modern browsers are a pain to deal with at times.

One option might be to only record the 1st event from an IP within a set time? But that could put extra unwanted load on the server.
brian
@brian
11 years ago
10,148 posts
gary.moncrieff:
Thanks for checking Brian

Modern browsers are a pain to deal with at times.

One option might be to only record the 1st event from an IP within a set time? But that could put extra unwanted load on the server.

That's basically what it already does - the problem isn't recording it or checking that the browser has already played a track - it's distinguishing between a "scan" and a "play". Most browsers (besides IE) send what's know as a "range" header that tells the server that it only wants part of the data - not the whole file. IE doesn't send that, so to JR it looks like IE pressed "play" on the player. There's possibly some things that can be done with jPlayer events, but it gets complicated quickly, can be error prone and ends up making it so audio streams have to go through jplayer in order to be counted, which we don't want (as it restricts the ability to build 3rd party players).


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net

updated by @brian: 10/14/14 10:01:13AM

Tags