ファイルのどの部分がダウンロードされたかを知るには、AVPlayerItemクラスのloadedTimeRangesプロパティを使用する必要があります。残念ながら、このプロパティはMonoTouchで利用できないようです。 MonoTouch Rosetta Stone referenceでAVPlayerItemのloadedTimeRangesプロパティはMonoTouch&objective-cセレクタマッピングで利用できません
、方法が存在するが、次のようにコメントし
セレクター:loadedTimeRanges
プロパティ:// NSArrayのloadedTimeRanges {取得します。 }
今後追加されるメソッドはありますか? 、
[System.Runtime.InteropServices.DllImport(MonoTouch.Constants.ObjectiveCLibrary, EntryPoint="objc_msgSend")]
static extern NSArray nsarray_objc_msgSend (
IntPtr target, IntPtr selector);
以降そのようなメソッドを呼び出し:
は平均時間で、私が行方不明セレクタを定義xamarin doc
に係る対物-Cセレクタをマッピングする試み
/* Call loadedTimeRanges selector on AVPlayerItem */
AVPlayerItem target = m_playerItem;
MonoTouch.ObjCRuntime.Selector selector = new MonoTouch.ObjCRuntime.Selector ("loadedTimeRanges");
NSArray loadedTimeRanges = nsarray_objc_msgSend(target.Handle, selector.Handle);
/* Convert the returned value as CMTimeRange */
IntPtr intPtr = loadedTimeRanges.ValueAt(0);
System.Runtime.InteropServices.GCHandle handle = System.Runtime.InteropServices.GCHandle.FromIntPtr(intPtr);
NSValue v = (NSValue)handle.Target;
MonoTouch.CoreMedia.CMTimeRange timeRange = v.CMTimeRangeValue;
しかし、私のセレクタを呼び出すときに、私は次のエラーを取得する:
Unhandled Exception: System.Runtime.InteropServices.MarshalDirectiveException: Type MonoTouch.Foundation.NSObject which is passed to unmanaged code must have a StructLayout attribute.
私は行方不明です。前もって感謝します!