Menu

Web based player

Anonymous
2014-11-27
2014-12-05
  • Anonymous

    Anonymous - 2014-11-27

    First of all, congratulations for this software. It's so juicy!

    I was wondering if it's possible to have Rompr detect when I'm connecting from my home, and then control mpd, or when I connect from outside my home (my ip is not more on the LAN network), trigger webstreaming to a javascript's player. Typically, I want to be able to stream my music to the internet from outside, not to control MPD anymore. When I'm home, MPD should take the relay.

     
  • Fat German Productions

    I can't see myself ever doing this, it would require writing a player in Javascript which is something I've avoided doing because mpd and mopidy exist. Also, while it would work with mpd, or mopidy and local files, it would not be able to play spotify or soundcloud, or most of the other sources that mopidy provides. For mpd users I still reccommend using a streaming output from mpd and connecting to it using VLC.

     
  • Anonymous

    Anonymous - 2014-11-28

    Actually, I can do that, as I've done this in the past. Playing a MP3 from a file that's available as a file download is easy in HTML5/Audio (just check this page for example code: http://audiocogs.org/codecs/mp3/), but I never did a version that accept HTTP endless streaming.

    HTTP continuous streaming has numerous drawback. First it creates a non negligible latency (so when you change volume, the action happens a lot of seconds later)
    Also, it's not easy to embed in a webpage without using such awfulness as Flash.

    I was more thinking about adding a simple "proxy" to rompr that allow downloading the source file directly, thus using a classical MP3 player.

     
  • Anonymous

    Anonymous - 2014-11-28

    I'm not at my computer right now, but try this: enter the path to your music folder in the preferences if you haven't already done so, then point your browser at rompr/MusicFolders and see what happens.

     
  • Anonymous

    Anonymous - 2014-11-28

    Actually, there is nothing at that url.
    I've found this: http://kolber.github.io/audiojs/
    I'll hack a bit with mpd to let it stream http with mp3, and try to point to this URL with this player in a private code. If it works, then I'll modify rompr code to add it. I think this way: add a button to the player part of rompr to switch between local and remote. This will trigger changing the mpd output from default to remote (might need to set the "remote" name in the preferences). The button default state will be selected by checking the IP address of the source client, if it is on the same network as the server that is if the mask is 255.255.255.0, it's on the same network if ((Mask & ServerIP) == (Mask & ClientIP)).
    If we are remote playing, then it'll load the audiojs player with the specified URL in the preferences, in autoplay mode.

    What do you think ?

     
  • Anonymous

    Anonymous - 2014-11-28

    That URL works for me, it must be something in the WebServer settings.

    Your idea sounds like it's worth a go.

     
  • Anonymous

    Anonymous - 2014-12-01

    Sourceforge killed my previous comment. Anyway, in short, I did it with MPD set to stream via HTTPD output. I've tried audiojs, and it's a big mess. The javascript writes it own GUI, with its own CSS and GIF files. I got 3 streams downloaded and played with a small delay between them, leading to a kind of reverb.
    Then I tried jPlayer and it worked perfectly (only a single stream).
    On the con side, the latency is awful (10s between me changing something in the interface, and the effect being heard). Plus my NAS CPU is at 48% for decoding + reencoding.
    On the plus side, I've crossfading working, plus ReplayGain.

    I'd like to test with file proxy mode, and I need your help. Where can I get the current file's path being played in rompr ?
    My idea then would be to shut off completely mpd's outputs, and have rompr streams my music collection by simply proxifying the files from mpd's collection.

     
  • tom roth

    tom roth - 2014-12-03

    I don't know what you mean by shutting off mpd.
    You do understand, that rompr is (just) a frontend to mpd or mopidy?
    It gets just the music tracks meta information and then tells mpd or mopidy what track to play. For all its worth rompr could sit on one machine without any access to your musicfiles and tell mpd on an entirely different machine what to play.
    It is a bit like your TV (mpd) and your remote control (rompr).
    Trying to make rompr do something it is not designed for sounds to me like using a hammer to drill a hole.
    It is at the core of unix philosophy to not have one tool that tries to do everything, but have tools that do one thing exceptionally well and interact with other tools.
    There are plenty of tools out there that allow to navigate a collection and play tracks using HTML5/Audio. If you insist on using an mpd frontend you could use a streaming output from mpd and connecting to it using VLC as already suggested by the fatg3rman.
    Rompr does not allow to switch mpd outputs, other mpd clients do.

    Then there also is Ampache (http://ampache.org/) which allows controlling an mpd server and streaming music via different protocols including HTML5.

     
  • Anonymous

    Anonymous - 2014-12-03

    Hi Tom,

    Yes, I've understood what rompr and mpd is. Actually, you can change MPD output in Rompr preferences.

    First, I would like to have a single interface for my music options. I don't want to create a playlist somewhere, and have to redo it elsewhere. I want to be able to resume where I was, whatever the device I've in front.

    So, I initially thought about having MPD outputs to a HTTP server, and have the output selected based on my position (in my LAN, or in WAN).

    Concerning the webstreaming solution, the different javascript based audio player
    I've tried all use the browser's

    I've modified MPD to allow CORS headers, and I've written a player in javascript that's doing its own streaming via AJAX, and I'm sending the output to a javascript based Ogg/Vorbis decoder. It starts to work, and the latency is 2s, which is correct, but not perfect.

    I know that there is no link between rompr and the music collection, and I'm not asking for it. I'm asking for the file path being played / in the playlist.
    I guess it's available, but if not, then, well, I'll have to look elsewhere.
    If it is, then sending the playlist with a proxy PHP script for fetching the actual files from the music collection is easy, and adding a HTML based player is also easy. There will be no need for MPD to actually work/play anything, the web interface just need to "sync" with MPD when we change track or leave the page (when the HTML player advance a track, then it sends "next track" to MPD, etc...)

     

    Last edit: Anonymous 2014-12-03
  • Anonymous

    Anonymous - 2014-12-03

    Provided you've set the path to your music collection in the preferences AND your webserver is set up to allow file browsing across symlinks AND your music files have appropriate read permissions then this might be doable. I can browse and play my files just by going to http://ip.of.rompr/rompr/prefs/MusicFolders - so if that doesn't work for you the first thing you need to do is sort out your webserver config. I use the default apache setup as described in the setup instructions.

     
  • Fat German Productions

    One thing I must point out (and I really ought to add this to the docs) is that if you do all that to create the SymLink to your music files, and your webserver is accessible to the outside world, then you are creating a HUGE security hole which could give an attacker access to, at least, all your private files.

    There are two secure ways to stream your music via a webserver. One is to store your music in the same directory as rompr, with appropriate read permissions set. The other is to use some kind of daemon - like, say, mpd :) This is why I always reccommend MPD's shoutcast output over any other method - because it is secure.

     
  • Anonymous

    Anonymous - 2014-12-03

    Completely agree with you.
    If only MPD output latency for encoding could be lowered, it'd be perfect.
    To avoid security issues, you should have a PHP filtering frontend. That's what I have in my server for accessing my files from outside. PHP has access to the complete filesystem (provided rights are setup correctly), and can check credentials/session to allow it (via passthru function for example, or better: XSendFile header). Anyway, I'd like to get a playlist with relative path to the music base folder for all the the files in the playlist. Is it possible with mpd protocol, and if yes, is it done in rompr somewhere ?

     
  • Anonymous

    Anonymous - 2014-12-03

    Playlist.js receives (via getplaylist.php) the parsed playlist from mpd. This is sorted into albums with track information. The data received from mpd contains the relative file paths, so that would be your place to start. You clearly know more about web security than I do :)

     
MongoDB Logo MongoDB