【问题标题】:How to share video by slack?如何通过 slack 分享视频?
【发布时间】:2019-08-27 15:04:26
【问题描述】:

我通过 WhatsUp 分享视频时实现了分享视频和所有作品。但我注意到,如果我通过 Slack 分享视频,它不会在 Slack 中播放。这意味着我在我的 Slack 帐户中获得了视频文件,单击它并无法播放...我可以下载此视频并且它会播放,但在 Slack 中它不会。

如果我将标准 Gallery 应用程序中的视频分享到 Slack,它就可以工作......

那么,有什么区别呢?

这是我的分享代码

private fun openShareDialog(iC: Context, //
                            iPath: String) {
    MediaScannerConnection.scanFile(//
            iC.applicationContext, //
            arrayOf(iPath), null //
    ) { _, iUri ->
        var shareIntent = Intent(Intent.ACTION_SEND)
        shareIntent.type = "video/*"
        shareIntent.putExtra(Intent.EXTRA_SUBJECT, "title")
        shareIntent.putExtra(Intent.EXTRA_TITLE, "title")
        shareIntent.putExtra(Intent.EXTRA_STREAM, iUri)
        shareIntent = Intent.createChooser(shareIntent, iC.getString(R.string.tetavi_send_to))
        shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
        iC.startActivity(shareIntent)
    }
}

【问题讨论】:

    标签: android sharing file-sharing android-sharing data-sharing


    【解决方案1】:
    Intent sharingIntent = new Intent(Intent.ACTION_SEND);
                sharingIntent.setType("*/*");
                sharingIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
                sharingIntent.putExtra(Intent.EXTRA_SUBJECT, "subject");
                sharingIntent.putExtra(Intent.EXTRA_TITLE, "title");
                sharingIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + file.getAbsolutePath()));
                startActivity(Intent.createChooser(sharingIntent, "share file with"));
    

    【讨论】:

    • 发布一些没有任何解释的代码不能作为正确答案,请描述您的答案如何解决问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-02-05
    • 2015-08-17
    • 2017-09-28
    • 2017-02-20
    • 2013-02-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多