「Main API」Live play abstract class
More...
「Main API」Live play abstract class
- Author
- baorunchen
- Date
- 2022/8/14
- Attention
- This API is only supported in the interactive mode currently
-
The current API can only be used to pull real-time interactive streams (RTC streams); If pulling a regular live CDN stream (bypass live stream), please use a standard protocol player
-
Please use 'AlivcRTC' as the log tag for autonomous troubleshooting when using interactive mode.
- Call Rule
- In the scenario of live streaming, it is recommended to pull the stream after successfully pushing, it means, after the callback:
com.alivc.live.pusher.AlivcLivePushInfoListener#onFirstFramePushed(com.alivc.live.pusher.AlivcLivePusher)
In the scenario of push-pull bare stream, there is no temporal limit to push-pull flow
- Call Example
「Main API」Live play abstract class
- See also
- AliLive Push SDK Doc
-
Interactive streaming
-
Integrate a Push SDK license
Definition at line 30 of file AlivcLivePlayer.java.
◆ AlivcLivePlayer()
com.alivc.live.player.AlivcLivePlayer.AlivcLivePlayer |
( |
Context |
context, |
|
|
AlivcLiveMode |
mode |
|
) |
| |
instance construct
- Parameters
-
context | android context |
mode | live mode |
Definition at line 40 of file AlivcLivePlayer.java.
◆ destroy()
abstract void com.alivc.live.player.AlivcLivePlayer.destroy |
( |
| ) |
|
|
abstract |
◆ getMode()
abstract AlivcLiveMode com.alivc.live.player.AlivcLivePlayer.getMode |
( |
| ) |
|
|
abstract |
◆ getUserId()
abstract String com.alivc.live.player.AlivcLivePlayer.getUserId |
( |
| ) |
|
|
abstract |
Get current user id
- Returns
- user id
- Note
- In live streaming mode, for remote streaming user userid
-
In bare stream mode, the URL for remote pull stream users
◆ pauseAudioPlaying()
abstract void com.alivc.live.player.AlivcLivePlayer.pauseAudioPlaying |
( |
| ) |
|
|
abstract |
◆ pauseVideoPlaying()
abstract void com.alivc.live.player.AlivcLivePlayer.pauseVideoPlaying |
( |
| ) |
|
|
abstract |
◆ resumeAudioPlaying()
abstract void com.alivc.live.player.AlivcLivePlayer.resumeAudioPlaying |
( |
| ) |
|
|
abstract |
◆ resumeVideoPlaying()
abstract void com.alivc.live.player.AlivcLivePlayer.resumeVideoPlaying |
( |
| ) |
|
|
abstract |
◆ setPlayInfoListener()
◆ setPlayoutVolume()
abstract int com.alivc.live.player.AlivcLivePlayer.setPlayoutVolume |
( |
int |
volume | ) |
|
|
abstract |
set play volume
- Parameters
-
volume | play volume, value range: [0, 400] |
- Returns
- 0->success; others->failed
- Note
- <100: reduce volume; >100: increase volume
◆ setPlayView()
abstract int com.alivc.live.player.AlivcLivePlayer.setPlayView |
( |
FrameLayout |
frameLayout | ) |
|
|
abstract |
set play view
- Parameters
-
- Returns
- 0->success; others->failed
- Attention
- Due to the involvement of main-thread UI operations, please do not call frequently or quickly
-
Please make sure to pass in the FrameLayout container instead of TextureView or SurfaceView, otherwise it will not play properly. TextureView and SurfaceView will be created internally and added to FrameLayout.
- Note
- This interface is used in interactive scenarios (via microphone or PK) to set the playback view of remote streams
-
In interactive mode, the playback view
surfaceView
is created internally and added to the externally passed in frameLayout container
-
In the live streaming scenario, the anchor sets the video playback view of the live streaming audience through this interface, and the live streaming audience sets the anchor's video playback view through this interface
-
In the PK scenario, anchor A sets the video playback view of anchor B through this interface, and anchor B sets the video playback view of anchor A through this interface
-
If frameLayout passes in a null value, it means that the playback view is not used; If the current playback view already exists, the SDK will remove the current playback view
-
If frameLayout passes in a non empty value, it means using the playback view; If the current playback view already exists, the SDK will perform a view refresh operation
-
If you need to adjust the streaming preview display mode, please refer to the interface settings:
com.alivc.live.player.AlivcLivePlayConfig
◆ setupWithConfig()
abstract int com.alivc.live.player.AlivcLivePlayer.setupWithConfig |
( |
AlivcLivePlayConfig |
playConfig | ) |
|
|
abstract |
◆ snapshot()
snapshot
- Parameters
-
streamType | video stream type |
listener | snapshot callback |
◆ startPlay()
abstract int com.alivc.live.player.AlivcLivePlayer.startPlay |
( |
String |
url | ) |
|
|
abstract |
start play remote stream
- Parameters
-
url | anchor or connected audience pull url |
- Returns
- 0->success; others->failed
- Note
- This interface is used to play remote streams in interactive scenarios (connected microphone or PK)
-
In the connected microphone scenario, the anchor plays remote stream of the connected remote audience through this interface, and the connected remote audience plays remote stream of the anchor through this interface too.
-
In the PK scenario, the anchor A plays remote stream of the anchor B through this interface, and the anchor B plays remote stream of the anchor A through this interface too.
-
stopPlay, corresponding to the interface:
com.alivc.live.player.AlivcLivePlayer#stopPlay()
-
This interface corresponds to the callback:
com.alivc.live.player.AlivcLivePlayInfoListener#onPlayStarted()
◆ stopPlay()
abstract int com.alivc.live.player.AlivcLivePlayer.stopPlay |
( |
| ) |
|
|
abstract |