bambuser / bambuser-livevideoshoppingplayer-sdk-ios

This SDK helps you add a Bambuser live shopping player to your UIKit and SwiftUI apps.
8 stars 2 forks source link

PiP event stopped (Close) and showProductList #5

Closed ezefranca closed 1 year ago

ezefranca commented 2 years ago

Hello bambuser team, happy new year.

We encountered an issue where the user returns from Picture in Picture and the player doesn’t update with the current list of products. So the user will be left with an empty or outdated product list until the screen receives the new update, which may only take seconds or minutes. The showProductList event is not called at the moment the player is returning from PiP, we need something like a viewWillAppear. In our tests, after returning from PiP we got some cases when the showProductList took more than 4 minutes to be called.

ken-bam commented 2 years ago

The showProductList event is enabled when PlayerUIConfiguration productList property is set to hidden and emitted when pressing the action bar product button and on the ended/paused curtain product button.

The issue you encountered, did that occur when returning from PiP and then pressing any of the above buttons in the player UI? which one of the buttons?

ken-bam commented 2 years ago

Regarding when the player is returning from PiP. We have in our roadmap to add event(s) when Pip is stopped.

ezefranca commented 2 years ago

Could you keep this issue open until when the PiP stopped (close) is released? BTW, thanks for the support, your team is doing a great product.

ken-bam commented 2 years ago

Yes of course. We keep it open until your issue is solved.

ken-bam commented 2 years ago

Not directly related to this issue, but one that we have discussed. We have added a call to the restorePlayer call and a isPictureInPictureActive PictureInPictureState so you could do something like this:

func didBecomeActive() {
    if settings.shouldRestorePiPAutomatically && PictureInPictureState.shared.isPictureInPictureActive {
        PictureInPictureState.shared.restorePlayer()
    }
}

on e.g. a UIApplication.didBecomeActiveNotification notification to go back to fullscreen on entering the app again.

This will be available in the next release.

ken-bam commented 2 years ago

Hi,

Some new features in the 0.8 that might be of interest for you guys. We have added a PictureInPictureCloseComponent protocol that is extended by UIView and UIViewController that has a registerPictureInPictureCloseAction that takes a reference to a PictureInPictureState.CloseAction that is called when closing a "parentless" picture-in-picture window.

Furthermore the PictureInPictureState has a new function restorePlayer that restores picture-in-picture playback back to fullscreen. Can be used e.g. if you want to restore back to fullscreen when returning to the app:

func didBecomeActive() {
    if settings.shouldRestorePiPAutomatically && PictureInPictureState.shared.isPictureInPictureActive {
        PictureInPictureState.shared.restorePlayer()
    }
}

both of these features have examples in the demos.

Then we have added pictureInPictureRestoreToFullscreen and pictureInPictureDidStop evens. These works the same way as the corresponding callbacks in iOS AVPictureInPictureControllerDelegate.

Happy coding and Friday!

ken-bam commented 2 years ago

@ezefranca did the new interfaces related to PiP in the 0.8 release work for you and was they of use for you? I e did they make your coding experience any easier :)

heldernunesff commented 2 years ago

hello everyone, thank you so much for your work and this release. And thanks for the improvements on this release. You can close the issue :)

ken-bam commented 1 year ago

Great!