tjenkinson / clappr-markers-plugin

A plugin for clappr which will display markers (and tooltips) at configured points scrub bar.
https://tjenkinson.github.io/clappr-markers-plugin/demo/
MIT License
20 stars 11 forks source link

Get stream metadata #1

Open ChoiZ opened 8 years ago

ChoiZ commented 8 years ago

Nice job, nice plugin!

Maybe it can be cool if you get the stream metadatas.

tjenkinson commented 8 years ago

Thanks!

What metadata are you referring to?

ChoiZ commented 8 years ago

Stream title for audio streams like icecast / shoutcast streams or MP3 streaming (id3tags). Here my audio stream test: http://51.255.51.220/reggae/ I want to display stream title for each track in my playlist.

tjenkinson commented 8 years ago

That sounds cool, and I think would work well as a separate clappr plugin. That plugin would then also add this plugin and get a reference to it internally to control it.

I just looked through some of the .m3u8 files for your stream and didn't see any track titles in them. Are you currently embedding titles in the stream?

ChoiZ commented 8 years ago

In the first m3u8 you've got:

I think you've got the metadata in ".ts" file but I don't find yet how to get the datas ;-)

By the way do you know if it's possible with your plugin to create new marker with time instead of stream position?

Currently:

  new ClapprMarkersPlugin.StandardMarker(0, "The beginning!"),
  new ClapprMarkersPlugin.StandardMarker(90, "Something interesting."),
  new ClapprMarkersPlugin.StandardMarker(450, "The conclusion.")

With the time:

  new ClapprMarkersPlugin.StandardMarker(11:32:21, "The beginning!"),
  new ClapprMarkersPlugin.StandardMarker(11:35:18, "Something interesting."),
  new ClapprMarkersPlugin.StandardMarker(11:50:00, "The conclusion.")
tjenkinson commented 8 years ago

No you will need to build a function to convert the time from that format into seconds.

This might do what you want.

ChoiZ commented 8 years ago

So the time in your maker is in seconds?

So if I create a new StandardMarker(1, "marker one"); I have to do that:

get current time - playlist lenght in seconds + my point position

ie: Current time : 12:05:00 Playlist length: 5mn My marker: 1sec 12:05:00 - 5mn + 1 sec => 12:00:01

I'm right? (I know how to do that in Javascript thank you ;))

tjenkinson commented 8 years ago

It's in seconds from the start of the media so yes you'll need to calculate what time 0 represents in real world time first and then go to (seekTime - zeroPointTime) where seekTime and zeroPointTime are both times represented as seconds (eg UNIX timestamp).

If your stream is a sliding window the 0 point will be constantly changing so you'll need to keep updating the markers times on the clappr TIME_UPDATE event.

ChoiZ commented 8 years ago

Ok thank you for all this informations ;)

tjenkinson commented 8 years ago

No problem let me know how it goes or if there are any issues :)