public static void assertEquals(final ShareVideo a, final ShareVideo b) { Assert.assertEquals(a.getLocalUrl(), b.getLocalUrl()); }
@Override public ShareVideo build() { return new ShareVideo(this); }
private UploadContext( ShareVideoContent videoContent, String graphNode, FacebookCallback<Sharer.Result> callback) { // Store off the access token right away so that under no circumstances will we // end up with different tokens between phases. We will rely on the access token tracker // to cancel pending uploads. this.accessToken = AccessToken.getCurrentAccessToken(); this.videoUri = videoContent.getVideo().getLocalUrl(); this.title = videoContent.getContentTitle(); this.description = videoContent.getContentDescription(); this.ref = videoContent.getRef(); this.graphNode = graphNode; this.callback = callback; this.params = videoContent.getVideo().getParameters(); if (!Utility.isNullOrEmpty(videoContent.getPeopleIds())) { this.params.putString("tags", TextUtils.join(", ", videoContent.getPeopleIds())); } if (!Utility.isNullOrEmpty(videoContent.getPlaceId())) { this.params.putString("place", videoContent.getPlaceId()); } if (!Utility.isNullOrEmpty(videoContent.getRef())) { this.params.putString("ref", videoContent.getRef()); } }
@Override public Builder readFrom(final ShareVideo model) { if (model == null) { return this; } return super.readFrom(model) .setLocalUrl(model.getLocalUrl()); }
public static String getVideoUrl(final ShareVideoContent videoContent, final UUID appCallId) { if (videoContent == null || videoContent.getVideo() == null) { return null; } NativeAppCallAttachmentStore.Attachment attachment = NativeAppCallAttachmentStore.createAttachment( appCallId, videoContent.getVideo().getLocalUrl()); ArrayList<NativeAppCallAttachmentStore.Attachment> attachments = new ArrayList<>(1); attachments.add(attachment); NativeAppCallAttachmentStore.addAttachments(attachments); return attachment.getAttachmentUrl(); }
private static NativeAppCallAttachmentStore.Attachment getAttachment( UUID callId, ShareMedia medium) { Bitmap bitmap = null; Uri uri = null; if (medium instanceof SharePhoto) { SharePhoto photo = (SharePhoto)medium; bitmap = photo.getBitmap(); uri = photo.getImageUrl(); } else if (medium instanceof ShareVideo) { ShareVideo video = (ShareVideo)medium; uri = video.getLocalUrl(); } return getAttachment(callId, uri, bitmap); }
private static void validateVideo(ShareVideo video, Validator validator) { if (video == null) { throw new FacebookException("Cannot share a null ShareVideo"); } Uri localUri = video.getLocalUrl(); if (localUri == null) { throw new FacebookException("ShareVideo does not have a LocalUrl specified"); } if (!Utility.isContentUri(localUri) && !Utility.isFileUri(localUri)) { throw new FacebookException("ShareVideo must reference a video that is on the device"); } }
public static synchronized void uploadAsync( ShareVideoContent videoContent, String graphNode, FacebookCallback<Sharer.Result> callback) throws FileNotFoundException { if (!initialized) { registerAccessTokenTracker(); initialized = true; } Validate.notNull(videoContent, "videoContent"); Validate.notNull(graphNode, "graphNode"); ShareVideo video = videoContent.getVideo(); Validate.notNull(video, "videoContent.video"); Uri videoUri = video.getLocalUrl(); Validate.notNull(videoUri, "videoContent.video.localUrl"); UploadContext uploadContext = new UploadContext(videoContent, graphNode, callback); uploadContext.initialize(); pendingUploads.add(uploadContext); enqueueUploadStart( uploadContext, 0); }
@Test public void testVideoBuilder() { final ShareVideo video = ShareModelTestUtility.getVideoBuilder().build(); assertEquals(ShareModelTestUtility.getTestVideoLocalUrl(), video.getLocalUrl()); ShareModelTestUtility.assertEquals(video, TestUtils.parcelAndUnparcel(video)); } }