pocket-casts-ios icon indicating copy to clipboard operation
pocket-casts-ios copied to clipboard

Siri: "Play My Podcasts" reverts playback speed

Open pocketcasts opened this issue 2 years ago • 2 comments

When using "Play My Podcasts" with Siri, the playback speed reverts to 1x.

The following Siri commands, on the other hand, don't revert the playback speed:

  • "Play [podcast name] on Pocket Casts"
  • "Resume Pocket Casts"
  • "Play Pocket Casts"

Steps to Reproduce

  1. Set an episode to play at a speed other than 1x
  2. Use the "Play My Podcasts" command with Siri
  3. Episode will play at 1x

Additional Information

pocketcasts avatar Jul 12 '22 16:07 pocketcasts

User added:

It also seems to work properly if you create a Shortcut called "Play My Podcasts" and add the "Resume Current Episode" action from Pocket Casts.

pocketcasts avatar Jul 12 '22 16:07 pocketcasts

Another report in 5595387-zen, but with the Shortcut app.

UUID for logs: 88705105-78AA-4CB2-B016-B6E760584B3D

App Version: 7.22
Device: iPhone13,4
OS: 16.0

reginabally avatar Oct 07 '22 04:10 reginabally

Another report in 5739926-zen

App Version: 7.26 Device: iPhone14,2 OS: 16.1.1

thabotswana avatar Nov 25 '22 10:11 thabotswana

Once I ask Siri to play PocketCast It will reset the speed of the podcast from 1.6 to 1. Is there any workaround?

5879165-zen

Version 7.29 Device: iPhone13,3 OS: 16.2

azollafox avatar Jan 19 '23 14:01 azollafox

The code for DefaultPlayer already references code to handle a similar problem: https://github.com/Automattic/pocket-casts-ios/blob/22f3fe23dab1d211e620ad50f1eb2a176bcb4467/podcasts/DefaultPlayer.swift#L521-L528

Need to investigate if the code is working as intended in DefaultPlayer and if a similar issue may exist in EffectsPlayer, which does not seem to have the same safeguard built in.

rviljoen avatar Jan 19 '23 21:01 rviljoen

I dug a bit more and documenting my findings to date:

  • This happens using both DefaultPlayer and EffectsPlayer

  • When asking Siri to "Resume Pocket Casts" or "Play Pocket Casts" it calls the app via MPRemoteCommandCenter: https://github.com/Automattic/pocket-casts-ios/blob/247c7307d5ef60c66067bf5a1afc3d4725103fb2/podcasts/PlaybackManager.swift#L1416

  • When asking Siri to "Play my podcasts" it does so via Siri intents. This explains the different behaviour between the different Siri commands, as logged in the original report. https://github.com/Automattic/pocket-casts-ios/blob/247c7307d5ef60c66067bf5a1afc3d4725103fb2/podcasts/AppDelelgate%2BSiriShortcuts.swift#L122-L131

  • When registering the Siri intent, we do not set a playback speed:

{
    playShuffled = 0;
    mediaContainer = <null>;
    playbackRepeatMode = one;
    mediaItems = (
        <INMediaItem: 0x2826d7e80> {
            artist = <null>;
            topics = <null>;
            privateMediaItemValueData = <null>;
            title = Resuming Current Episode;
            identifier = Resume ID;
            type = 7;
            artwork = <_INBundleImage: 0x2826d7ed0>;
            namedEntities = <null>;
        },
    );
    resumePlayback = 1;
    playbackQueueLocation = unknown;
    playbackSpeed = <null>;
}
  • But when the app is called, iOS does pass along a default playback speed of 1:
{
    playShuffled = 0;
    mediaContainer = <INMediaItem: 0x28266d130> {
        artist = <null>;
        topics = <null>;
        privateMediaItemValueData = <null>;
        title = <null>;
        identifier = library;
        type = 0;
        artwork = <null>;
        namedEntities = <null>;
    };
    playbackRepeatMode = none;
    mediaItems = (
        <INMediaItem: 0x28266d680> {
            artist = <null>;
            topics = <null>;
            privateMediaItemValueData = <null>;
            title = ;
            identifier = Resume ID;
            type = 7;
            artwork = <null>;
            namedEntities = <null>;
        },
    );
    resumePlayback = 1;
    playbackQueueLocation = now;
    playbackSpeed = 1;
}

I assume the speed is sent to cater for commands like "Play my podcasts at double speed" or "Play my podcasts at normal speed". Unfortunately Apple sends 1 as the speed even if the user did not specify any speed. We then set the speed accordingly while ignoring the current speed of the player: https://github.com/Automattic/pocket-casts-ios/blob/247c7307d5ef60c66067bf5a1afc3d4725103fb2/podcasts/AppDelelgate%2BSiriShortcuts.swift#L154-L160

It would be ideal if Apple only passed 1 as the speed if the user explicitly asked for the supported "normal speed". In the interim, we may have to work around this by ignoring the speed setting when 1 is passed along, similar to what DefaultPlayer is doing here for a different, but similar, case: https://github.com/Automattic/pocket-casts-ios/blob/247c7307d5ef60c66067bf5a1afc3d4725103fb2/podcasts/DefaultPlayer.swift#L521-L527

My sense is that we should ignore the intent playbackSpeed if it is 1. This is not ideal, but the only workaround until Apple changes the API to consider the current playing speed before passing a value to us via the intent.

@emilylaguna @leandroalonso keen to hear your views on this one.

rviljoen avatar Jan 23 '23 16:01 rviljoen

@rviljoen I agree with your reasoning and ignoring the playbackSpeed.

leandroalonso avatar Jan 23 '23 17:01 leandroalonso

@leandroalonso I think we can close this one now that it is merged. Thanks!

rviljoen avatar Jan 25 '23 16:01 rviljoen