Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 10 of 10
  1. #1
    Junior Member
    Join Date
    Sep 2013
    Posts
    16

    is there a Twitch Plugin?

    Hi Friends!

    hope you are all well!

    These times I see a growing group if DJs doing live streams on twitch.
    Is anyone aware of a plugin that we could use in LSM for that? Currently I carry my phone with me all the time to listen to the streams :-(

    Any idea?

    best
    martin

  2. #2
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    4,352
    Are you referring to twitch.tv ?

    If yes then there have a documented API that someone could try to use.

    However https://mixmag.net/read/twitch-dj-li...copyright-news
    Paul Webster
    http://dabdig.blogspot.com
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland

  3. #3
    Junior Member
    Join Date
    May 2014
    Posts
    19
    I'm also interested in getting support for the audio component of Twitch.tv streams into LMS. DJ streams on Twitch have exploded over the last year, and it's often a pain to wait for a TV + Chromecast to 'boot up' when LMS is running 24/7 in every room.

    Is there a plugin which will simply execute a command on the LMS and expect it to spit out an MP3 or AAC stream on its stdout ?

    I want to use the existing 'livestreamer' https://docs.livestreamer.io/cli.html tool which already supports both Twitch and an 'audio only' mode and am happy to try to shoehorn it in via some kind of 'execute external command with parameter 'Username''

    No point in reinventing the wheel!

    Cheers,
    Gavin.

  4. #4
    Junior Member
    Join Date
    Aug 2018
    Location
    Germany
    Posts
    17
    I would also love having a real Twitch plugin but unfortunately my pearl is way to bad to understand LMS integration and/or knit something like a plugin together on my own .

    But there are ways to achieve this, so I share one workaround on this:

    As a prerequisite you need BPA#s HLS V2 plugin which is explained in detail here
    Instead of livestreamer I'd recommend the usage of latest youtube-dl binary which is easy to install and imho without dependencies to fetch the audio URL. Also please note, that having youtube-dl installed through your actual package manager, might be an outdated version which is not capable of handling Twitch URLs.

    Install youtube-dl on the same box your LMS is running:
    Code:
    wget -O - https://yt-dl.org/downloads/latest/youtube-dl | sudo tee /usr/local/bin/youtube-dl >/dev/null
    sudo chmod a+x /usr/local/bin/youtube-dl
    Now you can run a one liner to play your stream by executing this command on the box your LMS is running on (please replace ZZZZZZ with your desired Twitch streamer, you want to listen to and those XX with the MAC-adress of your squeezebox player you want to listen the stream on):

    Code:
    URL=$(/usr/local/bin/youtube-dl -f audio_only --get-url https://www.twitch.tv/ZZZZZZ | sed 's/.\{5\}$//') && sleep 5 | curl -s "http://127.0.0.1:9000/status.html?p0=playlist&p1=play&amp&player=00:04:20:XX:XX:XX&p2=$URL"
    Hope this helps
    Last edited by Rasputin_GY; 2021-05-18 at 05:35.

  5. #5
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    20,568
    Quote Originally Posted by Rasputin_GY View Post
    As a prerequisite you need BPA#s HLS plugin which is explained in detail
    Clarify: Is your workaround are using V1 or V2.

    V1 uses ffmpeg and so can handle different file types even though it is may be called under the HLS guise - if your workaround relies on this - it is not a good approach.

  6. #6
    Junior Member
    Join Date
    Aug 2018
    Location
    Germany
    Posts
    17
    I'm using V2 for this workaround, edited in previous post.
    Last edited by Rasputin_GY; 2021-05-18 at 05:36.

  7. #7
    Junior Member
    Join Date
    May 2014
    Posts
    19
    Quote Originally Posted by Rasputin_GY View Post
    But there are ways to achieve this, so I share one workaround on this:
    Beautiful - this is exactly the level of hackery I was hoping for. I'll try it this weekend =)

  8. #8
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    20,568
    Quote Originally Posted by Rasputin_GY View Post
    I'm using V2 for this workaround, edited in previous post.
    OK - if V2 works they are probably "standard" HLS - however there are many options.
    I'm working on updating PLayHLS adding a bit more HLS support. Can you post an example of the top level m3u8 URL or if it is transient the contents just so I can visually check whether the update could break support.

  9. #9
    Junior Member
    Join Date
    Aug 2018
    Location
    Germany
    Posts
    17
    Thanks @bpa! Really appreciate your support on this. Please find attached an example m3u8. Please let me know if you might need additional information.

  10. #10
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    20,568
    Quote Originally Posted by Rasputin_GY View Post
    Thanks @bpa! Really appreciate your support on this. Please find attached an example m3u8. Please let me know if you might need additional information.
    The sample is good.

    From a technical perspective - they are using old HLS "#EXT-X-VERSION:3" and MPEG2-TS stream which has video, audio and possibly timed ID3 metadata. I assume the plugin is playing stream audio OK.

    The PLayHLSv2 plugin discards any video but video still has to be downloaded so overall data rate will be high but audio data rate will only be a fraction of it.

    The plugin does not process "Timed metadata" because I never seen one actually working.

    In the stream there are Twitch specific directives and use of Daterange but it seems they can be ignored. I am noting this stuff here in case things change.
    Code:
    #EXT-X-TWITCH-TOTAL-SECS:6625.200
    #EXT-X-DATERANGE:ID="source-1621542776",CLASS="twitch-stream-source",START-DATE="2021-05-20T20:32:56.505Z",END-ON-NEXT=YES,X-TV-TWITCH-STREAM-SOURCE="live"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •