arcam / CocoaUPnP

CocoaUPnP is a logical progression of upnpx; designed to be easy, modern and block-based.
MIT License
85 stars 40 forks source link

Playlist issue #47

Closed fabcan1 closed 6 years ago

fabcan1 commented 6 years ago

Hi,

First I don't know if it's an issue or not. Maybe I don't do it correctly.

I try to send to a television a playlist of movies.

I try to do it like that:

func PLAY_liste(liste:[String]){
    _ = selectedPlayback.device.bindNext { (device:UPPMediaRendererDevice) in
        //Set the first URI to play
        device.avTransportService()?.setAVTransportURI(liste[0], currentURIMetaData: nil, instanceID: "0", success: { (ok, err) in

        })

    //Set all the next URIS
        for i in 1...liste.count-1 {
            device.avTransportService()?.setNextAVTransportURI(liste[i], nextURIMetaData: nil, instanceID: String(i), success: { (ok, err) in

            })

        }

//Play the first URI
        device.avTransportService()?.play(withInstanceID: "0", success: { (oklecture, erreur) in

        })

    }
}

The first URI is played correctly but the the next ones don't start.

Can you tell me what I do wrong? Or is it a bug?

Thank you in advance.

Best regards.

squarefrog commented 6 years ago

Hi there.

While I am unable to give you specifics about your current application, as I don't know what your TV supports, I can say its fairly uncommon to be able to send playlists.

When you setNextAVTransport, you're telling the renderer to cache the next track, so there is less of a gap between songs. The AVTransport1 specification explains this in detail.

However, in practice I've yet to actually find a device that uses this call properly. You're supposed to check that the render supports this before using it, and admitedly, this library could handle that better.

Typically, when implementing a playlist type feature, you'd keep track of playlist and position in your Control Point application. Subscribe to events, then when you see a STOPPED event, queue up the next track with setTransportURI:, and then send the play command.

I hope that helps, if not feel free to respond.