background

The network environment is complex and the network speed is unstable. Aliplayer provides a multi-resolution playback mode. Users can manually switch the resolution and select the optimal one for the player

First, live selection -Source mode

The mode of source specifies multiple articulation addresses. This mode is widely used in live broadcast scenarios. Aliyun live broadcast service can provide multi-bit rate streaming addresses. Aliplayer provides the following articulation correspondence:

The usage code of the player is:

     

Vod selection -Source mode

Second, vod -videoId mode

When the video of voD service is played in videoId mode, Aliplayer will obtain the multi-resolution video address generated by the user in voD service transcoding and generate a multi-definition selection list. For details, see VOD transcoding

If the user transcodes to generate multiple video files, Aliplayer will preferentially play the video in the order of MP4 -> M3U8 -> FLV. If there is an encrypted video with regular video, the voD service will only return the address of the encrypted video. Aliplayer provides several other properties that can be used to get the exact play address of the video on demand:

The usage code of the player is:

var player = new Aliplayer({
    id: "player-con".width: "100%".height: "500px".autoplay: true.language: "en-us".vid : '1e067a2831b641db9dmgla3mpp43240'.playauth:'ddddfdfdf'
    format:'m3u8'.mediaType:'video'.qualitySort:'desc'.definition:'FD,LD'.defaultDefinition:'LD'
  }, function (player) {
    console.log("Player created successfully");
})


Copy the code

Multibit rate of HLS

HLS HTTP Live Streaming is an HTTP-based Streaming protocol proposed by Apple. It supports multi-bit rate addresses of different bandwidths. The basic format is as follows:

#EXTM3U
#EXT-X-VERSION:4
#EXT-X-STREAM-INF:BANDWIDTH=454521,AVERAGE-BANDWIDTH=432061,CODECS="Avc1.42 c01e mp4a. 40.5",RESOLUTION=340x192,FRAME-RATE=25.000
GEPH-ONTHERECS02E012C-_E17101101_master_stream_x3f6b2fee5c3d4f388ed8edee586bd6f8_340.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=691401,AVERAGE-BANDWIDTH=644868,CODECS="Avc1.42 c01e mp4a. 40.5",RESOLUTION=384x216,FRAME-RATE=25.000
GEPH-ONTHERECS02E012C-_E17101101_master_stream_x3f6b2fee5c3d4f388ed8edee586bd6f8_384.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=926476,AVERAGE-BANDWIDTH=850169,CODECS="Avc1.42 c01f mp4a. 40.5",RESOLUTION=512x288,FRAME-RATE=25.000
#EXT-X-STREAM-INF:BANDWIDTH=7011961,AVERAGE-BANDWIDTH=6374698,CODECS="Avc1.640028, mp4a. 40.5",RESOLUTION=1920x1080,FRAME-RATE=25.000
GEPH-ONTHERECS02E012C-_E17101101_master_stream_x3f6b2fee5c3d4f388ed8edee586bd6f8_1920.m3u8


Copy the code

Ext-x-stream-inf: specifies the BANDWIDTH for the video. Aliplayer will select the correct resolution for the video. Aliplayer will select the correct resolution for the video.

Push flow way

Push flow with OBS

Live – How is clarity verified

In switching clarity, such as m3U8, the requested Url is unchanged in the official example of Ali Cloud

reference

  1. Ali live scene more source configuration player.alicdn.com/aliplayer/p…
  2. OBS push stream APP use