Guest User

Untitled

a guest
May 21st, 2015
272
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. using UIKit;
  4. using Foundation;
  5. using ObjCRuntime;
  6. using CoreGraphics;
  7.  
  8. namespace YTHelper
  9. {
  10. // The first step to creating a binding is to add your native library ("libNativeLibrary.a")
  11. // to the project by right-clicking (or Control-clicking) the folder containing this source
  12. // file and clicking "Add files..." and then simply select the native library (or libraries)
  13. // that you want to bind.
  14. //
  15. // When you do that, you'll notice that MonoDevelop generates a code-behind file for each
  16. // native library which will contain a [LinkWith] attribute. MonoDevelop auto-detects the
  17. // architectures that the native library supports and fills in that information for you,
  18. // however, it cannot auto-detect any Frameworks or other system libraries that the
  19. // native library may depend on, so you'll need to fill in that information yourself.
  20. //
  21. // Once you've done that, you're ready to move on to binding the API...
  22. //
  23. //
  24. // Here is where you'd define your API definition for the native Objective-C library.
  25. //
  26. // For example, to bind the following Objective-C class:
  27. //
  28. // @interface Widget : NSObject {
  29. // }
  30. //
  31. // The C# binding would look like this:
  32. //
  33. // [BaseType (typeof (NSObject))]
  34. // interface Widget {
  35. // }
  36. //
  37. // To bind Objective-C properties, such as:
  38. //
  39. // @property (nonatomic, readwrite, assign) CGPoint center;
  40. //
  41. // You would add a property definition in the C# interface like so:
  42. //
  43. // [Export ("center")]
  44. // CGPoint Center { get; set; }
  45. //
  46. // To bind an Objective-C method, such as:
  47. //
  48. // -(void) doSomething:(NSObject *)object atIndex:(NSInteger)index;
  49. //
  50. // You would add a method definition to the C# interface like so:
  51. //
  52. // [Export ("doSomething:atIndex:")]
  53. // void DoSomething (NSObject object, int index);
  54. //
  55. // Objective-C "constructors" such as:
  56. //
  57. // -(id)initWithElmo:(ElmoMuppet *)elmo;
  58. //
  59. // Can be bound as:
  60. //
  61. // [Export ("initWithElmo:")]
  62. // IntPtr Constructor (ElmoMuppet elmo);
  63. //
  64. // For more information, see http://developer.xamarin.com/guides/ios/advanced_topics/binding_objective-c/
  65. //
  66.  
  67. [Model, BaseType (typeof (NSObject))][Protocol]
  68. public partial interface YTPlayerViewDelegate {
  69.  
  70. [Export ("playerViewDidBecomeReady:")]
  71. void DidBecomeReady (YTPlayerView playerView);
  72.  
  73. [Export ("playerView:didChangeToState:")]
  74. void DidChangeToState (YTPlayerView playerView, YTPlayerState state);
  75.  
  76. [Export ("playerView:didChangeToQuality:")]
  77. void DidChangeToQuality (YTPlayerView playerView, YTPlaybackQuality quality);
  78.  
  79. [Export ("playerView:receivedError:")]
  80. void ReceivedError (YTPlayerView playerView, YTPlayerError error);
  81. }
  82.  
  83. [BaseType (typeof (UIView))]
  84. public partial interface YTPlayerView : IUIWebViewDelegate {
  85.  
  86. [Export ("webView", ArgumentSemantic.Retain)]
  87. UIWebView WebView { get; }
  88.  
  89. [Export ("delegate", ArgumentSemantic.Assign)]
  90. YTPlayerViewDelegate Delegate { get; set; }
  91.  
  92. [Export ("loadWithVideoId:")]
  93. bool LoadWithVideoId (string videoId);
  94.  
  95. [Export ("loadWithPlaylistId:")]
  96. bool LoadWithPlaylistId (string playlistId);
  97.  
  98. [Export ("loadWithVideoId:playerVars:")]
  99. bool LoadWithVideoId (string videoId, NSDictionary playerVars);
  100.  
  101. [Export ("loadWithPlaylistId:playerVars:")]
  102. bool LoadWithPlaylistId (string playlistId, NSDictionary playerVars);
  103.  
  104. [Export ("playVideo")]
  105. void PlayVideo ();
  106.  
  107. [Export ("pauseVideo")]
  108. void PauseVideo ();
  109.  
  110. [Export ("stopVideo")]
  111. void StopVideo ();
  112.  
  113. [Export ("seekToSeconds:allowSeekAhead:")]
  114. void SeekToSeconds (float seekToSeconds, bool allowSeekAhead);
  115.  
  116. [Export ("clearVideo")]
  117. void ClearVideo ();
  118.  
  119. [Export ("cueVideoById:startSeconds:suggestedQuality:")]
  120. void CueVideoById (string videoId, float startSeconds, YTPlaybackQuality suggestedQuality);
  121.  
  122. [Export ("cueVideoById:startSeconds:endSeconds:suggestedQuality:")]
  123. void CueVideoById (string videoId, float startSeconds, float endSeconds, YTPlaybackQuality suggestedQuality);
  124.  
  125. [Export ("loadVideoById:startSeconds:suggestedQuality:")]
  126. void LoadVideoById (string videoId, float startSeconds, YTPlaybackQuality suggestedQuality);
  127.  
  128. [Export ("loadVideoById:startSeconds:endSeconds:suggestedQuality:")]
  129. void LoadVideoById (string videoId, float startSeconds, float endSeconds, YTPlaybackQuality suggestedQuality);
  130.  
  131. [Export ("cueVideoByURL:startSeconds:suggestedQuality:")]
  132. void CueVideoByURL (string videoURL, float startSeconds, YTPlaybackQuality suggestedQuality);
  133.  
  134. [Export ("cueVideoByURL:startSeconds:endSeconds:suggestedQuality:")]
  135. void CueVideoByURL (string videoURL, float startSeconds, float endSeconds, YTPlaybackQuality suggestedQuality);
  136.  
  137. [Export ("loadVideoByURL:startSeconds:suggestedQuality:")]
  138. void LoadVideoByURL (string videoURL, float startSeconds, YTPlaybackQuality suggestedQuality);
  139.  
  140. [Export ("loadVideoByURL:startSeconds:endSeconds:suggestedQuality:")]
  141. void LoadVideoByURL (string videoURL, float startSeconds, float endSeconds, YTPlaybackQuality suggestedQuality);
  142.  
  143. [Export ("cuePlaylistByPlaylistId:index:startSeconds:suggestedQuality:")]
  144. void CuePlaylistByPlaylistId (string playlistId, int index, float startSeconds, YTPlaybackQuality suggestedQuality);
  145.  
  146. [Export ("cuePlaylistByVideos:index:startSeconds:suggestedQuality:")]
  147. void CuePlaylistByVideos (NSObject [] videoIds, int index, float startSeconds, YTPlaybackQuality suggestedQuality);
  148.  
  149. [Export ("loadPlaylistByPlaylistId:index:startSeconds:suggestedQuality:")]
  150. void LoadPlaylistByPlaylistId (string playlistId, int index, float startSeconds, YTPlaybackQuality suggestedQuality);
  151.  
  152. [Export ("loadPlaylistByVideos:index:startSeconds:suggestedQuality:")]
  153. void LoadPlaylistByVideos (NSObject [] videoIds, int index, float startSeconds, YTPlaybackQuality suggestedQuality);
  154.  
  155. [Export ("nextVideo")]
  156. void NextVideo ();
  157.  
  158. [Export ("previousVideo")]
  159. void PreviousVideo ();
  160.  
  161. [Export ("playVideoAt:")]
  162. void PlayVideoAt (int index);
  163.  
  164. [Export ("playbackRate")]
  165. float PlaybackRate { get; set; }
  166.  
  167. [Export ("availablePlaybackRates")]
  168. NSObject [] AvailablePlaybackRates { get; }
  169.  
  170. [Export ("loop")]
  171. bool Loop { set; }
  172.  
  173. [Export ("shuffle")]
  174. bool Shuffle { set; }
  175.  
  176. [Export ("videoLoadedFraction")]
  177. float VideoLoadedFraction { get; }
  178.  
  179. [Export ("playerState")]
  180. YTPlayerState PlayerState { get; }
  181.  
  182. [Export ("currentTime")]
  183. float CurrentTime { get; }
  184.  
  185. [Export ("playbackQuality")]
  186. YTPlaybackQuality PlaybackQuality { get; set; }
  187.  
  188. [Export ("availableQualityLevels")]
  189. NSObject [] AvailableQualityLevels { get; }
  190.  
  191. [Export ("duration")]
  192. int Duration { get; }
  193.  
  194. [Export ("videoUrl")]
  195. NSUrl VideoUrl { get; }
  196.  
  197. [Export ("videoEmbedCode")]
  198. string VideoEmbedCode { get; }
  199.  
  200. [Export ("playlist")]
  201. NSObject [] Playlist { get; }
  202.  
  203. [Export ("playlistIndex")]
  204. int PlaylistIndex { get; }
  205. }
  206. }
RAW Paste Data