android视频贴纸第三方,将视频和贴纸图像分享到Android上的Instagram...

如何将视频作为背景和图像作为贴纸共享到Instagram Story?

如果两个内容均为图像,则本文档仅提供一种解决方案.

我想发送背景视频和贴纸图像. Instagram Story可以做到吗?

我尝试过,但是不幸的是它没有用:

// Define image asset URI and attribution link URL

Uri backgroundAssetUri = Uri.fromFile(new File(backgroundPath));

Uri stickerAssetUri = Uri.fromFile(new File(stickerPath));

// Instantiate implicit intent with ADD_TO_STORY action,

// background asset, and attribution link

Intent intent = new Intent("com.instagram.share.ADD_TO_STORY");

intent.setDataAndType(backgroundAssetUri, "*/*");

intent.putExtra("interactive_asset_uri", stickerAssetUri);

intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);

callbackManager.startActivityForResult(Intent.createChooser(intent, "Share"), NatShareCallbacks.ACTIVITY_SHARE_INSTAGRAM_STORY);

但是带有两个图像的示例可以正常工作.我主要看到SetType的问题,因为它们是两种不同的内容类型.

[编辑]

仅视频不带贴纸的视频已经可以在Android上使用,带有图像背景和图像贴纸的文档示例也可以完美运行.但是不能将视频和贴纸放在一起.

它可以在iOS下正常工作:

NSData *backgroundVideo = [[NSFileManager defaultManager] contentsAtPath:path];

UIImage *appIcon = [UIImage imageNamed: [[[[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIcons"] objectForKey:@"CFBundlePrimaryIcon"] objectForKey:@"CFBundleIconFiles"] objectAtIndex:0]];

// Verify app can open custom URL scheme, open

NSURL *urlScheme = [NSURL URLWithString:@"instagram-stories://share"];

if ([[UIApplication sharedApplication] canOpenURL:urlScheme]) {

// Assign background image asset and attribution link URL to pasteboard

//NSArray *pasteboardItems = @[@{@"com.instagram.sharedSticker.backgroundVideo" : backgroundVideo}];

NSArray *pasteboardItems = @[@{@"com.instagram.sharedSticker.backgroundVideo" : backgroundVideo, @"com.instagram.sharedSticker.stickerImage" : UIImagePNGRepresentation(appIcon)}];

NSDictionary *pasteboardOptions = @{UIPasteboardOptionExpirationDate : [[NSDate date] dateByAddingTimeInterval:60 * 5]};

// This call is iOS 10+, can use 'setItems' depending on what versions you support

[[UIPasteboard generalPasteboard] setItems:pasteboardItems options:pasteboardOptions]; [[UIApplication sharedApplication] openURL:urlScheme options:@{} completionHandler:nil];

} else {

// Handle older app versions or app not installed case

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值