All Products
Search
Document Center

ApsaraVideo Live:How to obtain an RTS TraceID

Last Updated:Dec 11, 2024

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

RTS integrated through ApsaraVideo Player SDK

  1. Register the callback.

    • For Android: Register setOnInfoListener of IPlayer.

    • For iOS: Register -(void)onPlayerEvent:(AliPlayer*)player eventWithString:(AVPEventWithString)eventWithString description:(NSString *)description of AVPDelegate.

  2. Parse the string in the callback.

    • For Android: With infoBean.getCode() == InfoCode.DirectComponentMSG, parse infoBean.getExtraMsg(), listen to the event whose code is 104, and then obtain the helpid and TraceID.

    • For iOS: With eventWithString == EVENT_PLAYER_DIRECT_COMPONENT_MSG, parse description, listen to the event whose code is 104, and then obtain the helpid and TraceID.

      In the following sample code, the TraceID is live6.cn1026_3166_317379681_164568568****.

      {"class":"demuxer","obj":"10804120096","name":"ArtcDemuxer","level":16,"content":"code=104,when=1645685687551,where=na,who=0,desc=\"trace:d2acbcdc%252D6bc0%252D4353%252D9070%252De37d73e34761-pull%2Ertspk%2Egrtn%2Ealiyunlive%2Ecom-ios-20220224065447-F4h9naPqJ6GDzwPV-sub-live6.cn1026_3166_317379681_164568568****\""}

HTML5 web production environment

  • Obtain the TraceID from the response result of the 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, and the source parameter indicates the streaming URL. 
    player.on('rtsTraceId', function(event) {
        console.log('EVENT rtsTraceId', event.paramData);
    })