bpa wrote: 
> Mixcloud plugin seems to have problems.
> Somehow it generates https URL for MP4 streamable files which have
> problems playing on LMS 8.*.  User have install theplayMP4 plugin to use
> ffmpeg to play and even then it is not reliable.
> 

argh... I'm afraid a few things are badly broken there. The
ProtocolHandler overwrite canDirectStreamSong method this way

Code:
--------------------
    
  sub canDirectStreamSong{
        my ($classOrSelf, $client, $song, $inType) = @_;
  
        # When synced, we don't direct stream so that the server can proxy a 
single
        # stream for all players
        if ( $client->isSynced(1) ) {
  
                if ( main::INFOLOG && $log->is_info ) {
                        $log->info(sprintf(
                                "[%s] Not direct streaming because player is 
synced", $client->id
                        ));
                }
  
                return 0;
        }
  
        # Allow user pref to select the method for streaming
        if ( my $method = $prefs->client($client)->get('mp3StreamingMethod') ) {
                if ( $method == 1 ) {
                        main::DEBUGLOG && $log->debug("Not direct streaming 
because of mp3StreamingMethod pref");
                        return 0;
                }
        }
        my $ret = $song->streamUrl();
  
        # Dirty fix by sti      
        $ret =~ s/https/http/g;
  
        my ($server, $port, $path, $user, $password) = 
Slim::Utils::Misc::crackURL($ret);
        my $host = $port == 80 ? $server : "$server:$port";
        #$song->currentTrack()->url = $ret;
        #return 0;
        
        # Dirty fix by sti      
        return "mixcloudd://$host$path";
        #return "mixcloudd://$host:$port$path";
  }
  
--------------------


The code From Slim::Player::HTTP::canDirectStream is copied here for a
reason that I don't understand instead of calling SUPER but more
problematic it will not honor the preferences of direct streaming
because the $prefs->client(...) does not return the the client's but
looking into the plugin preferences. As a result, we never proxy and
instead we "cheat" on the url by forcing the PH mixcloudd:// as the
returned url. See Slim::Player::Song, around line #450

Code:
--------------------
    
        my $directUrl;
        if ($transcoder->{'command'} eq '-' && ($directUrl = 
$client->canDirectStream($url, $self))) {
                main::INFOLOG && $log->info( "URL supports direct streaming 
[$url->$directUrl]" );
                $self->directstream(1);
                $self->streamUrl($directUrl);
        }
  
--------------------

(NB: Slim::Player::Squeezebox2::canDirectStream calls
canDirectStreamSong of the PH if it exists)

That forces LMS to use that other 'mixcloudd' PH but this not the way,
IMHO, that canDirectStreamSong shall be used. This is a dirty hack (no
offense to anybody) because the returned URL is supposed (AFAIK) to be
playable directly by the device. Now, luckily LMS "re-examines" that URL
and then uses 'mixcloudd' as a PH (the other PH in the plugin) but I
really don't think this is the way this should be written. Worse, I
think synchronized players will not work b/c we respond by and 0 to
"canDirectStreamSong" and it all fails then.



LMS 8.1.x on Odroid-C4 - *SqueezeAMP!*, 5xRadio, 5xBoom, 2xDuet,
1xTouch, 1xSB3. Sonos PLAY:3, PLAY:5, Marantz NR1603, Foobar2000,
ShairPortW, 2xChromecast Audio, Chromecast v1 and v2, Squeezelite on Pi,
Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5, RivaArena 1 & 3
------------------------------------------------------------------------
philippe_44's Profile: http://forums.slimdevices.com/member.php?userid=17261
View this thread: http://forums.slimdevices.com/showthread.php?t=88286

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to