2

When you share a YouTube link on FB with intent it automatically embeds the YouTube player into your wall and it look like this

enter image description here

but... when I try to post the same video using FB sdk, HelloFacebookSampleActivity => postStatusUpdate() mathood.

 public void postStatusUpdate() {
        if (user != null && hasPublishPermission()) {
            final String message ;

                message = ( user.getFirstName()+" "+ getString( R.string.status_update_link)+ " " +video_id + " " + getString(R.string.google_play_link));


            Request request = Request
                    .newStatusUpdateRequest(Session.getActiveSession(), message, new Request.Callback() {
                        @Override
                        public void onCompleted(Response response) {
                            showPublishResult(message, response.getGraphObject(), response.getError());
                        }
                    });
            request.executeAsync();
        } else {
            pendingAction = PendingAction.POST_STATUS_UPDATE;
        }
    }

it look like this

enter image description here

so I find this link that order to change the link format from http://www.youtube.com/watch?v=<code> to http://www.youtube.com/e/<code> or to add &autoplay=1 after the <code>

but it doesnt work... I googled "facebook android embedded link youtube" but find nothing about this issue, need help

How I posting an embedded YouTube link (like pic 1 ) using the Facebook sdk ?

UPDATE :

I convert my code, now I'm using Publish to Feed code. but the problem not solved

I try to post by source like facebook mansion , but it doesnt work...

  postParams.putString("name", "Facebook SDK for Android");
            postParams.putString("caption", "Build great social apps and get more installs.");
            postParams.putString("description", "The Facebook SDK for Android makes it easier and faster to develop Facebook integrated Android apps.");
            postParams.putString("source","http://www.youtube.com/e/2raioEC7Hms");
Community
  • 1
  • 1
idan
  • 1,508
  • 5
  • 29
  • 60

1 Answers1

1

solved : using tutorial Publish to Feed , using post

 postParams.putString("message", "Link to YouTube");
        postParams.putString("link", "http://www.youtube.com/watch?v=3aICB2mUu2k");
        postParams.putString("source", "http://www.youtube.com/v/3aICB2mUu2k");
        postParams.putString("picture","http://img.youtube.com/vi/3aICB2mUu2k/0.jpg");
idan
  • 1,508
  • 5
  • 29
  • 60