kaltura / player-sdk-native-ios

Kaltura iOS Player SDK
GNU Affero General Public License v3.0
45 stars 33 forks source link

Chromecast fails with videos that have a pre-roll ad. #219

Closed jabberdabber closed 8 years ago

jabberdabber commented 8 years ago

Hi,

We're having problems with Chromecast and videos that have pre-roll ads.

I've been digging through SDK trying to pinpoint the problem. Chromecast seems to work OK when there is no pre-roll. However, when there is a pre-roll ad, it runs into trouble.

When you start casting and there is a pre-roll ad playing, the SDK attempts to defer casting until the ad is over:

Note the conditional:

if (self.playerFactory.adController)

I think this can be interpreted as meaning: "If there is an ad playing..."

If there is an ad playing, a callback is hooked into the player to be invoked when the ad completes. When the callback is invoked, the following code is run:

weakSelf.playerFactory.castProvider = castProvider; [weakSelf triggerCastEvent:castProvider];

This sets up the "castProvider" and begins casting.

There are two problems that I've seen. For one, the ad completion event is never propagated to the event listeners, so the callback is never invoked. As a result, casting never begins.

The ad events are handled by an KPIMAPlayerViewController object, which in turn propegates them to its delegate. The delegate is an KPlayerFactory object. It sends the event to the current KPViewController object, which sends the event to its controlsView property.

What seems to be missing for ad events is a call to notifyKPlayerEvent so that the event listeners for ad events can be notified. As a result, the callback added for the ad completion event is never invoked and casting is never started.

Also, in the "removeAdPlayerWithCompletion" method, there is this line of code:

[self.playerFactory removeAdController];

This removes the ad controller while the ad is playing. As a result of this, the player gets into an undefined state where it just sits there.

Thank you for any help.

kaltura-hooks commented 8 years ago

Hi @jabberdabber,

Thank for you reporting an issue and helping to improve Kaltura!

If you're having some issues getting your player set up, there are quite a few steps that can be taken to figure things out.

In order to expedite the reporting process, please follow instructions in the doc below, prior to submitting a bug/issue

https://github.com/kaltura/player-sdk-native-ios/wiki/How-To-Report-an-Issue-with-the-Kaltura-iOS-Player-SDK

If you only have a general question rather than a bug report, please close this issue, post at: https://forum.kaltura.org/c/community-forums/player-sdk

And add a comment to the Github issue linking to your post.

Thank you in advance!

ElizaSapir commented 8 years ago

Hey @jabberdabber ,

This issue is resolved on our latest release.

Best, Eliza

cc @itaykinnrot , @OrenMe