All Products
Search
Document Center

ApsaraVideo Live:How do I obtain an RTS TraceID?

Last Updated:Feb 25, 2025

Real-Time Streaming (RTS) TraceID is a globally unique request identifier that is used to locate and troubleshoot requests. RTS TraceIDs play a vital role in improvement of access efficiency. This topic describes how to obtain an RTS TraceID.

Background information

When you troubleshoot issues during playback by using information such as the playback time and the IP address of a user, you need to retrieve error logs from a large number of logs. This process is inefficient. If multiple playback behaviors occur for the same user IP address within this period of time, the O&M difficulty further increases. RTS provides a solution that uses TraceIDs. A TraceID is generated for each playback behavior, and can be used to identify the issue at the earliest opportunity. We recommend that you associate TraceIDs with your client logs.

You can use the following methods to obtain an RTS TraceID:

Obtain an RTS TraceID by using RTS demos

Use the RTS demo for Android or iOS

For information about how to use the RTS demo for mobile clients to play an RTS stream, see Run demos. After a playback request is initiated, click Troubleshoot on the playback page of the RTS demo and view the details in the pop-up window. The RequestId is the TraceID.

Use the RTS demo for web (in HTML5)

For information about how to use the RTS demo for web to play an RTS stream, see Run demos. After a playback request is initiated, click Troubleshoot on the playback page of the RTS demo and view the TraceID in the pop-up window.

web端

Obtain an RTS TraceID in a production environment

In a production environment, the SDK is integrated into your application and you do not need to use the demos of Alibaba Cloud.

Android or iOS production environment

Obtain a TraceID from an event callback of ApsaraVideo Player SDK.

Note

Each RTS playback generates a TraceID, which can be used for troubleshooting.

  • Android

    // Listen to the onInfo callback and parse the DemuxerTraceID message.
    mRtsAliPlayer.setOnInfoListener(infoBean -> {
        if (infoBean.getCode() == InfoCode.DemuxerTraceID) {
            String traceId = infoBean.getExtraMsg();
    });
  • iOS

    // Listen to the onPlayerEvent callback and parse the DemuxerTraceID message.
    - (void)onPlayerEvent:(AliPlayer*)player eventWithString:(AVPEventWithString)eventWithString description:(NSString *)description {
        switch (eventWithString) {
            case EVENT_PLAYER_DEMUXER_TRACE_ID:
                {
                    NSString *traceId = description;
                }
                    break;
                default:
                    break;
        }
    }

HTML5 web production environment

  • Obtain a TraceID from the response result of a signaling request

    An HTML5 signaling request is an HTTP POST request. You can obtain the TraceID from the Network tab of the developer tool in your browser. If the source URL is artc://player.alicdn.com/a/b_RTS, the signaling request is http(s)://player.alicdn.com/a/b_RTS.

    1. Access the RTS player for web.

    2. In the RTS player for web, enter the streaming URL for which RTS is enabled, for example, artc://player.alicdn.com/a/b_RTS.

    3. Click Start to play the RTS stream.

    4. Press F12 to open the developer tool of your browser and click the Network tab.

    5. Search for the http(s)://player.alicdn.com/a/b_RTS signaling request and view the TraceID in Response.

  • ApsaraVideo Player SDK for Web

    ApsaraVideo Player SDK for Web can obtain RTS TraceIDs by subscribing to the rtsTraceId event. Sample code:

    // The event is triggered when an RTS stream is pulled. In the callback function, the traceId parameter indicates the TraceID of the stream pulling, and the source parameter indicates the streaming URL. 
    player.on('rtsTraceId', function(event) {
        console.log('EVENT rtsTraceId', event.paramData);
    })