Skip to content

createVideo ​

Create the host video presentation component.

Declaration ​

java
void createVideo(SUDOPVideo params);

Attach params.videoView to the game page and lay it out using x, y, width, and height. Use params.videoControl for playback and event registration. This callback does not use SUDOPStateHandle.

SUDOPVideo ​

java
public class SUDOPVideo {
    public long instanceId; 
    public int x; 
    public int y; 
    public int width; 
    public int height; 
    public String poster; 
    public boolean controls; 
    public boolean showProgress; 
    public boolean showProgressInControlMode; 
    public String backgroundColor; 
    public boolean enableProgressGesture; 
    public boolean enablePlayGesture; 
    public boolean showCenterPlayBtn; 
    public boolean underGameView; 
    public boolean autoPauseIfNavigate; 
    public boolean autoPauseIfOpenNative; 

    public TextureView videoView; 
    public SUDOPVideoControl videoControl; 
}

poster is the cover image; controls and the show* fields configure controls. backgroundColor sets the background. enableProgressGesture and enablePlayGesture configure gestures. underGameView places video below the game canvas and requires a transparent canvas. autoPauseIfNavigate and autoPauseIfOpenNative configure automatic pausing during navigation.

SUDOPVideoControl ​

java
public interface SUDOPVideoControl {

    void setOnEndedListener(SUDOPVideoOnEndedListener listener);

    void setOnErrorListener(SUDOPVideoOnErrorListener listener);

    void setOnPauseListener(SUDOPVideoOnPauseListener listener);

    void setOnPlayListener(SUDOPVideoOnPlayListener listener);

    void setOnProgressListener(SUDOPVideoOnProgressListener listener);

    void setOnTimeUpdateListener(SUDOPVideoOnTimeUpdateListener listener);

    void setOnWaitingListener(SUDOPVideoOnWaitingListener listener);

    void setOnDestroyListener(SUDOPVideoOnDestroyListener listener);

    void setRequestFullScreenListener(SUDOPVideoRequestFullScreenListener listener);

    void setExitFullScreenListener(SUDOPVideoExitFullScreenListener listener);

    boolean isPaused();

    int getDuration();

    int getPosition();

    void pause();

    void play();

    void destroy();

    void seek(int time);

}

Time values in getDuration(), getPosition(), seek(int time), and progress events are in seconds. Full-screen direction: 0 is portrait, 90 is 90 degrees counterclockwise, and -90 is 90 degrees clockwise. Remove the video view and clean up host controls on destruction.

Event interfaces ​

java
public interface SUDOPVideoExitFullScreenListener {
    void exitFullScreen();
}

public interface SUDOPVideoOnDestroyListener {
    void onDestroy();
}

public interface SUDOPVideoOnEndedListener {
    
    void onEnded();
}

public interface SUDOPVideoOnErrorListener {
    void onError(int code, String message);
}

public interface SUDOPVideoOnPauseListener {
    void onPause();
}

public interface SUDOPVideoOnPlayListener {
    
    void onPlay();
}

public interface SUDOPVideoOnProgressListener {
    
    void onProgress(int bufferedTime, int duration);
}

public interface SUDOPVideoOnTimeUpdateListener {
    
    void onTimeUpdate(int currentTime, int duration);
}

public interface SUDOPVideoOnWaitingListener {
    
    void onWaiting();
}

public interface SUDOPVideoRequestFullScreenListener {
    
    void requestFullScreen(int direction);
}