Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i get an error while call setLiveTranscoding method #96

Closed
karansingla007 opened this issue Apr 14, 2020 · 22 comments
Closed

i get an error while call setLiveTranscoding method #96

karansingla007 opened this issue Apr 14, 2020 · 22 comments
Assignees
Labels
question Further information is requested

Comments

@karansingla007
Copy link

i want to redirect my stream to youtube, facebook

i am using setLiveTranscoding and addPublishStreamUrl but it gives me error

PlatformException(error, length=3; index=100, null) agora

i am using agora_rtc_engine: ^1.0.10

@LichKing-2234
Copy link
Contributor

@karansingla007
Copy link
Author

karansingla007 commented Apr 19, 2020

@LichKing-2234
yes, i did that

same configuration and same APP_ID is working on android native

here is my code:-

 Future<void> setTranscoding(int uid) async {
    try {
      List<AgoraLiveTranscodingUser> agoraLiveUserList =
          cdnLayout(uid, _users, 360, 640);
      await AgoraRtcEngine.setLiveTranscoding(AgoraLiveTranscoding.fromJson({
        'width': 480,
        'height': 640,
        'videoBitrate': 1800,
        'videoFramerate': 15,
        'transcodingUsers': agoraLiveUserList,
        'watermark': AgoraImage('https://imgur.com/zt3pL7e', 0, 0, 100, 100),
        'backgroundImage':
            AgoraImage('https://imgur.com/zt3pL7e', 0, 0, 100, 100),
        'audioSampleRate': AgoraAudioSampleRateType.MidRateType,
        'audioChannels': 2,
        'audioBitrate': 48,
        'videoCodecProfile': AgoraVideoCodecProfileType.High
      }));
      await AgoraRtcEngine.addPublishStreamUrl(
          'rtmp://a.rtmp.youtube.com/live2/deqj-h312-m17h-bbkf', true);
    } catch (error, stackTrace) {
      print(error);
      print(stackTrace);
    }
  }

here, i set my layout.

List<AgoraLiveTranscodingUser> cdnLayout(
      int bigUserId, List<int> publishers, int canvasWidth, int canvasHeight) {
    List<AgoraLiveTranscodingUser> users = [];
    int index = 0;
    double xIndex, yIndex;
    int viewWidth;
    int viewHEdge;
    if (publishers.length <= 1) {
      viewWidth = canvasWidth;
    } else {
      viewWidth = canvasWidth ~/ 2;
    }
    if (publishers.length <= 2) {
      viewHEdge = canvasHeight;
    } else {
      viewHEdge = canvasHeight ~/ ((publishers.length - 1) / 2 + 1);
    }
    users.add(AgoraLiveTranscodingUser.fromJson({
      'uid': bigUserId,
      'width': viewWidth,
      'height': viewHEdge,
      'x': 0,
      'y': 0,
      'zOrder': 0,
      'alpha': 1,
      'audioChannel': 0
    }));
    index++;
    for (int entry in publishers) {
      if (entry == bigUserId) continue;
      xIndex = index % 2.0;
      yIndex = index / 2;
      users.add(AgoraLiveTranscodingUser.fromJson({
        'uid': entry,
        'width': viewWidth,
        'height': viewHEdge,
        'x': ((xIndex) * viewWidth).toInt(),
        'y': (viewHEdge * (yIndex)).toInt(),
        'zOrder': index + 1,
        'alpha': 1,
        'audioChannel': 0
      }));
      index++;
    }
    return users;
  }

@LichKing-2234
Copy link
Contributor

it seems like a bug of native code, could you help me to confirm it?
image

@LichKing-2234
Copy link
Contributor

dart invoke method with enum value, but native wants the index value.
image

@karansingla007
Copy link
Author

@LichKing-2234
i hardcode the values but still not working. my stream is not redirecting to youtube.
Screenshot from 2020-04-20 12-02-06

@LichKing-2234 LichKing-2234 self-assigned this Apr 20, 2020
@plutoless
Copy link
Contributor

@singlakaran i think there's a callback named rtmpStreamingStateChanged, could you pls listen to that event to see what state value you get?

@jajuat
Copy link

jajuat commented Apr 28, 2020

@LichKing-2234 Who can help up with this issue? Is there something we are missing in implementation or its an SDK bug?

@LichKing-2234
Copy link
Contributor

@jajuat @singlakaran the SDK has some bug, you can try this.
image
And refer to this doc

await AgoraRtcEngine.setChannelProfile(ChannelProfile.LiveBroadcasting);
await AgoraRtcEngine.setClientRole(ClientRole.Broadcaster);

@karansingla007
Copy link
Author

@LichKing-2234
i hardcode the values but still not working. my stream is not redirecting to youtube.
Screenshot from 2020-04-20 12-02-06

@LichKing-2234 i already tried this
that was not working for me.

@LichKing-2234
Copy link
Contributor

@singlakaran have you setChannelProfile to ChannelProfile.LiveBroadcasting?

@karansingla007
Copy link
Author

yes, @LichKing-2234
i already set

await AgoraRtcEngine.setChannelProfile(ChannelProfile.LiveBroadcasting);

@plutoless
Copy link
Contributor

@singlakaran could you pls double check that you have enabled RTMP converter as following
image

if not please help provide your project, we may help take a look.

@karansingla007
Copy link
Author

Screenshot from 2020-05-04 23-08-45

@plutoless i already enabled

@jajuat
Copy link

jajuat commented May 4, 2020

The published stream you see if when @singlakaran published via Android SDK. The Android SDK works for us, we are successfully able to stream to You Tube, the same settings in Flutter SDK doesn't work.

@LichKing-2234
Copy link
Contributor

@singlakaran @jajuat pls provide your complete dart code about init and join, I will help to check it.

@karansingla007
Copy link
Author

@LichKing-2234
i used agora_rtc_engine 1.0.11

but i got error
java.lang.Integer cannot be cast to java.lang.Double
when i call setLiveTranscoding method.

you can see my sample project
https://github.com/singlakaran/agoarCdn

i set parameters according to:-
https://docs.agora.io/en/Audio%20Broadcast/cdn_streaming_android?platform=Android

@LichKing-2234
Copy link
Contributor

try this, I will update later
image

@karansingla007
Copy link
Author

@LichKing-2234 i tried this, but no luch
this time it did not give me any error, but its not redirecting my stream to youtube.

@LichKing-2234
Copy link
Contributor

@singlakaran i think there's a callback named rtmpStreamingStateChanged, could you pls listen to that event to see what state value you get?

pls provide the params of this callback

@karansingla007
Copy link
Author

@LichKing-2234
i used these params

  Future<void> setTranscoding(int uid) async {
    try {
      List<AgoraLiveTranscodingUser> agoraLiveUserList =
          cdnLayout(uid, _users, 360, 640);

      await AgoraRtcEngine.setLiveTranscoding(AgoraLiveTranscoding.fromJson({
        'width': 480,
        'height': 640,
        'videoBitrate': 1800,
        'videoFramerate': 15,
        'transcodingUsers': agoraLiveUserList,
        'watermark': AgoraImage('https://imgur.com/zt3pL7e', 0, 0, 100, 100),
        'backgroundImage':
            AgoraImage('https://imgur.com/zt3pL7e', 0, 0, 100, 100),
        'audioSampleRate': AgoraAudioSampleRateType.MidRateType,
        'audioChannels': 2,
        'audioBitrate': 48,
        'videoCodecProfile': AgoraVideoCodecProfileType.High
      }));
      await AgoraRtcEngine.addPublishStreamUrl(
          'rtmp://a.rtmp.youtube.com/live2/deqj-h312-m17h-bbkf', true);
    } catch (error, stackTrace) {
      print(error);
      print(stackTrace);
    }
  }
users.add(AgoraLiveTranscodingUser.fromJson({
        'uid': entry,
        'width': viewWidth,
        'height': viewHEdge,
        'x': ((xIndex) * viewWidth).toInt(),
        'y': (viewHEdge * (yIndex)).toInt(),
        'zOrder': index + 1,
        'alpha': 1,
        'audioChannel': 0
      }));

@LichKing-2234
Copy link
Contributor

I think you misunderstood me,I want to see the return value of the callback rtmpStreamingStateChanged

@LichKing-2234 LichKing-2234 added the question Further information is requested label Jun 12, 2020
@LichKing-2234
Copy link
Contributor

you can reopen this issue if the problem still exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants