How to get the playableUrl only when the track is about to be played?

Dirley dirleyrls at gmail.com
Sat Jan 14 15:24:31 UTC 2012


Ok, I tried that, but it didnt work. Right after prepareToPlay, the
EngineController calls `play(track.playableUrl())`. Since the playable url
is being retrieved, the track playableUrl is still empty. So Amarok stops
the playback. I need a way to make the engine wait for the url to be
retrieved, like in MultiPlayback:

    if( m_multiPlayback )
    {
        connect( m_multiPlayback, SIGNAL( playableUrlFetched( const KUrl &
) ), this, SLOT( slotPlayableUrlFetched( const KUrl & ) ) );
        m_multiPlayback->fetchFirst();
    }

- D


2012/1/14 Matěj Laitl <matej at laitl.cz>

> On 13. 1. 2012 Dirley wrote:
> > Hello, there.
>
> Hi Dirley,
>
> > I've been hacking into Amarok, trying to add an internet service. Turns
> out
> > that my service is a little bit... uncommon. When the tracks come from
> the
> > service, they don't have a "playable url". I have to ask the service a
> url
> > for each track I want to play. How would I do that on Amarok?
> >
> > I've considered using the MultiSourceCapability, but it didnt work, since
> > the "first" url is always invalid, so the engine skips the song. The
> > MultiPlayableCapability almost works, since the engine do wait for the
> > first source to be fetched.
> >
> > So I'm missing something? Is it feasible or should I give up and run a
> http
> > server inside my service that redirects to the playable url?
>
> I think you can inherit Meta::Track directly and just implement
> virtual void prepareToPlay()
> Engine controller apparently calls it when it is about to play a song and
> it
> is called nowhere else in Amarok AFAICS. I would return empty playableUrl()
> and false in isPlayable() before prepareToPlay() is called.
>
> Regards,
>                        Matěj
> _______________________________________________
> Amarok-devel mailing list
> Amarok-devel at kde.org
> https://mail.kde.org/mailman/listinfo/amarok-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/amarok-devel/attachments/20120114/a2b255fd/attachment.html>


More information about the Amarok-devel mailing list