Bug 44012 - Observer invoking issue for AVPlayerItem in iOS 8.x
Summary: Observer invoking issue for AVPlayerItem in iOS 8.x
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 9.8 (tvOS / C7)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2016-09-06 11:09 UTC by serdarshenol
Modified: 2016-12-08 01:30 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

HLS basic samples for both Xamarin and XCode (207.23 KB, application/zip)
2016-09-06 11:09 UTC, serdarshenol

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description serdarshenol 2016-09-06 11:09:53 UTC
Created attachment 17339 [details]
HLS basic samples for both Xamarin and XCode

In iOS8, added observer to AVPlayerItem instance with the following keys;


and related code is as below;

            item.AddObserver(this, "playbackBufferEmpty", NSKeyValueObservingOptions.New, IntPtr.Zero);
            item.AddObserver(this, "playbackLikelyToKeepUp", NSKeyValueObservingOptions.New, IntPtr.Zero);

public override void ObserveValue(NSString keyPath, NSObject ofObject, NSDictionary change, IntPtr context)

Code works properly with iOS 9 and 10 and "ObserveValue" method is invoked properly but in iOS8 it is not called in some cases except playback is just started. For example, when my buffer is empty due to bad network condition, my observer should be called for interrupting playback and changing state but unfortunately it fails. 

I created same projects in Xcode and Xamarin and tested individually. In Xcode, it works properly but Xamarin fails. In attachments, you can access to sample projects.

Related Xamarin environment is as below;

=== Xamarin Studio Community ===

Version 6.0.2 (build 73)
Installation UUID: c20ebf0c-eafa-4aab-9054-84592d508b02
	Mono 4.4.2 (mono-4.4.0-branch-c7sr1/f72fe45) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 404020011

=== Xamarin.Profiler ===

Not Installed

=== Apple Developer Tools ===

Xcode 7.3.1 (10188.1)
Build 7D1014

=== Xamarin.iOS ===

Version: (Xamarin Studio Community)
Hash: f37444a
Branch: cycle7-sr1
Build date: 2016-07-28 12:17:02-0400

=== Xamarin.Android ===

Version: (Xamarin Studio Community)
Android SDK: /Users/ssen/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
		6.0   (API level 23)

SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.0.1
SDK Build Tools Version: 23.0.1

Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

Android Designer EPL code available here:

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: (Xamarin Studio Community)

=== Build Information ===

Release ID: 600020073
Git revision: a6f7a24a9723a2d4f5d33c176615b0d44703ab5b
Build date: 2016-07-26 13:36:15-04
Xamarin addins: f5acb37866a0141bc5ddbe95118f18dae4014568
Build lane: monodevelop-lion-cycle7-sr1

=== Operating System ===

Mac OS X 10.11.6
Darwin Serdars-MacBook-Pro.local 15.6.0 Darwin Kernel Version 15.6.0
    Mon Aug 29 20:21:34 PDT 2016
    root:xnu-3248.60.11~1/RELEASE_X86_64 x86_64
Comment 1 Vincent Dondain [MSFT] 2016-09-07 14:22:14 UTC
Hi, I cannot reproduce this issue. I tried with iOS 8.4 simulator, the music starts and when the buffer is empty `ObserveValue` is called and I hit keyPath == "playbackBufferEmpty".

Could you please describe in a bit more details what's the exact behavior you're expecting and how it fails on iOS 8 with Xamarin.iOS. Like a step by step way to see the issue.

I also compared with the Xcode project and it all seemed to work identically.

I'm using these versions of our products: https://gist.github.com/VincentDondain/967c42ec77af1d7830fd1ec234c9739d
Comment 2 Timothy Risi 2016-12-08 01:30:39 UTC
We have not received the requested information. If you are still experiencing this issue please provide all the requested information and re-open the bug report. Thanks!