hzeller / gmrender-resurrect

Resource efficient UPnP/DLNA renderer, optimal for Raspberry Pi, CuBox or a general MediaServer. Fork of GMediaRenderer to add some features to make it usable.
GNU General Public License v2.0
832 stars 202 forks source link

Unknown action 'Next' for service 'urn:upnp-org:serviceId:AVTransport' #113

Open wdehoog opened 7 years ago

wdehoog commented 7 years ago

I am running gmediarender on a sailfish phone. When using an app (upnpplayer) and trying to go to the next song (which fails) the log output shows:

upnp] Unknown action 'Next' for service 'urn:upnp-org:serviceId:AVTransport'

Please advice how I can investigate this further.

wdehoog commented 7 years ago

I noticed there was already some work done on support for Next. After many a trial and error I sort of got it working with a lot of copy paste. I have to confess I hardly understand what it does. All those callbacks are hard to follow.

   switch (transport_state_) {
    case TRANSPORT_PLAYING:
            // change URL
            av_uri = get_var(TRANSPORT_VAR_NEXT_AV_URI);
            av_meta = get_var(TRANSPORT_VAR_NEXT_AV_URI_META);
            change_transport_state(TRANSPORT_PLAYING);
            requires_meta_update = replace_transport_uri_and_meta(av_uri, av_meta);
            replace_current_uri_and_meta(av_uri, av_meta);
            output_set_uri(av_uri, (requires_meta_update
                                    ? update_meta_from_stream
                                    : NULL));
            // play
            if (output_play(&inform_play_transition_from_output)) {
                    upnp_set_error(event, 704, "Next failed");
                    rc = -1;
            } else {
                    // ?
            }
            break;

    default:
            Log_info("transport", "Next called while not playing");
            /* action not allowed in these states - error 701 */
            upnp_set_error(event, UPNP_TRANSPORT_E_TRANSITION_NA,
                           "Transition to PLAY not allowed; allowed=%s",
                           get_var(TRANSPORT_VAR_CUR_TRANSPORT_ACTIONS));
            rc = -1;
            break;
    }

Please do tell how to fix this properly.

hzeller commented 7 years ago

The renderer is state-less, so the next URI needs to be send from the upnp-controller. This is what is happening in that piece of code. The next command works flawlessly if you are using a controller that does that (which is all the controllers I was testing this with, for instance BubbleUPNP; I don't know about upnpplayer you mention - since this is a pretty generic name, do you have a link to it ?).

I assume that maybe this controller is attempting to send a playlist over and tries to invoke some kind of 'next' functionality then ? Since I have not seen this with the standard-conforming controllers I was testing it, this feature is not implemented. So therefore it would be good to have a link to the app you are using so that I can test it.

wdehoog commented 7 years ago

It does send the next uri but no playlist. For 'previous' it also seems to send next uri and triggers the Next action.

It looks like the app is only available for sailfish and unfortunately I could not find the sources. Here is the link https://openrepos.net/content/jabbounet/upnpplayer-sailfish-os

hzeller commented 7 years ago

mmh, I don't have sailfish installed anywhere.

Can you create a full log of a minimal startup up to the point where you press next, so that I can see what happens in what sequence ? https://github.com/hzeller/gmrender-resurrect/blob/master/INSTALL.md#misc-options

wdehoog commented 7 years ago

Here are some logs. no-next.log: gmediarender without Next with-next.log: gmediarender with sort of Next support sound-after-volume-up.log: another problem with this controller, when starting to play (with Play or Next) there is no sound until I change the volume (up/down).

sailfish-logs.zip

Thanks for looking into these issues.