facebook-android-sdk icon indicating copy to clipboard operation
facebook-android-sdk copied to clipboard

Sharing video as Story background is failing

Open hashlin opened this issue 2 years ago • 8 comments

Checklist before submitting a bug report

Java version

11

Android version

All

Android SDK version

12.x.x, 13.x.x and earlier versions too

Installation platform & version

Gradle

Package

Share

Goals

We want to share videos to Facebook Stories. But, Facebook App is not shown up and return an error instead.

Expected results

Video should be passed to Facebook App's Story Screen

Actual results

Video is not passed to Facebook App's Story Screen. And show the following error is sent via FacebookCallback.

Steps to reproduce

No response

Code samples & details

Share Video Code

        // Model a video background asset
        val video = ShareVideo.Builder().setLocalUrl(uri).build()

        // Add to ShareStoryContent
        val content = ShareStoryContent.Builder()
                .setBackgroundAsset(video)
                .build()

        val shareDialog = ShareDialog(fragment).apply {
            registerCallback(callbackManager, shareCallback)
        }
        dialog.show(content, ShareDialog.Mode.AUTOMATIC)

Callback Code [Error log will be attached below]

    private val shareCallback = object : FacebookCallback<Sharer.Result> {
        override fun onSuccess(result: Sharer.Result) {}

        override fun onCancel() {}

        override fun onError(error: FacebookException) {
            // This error callback is invoked
            Timber.e(error)
        }

hashlin avatar Apr 22 '22 05:04 hashlin

Error Log Facebook Story Error

hashlin avatar Apr 22 '22 05:04 hashlin

I have met a similar error: "Parameter specified as non-null is null: method X.0zH.A1C, parameter param at index = 0" we can share video to facebook story about 4 month ago and we haven't made any change during these months. here's the code

        val shareVideo = ShareVideo.Builder().setLocalUrl(videoUri).build()
        val shareStoryContent = ShareStoryContent.Builder()
                .setBackgroundAsset(shareVideo)
                .build()

        if (ShareDialog.canShow(ShareStoryContent::class.java)) {
            shareDialog.show(shareStoryContent)
        }

326406750 avatar Apr 26 '22 11:04 326406750

I have the same problem. Any solution?

paulocoutinhox avatar Jun 15 '22 15:06 paulocoutinhox

I would recommend switching to the newer Share to Stories API https://developers.facebook.com/docs/sharing/sharing-to-stories/android-developers

angiep125 avatar Jun 16 '22 23:06 angiep125

Also see https://github.com/facebook/facebook-android-sdk/issues/1081 for an example of onboarding onto newer API

angiep125 avatar Jun 17 '22 23:06 angiep125

Me too. Has the problem been solved

sudeqiangxx avatar Aug 26 '22 01:08 sudeqiangxx

I would recommend switching to the newer Share to Stories API https://developers.facebook.com/docs/sharing/sharing-to-stories/android-developers see https://github.com/facebook/facebook-android-sdk/issues/1081 for an example of onboarding onto newer API

angiep125 avatar Oct 05 '22 21:10 angiep125

Hi,

Full sample is here with new API: https://github.com/paulocoutinhox/android-share-story

Thanks.

paulocoutinhox avatar Oct 06 '22 18:10 paulocoutinhox