FBSDKShareVideo.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  2. //
  3. // You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
  4. // copy, modify, and distribute this software in source code or binary form for use
  5. // in connection with the web services and APIs provided by Facebook.
  6. //
  7. // As with any software that integrates with the Facebook platform, your use of
  8. // this software is subject to the Facebook Developer Principles and Policies
  9. // [http://developers.facebook.com/policy/]. This copyright notice shall be
  10. // included in all copies or substantial portions of the software.
  11. //
  12. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  14. // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  15. // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  16. // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17. // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18. #import <Photos/Photos.h>
  19. #import <UIKit/UIKit.h>
  20. #import <FBSDKCoreKit/FBSDKCopying.h>
  21. #import <FBSDKShareKit/FBSDKSharingValidation.h>
  22. @class FBSDKSharePhoto;
  23. @class PHAsset;
  24. /**
  25. A video for sharing.
  26. */
  27. @interface FBSDKShareVideo : NSObject <FBSDKCopying, FBSDKSharingValidation, NSSecureCoding>
  28. /**
  29. Convenience method to build a new video object from raw data.
  30. - Parameter data: The NSData object that holds the raw video data.
  31. */
  32. + (instancetype)videoWithData:(NSData *)data;
  33. /**
  34. Convenience method to build a new video object with NSData and a previewPhoto.
  35. - Parameter data: The NSData object that holds the raw video data.
  36. - Parameter previewPhoto: The photo that represents the video.
  37. */
  38. + (instancetype)videoWithData:(NSData *)data previewPhoto:(FBSDKSharePhoto *)previewPhoto;
  39. /**
  40. Convenience method to build a new video object with a PHAsset.
  41. @param videoAsset The PHAsset that represents the video in the Photos library.
  42. */
  43. + (instancetype)videoWithVideoAsset:(PHAsset *)videoAsset;
  44. /**
  45. Convenience method to build a new video object with a PHAsset and a previewPhoto.
  46. @param videoAsset The PHAsset that represents the video in the Photos library.
  47. @param previewPhoto The photo that represents the video.
  48. */
  49. + (instancetype)videoWithVideoAsset:(PHAsset *)videoAsset previewPhoto:(FBSDKSharePhoto *)previewPhoto;
  50. /**
  51. Convenience method to build a new video object with a videoURL.
  52. @param videoURL The URL to the video.
  53. */
  54. + (instancetype)videoWithVideoURL:(NSURL *)videoURL;
  55. /**
  56. Convenience method to build a new video object with a videoURL and a previewPhoto.
  57. @param videoURL The URL to the video.
  58. @param previewPhoto The photo that represents the video.
  59. */
  60. + (instancetype)videoWithVideoURL:(NSURL *)videoURL previewPhoto:(FBSDKSharePhoto *)previewPhoto;
  61. /**
  62. The raw video data.
  63. - Returns: The video data.
  64. */
  65. @property (nonatomic, strong) NSData *data;
  66. /**
  67. The representation of the video in the Photos library.
  68. @return PHAsset that represents the video in the Photos library.
  69. */
  70. @property (nonatomic, copy) PHAsset *videoAsset;
  71. /**
  72. The file URL to the video.
  73. @return URL that points to the location of the video on disk
  74. */
  75. @property (nonatomic, copy) NSURL *videoURL;
  76. /**
  77. The photo that represents the video.
  78. @return The photo
  79. */
  80. @property (nonatomic, copy) FBSDKSharePhoto *previewPhoto;
  81. /**
  82. Compares the receiver to another video.
  83. @param video The other video
  84. @return YES if the receiver's values are equal to the other video's values; otherwise NO
  85. */
  86. - (BOOL)isEqualToShareVideo:(FBSDKShareVideo *)video;
  87. @end
  88. @interface PHAsset (FBSDKShareVideo)
  89. @property (nonatomic, copy, readonly) NSURL *videoURL;
  90. @end