RTS live playback

Updated at:
Copy as MD

Real-Time Streaming (RTS) is a value-added feature for ApsaraVideo Live that enables millisecond-level latency for millions of concurrent viewers through the ApsaraVideo Player SDK. RTS addresses the 3- to 6-second latency common in traditional live streaming, delivering ultra-low latency, minimal stuttering, and instant playback.

Important

For more information about features, API documentation, and FAQs, see iOS Player.

RTS playback

The iOS Player SDK integrates the native RTS SDK to enable low-latency live streaming. For more information, see Implement RTS stream pulling on iOS.

For code samples, see the RTS ultra-low latency live playback (RtsLiveStream) module in API-Example, an Objective-C sample project that demonstrates the core features of the iOS Player SDK.

RTS multi-definition

Note
  • This feature supports playback URLs from ApsaraVideo Live and transcoded stream URLs generated by default or custom transcoding. For more information about live stream transcoding, see Transcoding management. For more information about how to obtain streaming URLs, see Generate streaming URLs.

  • Definition switching is supported for live streams that use the RTS and HTTP-FLV protocols.

  • Set the group of pictures (GOP) size for stream ingest to 1 s or 2 s. A larger GOP size may cause playback to jump when you switch streams.

  • For the playback domain name, enable the Output RTMP timestamp during FLV playback and Output RTMP timestamp after upstream disconnection options. For the transcoding configuration, enable the Timestamp follows source and Keyframe follows source options. Otherwise, stream switching may stutter or fail. To enable these options, submit a ticket.

  • If you switch to a stream URL that does not meet the preceding requirements, the switch fails.

Switch definition

To switch definitions, call the switchStream method and pass the URL of the new definition.

// Start playback.
[self.player setUrlSource:oldUrl];
[self.player prepare];
[self.player start];

// Switch to another URL during playback.
[self.player switchStream:newUrl];

Resolution Switching Notifications

The following callbacks notify you of successful and failed definition switches.

// Callback for a successful switch.
- (void)onStreamSwitchedSuccess:(AliPlayer*)player URL:(NSString*)URL;

// Callback for a failed switch.
- (void)onStreamSwitchedFail:(AliPlayer*)player URL:(NSString*)URL errorModel:(AVPErrorModel *)errorModel;