AliVCSDK 6.17.0
阿里云音视频SDK,为视频开发者提供一站式接入服务
 
Loading...
Searching...
No Matches
com.alivc.live.player.AlivcLivePlayer Class Referenceabstract

「Main API」Live play abstract class More...

Public Member Functions

 AlivcLivePlayer (Context context, AlivcLiveMode mode)
 
abstract int setupWithConfig (AlivcLivePlayConfig playConfig)
 
abstract void setPlayInfoListener (AlivcLivePlayInfoListener infoListener)
 
abstract int setPlayView (FrameLayout frameLayout)
 
abstract int startPlay (String url)
 
abstract int stopPlay ()
 
abstract void pauseAudioPlaying ()
 
abstract void resumeAudioPlaying ()
 
abstract void pauseVideoPlaying ()
 
abstract void resumeVideoPlaying ()
 
abstract int setPlayoutVolume (int volume)
 
abstract void snapshot (AlivcLivePlayVideoStreamType streamType, AlivcSnapshotListener listener)
 
abstract String getUserId ()
 
abstract void destroy ()
 
abstract AlivcLiveMode getMode ()
 

Detailed Description

「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
See also
AliLive Push SDK Doc
Interactive streaming
Integrate a Push SDK license

Definition at line 30 of file AlivcLivePlayer.java.

Constructor & Destructor Documentation

◆ AlivcLivePlayer()

com.alivc.live.player.AlivcLivePlayer.AlivcLivePlayer ( Context  context,
AlivcLiveMode  mode 
)

instance construct

Parameters
contextandroid context
modelive mode

Definition at line 40 of file AlivcLivePlayer.java.

Member Function Documentation

◆ destroy()

abstract void com.alivc.live.player.AlivcLivePlayer.destroy ( )
abstract

destroy player

◆ getMode()

abstract AlivcLiveMode com.alivc.live.player.AlivcLivePlayer.getMode ( )
abstract

Get the mode of live player

Returns
live player mode
See also
com.alivc.live.annotations.AlivcLiveMode

◆ 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()

abstract void com.alivc.live.player.AlivcLivePlayer.setPlayInfoListener ( AlivcLivePlayInfoListener  infoListener)
abstract

set play info listener

Parameters
infoListenerplay info listener
See also
com.alivc.live.player.AlivcLivePlayInfoListener

◆ setPlayoutVolume()

abstract int com.alivc.live.player.AlivcLivePlayer.setPlayoutVolume ( int  volume)
abstract

set play volume

Parameters
volumeplay 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
frameLayoutframeLayout
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

setup with play config

Parameters
playConfigplay config
Returns
0->success; others->failed
See also
com.alivc.live.player.AlivcLivePlayConfig

◆ snapshot()

abstract void com.alivc.live.player.AlivcLivePlayer.snapshot ( AlivcLivePlayVideoStreamType  streamType,
AlivcSnapshotListener  listener 
)
abstract

snapshot

Parameters
streamTypevideo stream type
listenersnapshot callback

◆ startPlay()

abstract int com.alivc.live.player.AlivcLivePlayer.startPlay ( String  url)
abstract

start play remote stream

Parameters
urlanchor 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

stop play remote stream

Returns
0->success; others->failed
Note
startPlay, corresponding to the interface: com.alivc.live.player.AlivcLivePlayer#startPlay(String)
This interface corresponds to the callback: com.alivc.live.player.AlivcLivePlayInfoListener#onPlayStopped()