Canvas
This class provides methods for video rendering.
class Canvas { public: Canvas(Rte *rte, CanvasInitialConfig *initial_config); bool GetConfigs(CanvasConfig *config, Error *err); bool SetConfigs(CanvasConfig *config, Error *err); bool AddView(View *view, ViewConfig *config, rte::Error *err) bool RemoveView(View *view, ViewConfig *config, rte::Error *err); };
- Since
- v4.5.0
Method
- Canvas
- Creates a Canvas object. See Canvas.
- SetConfigs [3/3]
- Sets the vide render mode. See SetConfigs [3/3].
- GetConfigs [3/3]
- Gets the current video render mode. See GetConfigs [3/3].
- AddView
- Adds a view. See AddView.
- RemoveView
- Removes a view. See RemoveView.
AddView
Adds a view to be rendered.
bool AddView(View *view, ViewConfig *config, rte::Error *err)
- Since
- v4.5.0
Applicable scenarios
When you need to use a player to play a video, you can call this method to add a view to the video renderer for displaying.
Call timing
Call this method after SetCanvas.
Restrictions
Only one view can be added.
Parameters
- view
- HWND window handle value.
- config
- The configuration of View object. Currently, you need to set it to null.
- err
- The state or error information: Error.
Returns
Whether the view is added successfully:
true
: The view is added.false
: The view is not added.
GetConfigs [3/3]
Gets the current video rendering configuration of the player.
bool GetConfigs(CanvasConfig *config, Error *err);
- Since
- v4.5.0
Call timing
Call this method after Canvas.
Restrictions
None.
Parameters
- config
- Canvas object settings. See CanvasConfig.
- err
- The state or error information: Error.
Returns
Whether the RTE object is configured successfully:
true
: Yes.false
: No.
RemoveView
Removes a view.
bool RemoveView(View *view, ViewConfig *config, rte::Error *err);
- Since
- v4.5.0
After you call AddView to add a view, if you need to remove the view, you can call this method.
Call timing
Call this method after AddView.
Restrictions
Only one view can be removed at a time.
Parameters
- view
- View object to be removed.
- config
- The configuration of View object. Currently, you need to set it to null.
- err
- The state or error information: Error.
Returns
Whether the view is removed successfully:
true
: The view is removed.false
: The view is not removed.
SetConfigs [3/3]
Sets the video rendering configuration of the player.
bool SetConfigs(CanvasConfig *config, Error *err);
- Since
- v4.5.0
Call timing
Call this method after OpenWithUrl.
Restrictions
None.
Parameters
- config
- Canvas object settings. See CanvasConfig.
- err
- The state or error information: Error.
Returns
Whether the RTE object is configured successfully:
true
: Yes.false
: No.