NERtcVideoView class
用户视频渲染组件。
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- NERtcVideoView
Constructors
-
NERtcVideoView({Key? key, int? uid, bool subStream = false, bool autoAttach = true, ValueListenable<
bool> ? mirrorListenable, NERtcVideoRenderer? renderer, NERtcVideoRendererEventListener? rendererEventLister, NERtcVideoViewFitType fitType = NERtcVideoViewFitType.cover, WidgetBuilder? placeholderBuilder, Color backgroundColor = const Color(0xFF292933)}) -
创建用户视频渲染组件。
const
-
NERtcVideoView.withExternalRenderer({Key? key, int? uid, bool subStream = false, bool autoAttach = true, ValueListenable<
bool> ? mirrorListenable, required NERtcVideoRenderer renderer, NERtcVideoRendererEventListener? rendererEventLister, NERtcVideoViewFitType fitType = NERtcVideoViewFitType.cover, WidgetBuilder? placeholderBuilder, Color backgroundColor = const Color(0xFF292933)}) -
创建用户视频渲染组件。
const
-
NERtcVideoView.withInternalRenderer({Key? key, int? uid, bool subStream = false, ValueListenable<
bool> ? mirrorListenable, NERtcVideoRendererEventListener? rendererEventLister, NERtcVideoViewFitType fitType = NERtcVideoViewFitType.cover, WidgetBuilder? placeholderBuilder, Color backgroundColor = const Color(0xFF292933)}) -
创建用户视频渲染组件。
const
Properties
- autoAttach → bool
-
是否自动绑定画布。如果为 true,则在组件渲染时自动调用 NERtcVideoRenderer.attachToRemoteVideo 或 NERtcVideoRenderer.attachToLocalVideo 绑定画布到指定用户 uid。
final
- backgroundColor → Color
-
视频组件背景色。如果用户视频不能填充整个组件的大小,则上下或左右会有留白,留白部分的颜色由该属性指定。
final
- fitType → NERtcVideoViewFitType
-
视频画布缩放方式。
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
mirrorListenable
→ ValueListenable<
bool> ? -
视频镜像开关。组件会自动监听其修改,并在渲染时打开/关闭镜像。
final
- placeholderBuilder → WidgetBuilder?
-
用户视频渲染可用之前的占位组件。
final
- renderer → NERtcVideoRenderer?
-
视频渲染画布对象。如果为 null,则组件内部会自动创建和管理画布,并在组件销毁时自动释放画布。
开发者也可以通过 NERtcVideoRendererFactory.createVideoRenderer 手动创建一个画布,然后传入该参数,这样可以在多个组件中共享一个画布。
需要注意的是,如果使用了外部画布,开发者需要自己管理画布的生命周期,并在合适的时机 NERtcVideoRenderer.dispose 方法画布,否则会造成内存泄漏。
final
- rendererEventLister → NERtcVideoRendererEventListener?
-
视频渲染事件监听器。
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- subStream → bool
-
指定渲染视频主流还是辅流。
final
- uid → int?
-
指定需要渲染视频的目标用户。如果为 null,则渲染本地视频,否则渲染对应远端用户的视频。
如果渲染的是远端用户视频,需要业务层保证已经通过 NERtcEngine.subscribeRemoteVideoStream 订阅了该用户的视频流,否则会展示黑屏。
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< NERtcVideoView> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited