This topic describes how to implement media playback using adaptive bitrate streaming, including live streaming.
Adaptive streaming is media streaming which adjusts its bit rate during playback. It offers reduced network usage and buffering time, and increased picture quality compared to traditional media streaming. For more information, see Adaptive bitrate streaming on Wikipedia.
The AVPlay API supports 3 common adaptive streaming engines. The following table lists the file extensions for which adaptive streaming is enabled.
Table 1. Supported file extensions for adaptive streaming
video
Adaptive streaming media playback is implemented using the AVPlay API in the same way as other media. The AVPlay instance handles the adaptive streaming media type based on the basic specifications for the stream.
AVPlay
When the AVPlay instance is in the IDLE state, you can adjust some adaptive streaming parameters by calling the setStreamingProperty() method with the ADAPTIVE_INFO property:
setStreamingProperty()
ADAPTIVE_INFO
... var bitRateString = 'BITRATES=5000~10000|STARTBITRATE=HIGHEST|SKIPBITRATE=LOWEST'; webapis.avplay.setStreamingProperty('ADAPTIVE_INFO', bitRateString); ... webapis.avplay.prepare();
The following table specifies the allowed parameters and values for the ADAPTIVE_INFO property. You can set multiple parameters by separating them with a "|" character.
BITRATES
FIXED_MAX_RESOLUTION
STARTBITRATE
LOWEST
HIGHEST
AVERAGE
SKIPBITRATE
START_TIME
Table 2. ADAPTIVE_INFO parameters
The following bit rates are recommended for each stream resolution:
Table 3. Recommended streaming bit rates
To implement adaptive streaming for 4K and 8K resolution TVs:
MPEG-DASH stream meta data ("MPD" file)
... <AdaptationSet ...> ... <Representation id="2" mimeType="video/mp4" codecs="hev1.2.4.L150.90" width="3840" height="2130" ...> <BaseURL>input_video_3840x2130_7000k_dashinit.mp4 </BaseURL> <SegmentBase indexRangeExact="true" indexRange="2923-3194"> <Initialization range="0-2922"/> </SegmentBase> </Representation> … <Representation id="6" mimeType="video/mp4" codecs="hev1.2.4.L180.90" width="7680" height="4320" ...> <BaseURL>input_video_7680x4320_30000k_dashinit.mp4</BaseURL> <SegmentBase indexRangeExact="true" indexRange="2889-3172"> <Initialization range="0-2888"/> </SegmentBase> </Representation> ... </AdaptationSet>
HLS stream meta data ("M3U8" file)
#EXTM3U #EXT-X-VERSION:3 #EXT-X-STREAM-INF:BANDWIDTH=24576000,RESOLUTION=7680x4320 7680x4320_1/output.m3u8 #EXT-X-STREAM-INF:BANDWIDTH=10240000,RESOLUTION=3840x2160 3840x2160_1/output.m3u8 #EXT-X-STREAM-INF:BANDWIDTH=6502400,RESOLUTION=2560x1440 2560x1440_1/output.m3u8 #EXT-X-STREAM-INF:BANDWIDTH=4403200,RESOLUTION=1920x1080 1920x1080_1/output.m3u8 #EXT-X-STREAM-INF:BANDWIDTH=3072000,RESOLUTION=1280x720 1280x720_1/output.m3u8
... webapis.avplay.setStreamingProperty("ADAPTIVE_INFO", "FIXED_MAX_RESOLUTION=7680x4320"); ... webapis.avplay.prepare();
The following table describes the recommended specifications for MPEG-DASH streaming at 8K resolution.
Table 4. Recommended content specifications for 8K MPEG-DASH streaming
The following table describes the recommended specifications for HLS streaming at 8K resolution.
Table 5. Recommended content specifications for 8K HLS streaming
The jumpForward(), jumpBackward(), and seekTo() methods of the AVPlay API, which are related to live seeking, have limited functionality in live streaming. If you want to use live seek, the streaming server must maintain past and future segments. The seekable range is limited to the segments maintained on the server. The following table lists the streaming engines that support live seek.
jumpForward()
jumpBackward()
seekTo()
Table 6. Streaming engines supporting live seek