@pano.video/panortc-react-native-sdk
Version:
PanoRtc SDK For React Native
266 lines (265 loc) • 8.61 kB
TypeScript
import type { RefObject } from 'react';
import { ResultCode, WBFontStyle, WBRoleType, WBToolType } from './Enums';
import type { WBColor } from './Objects';
import type { RtcAnnotationEventHandler, Subscription } from './RtcEvents';
import type { RtcSurfaceView } from './RtcRenderView.native';
/**
* The {@link RtcAnnotation} class.
*/
export default class RtcAnnotation implements RtcAnnotationInterface {
/**
* The ID of RtcAnnotation
*/
readonly annotationId: string;
/**
* @ignore
*/
private _listeners;
/**
* @ignore
*/
constructor(annotationId: string);
/**
* @ignore
*/
private _callMethod;
/**
* @ignore
*/
destroy(): void;
/**
* Adds the [`RtcAnnotationEventHandler`]{@link RtcAnnotationEventHandler} handler.
*
* After setting the [`RtcAnnotationEventHandler`]{@link RtcAnnotationEventHandler} handler, you can listen for annotation events and receive the statistics of the corresponding [`RtcAnnotation`]{@link RtcAnnotation} instance.
* @param event The event type.
* @param listener The [`RtcAnnotationEventHandler`]{@link RtcAnnotationEventHandler} handler.
*/
addListener<EventType extends keyof RtcAnnotationEventHandler>(event: EventType, listener: RtcAnnotationEventHandler[EventType]): Subscription;
/**
* Removes the [`RtcAnnotationEventHandler`]{@link RtcAnnotationEventHandler} handler.
*
* For callback events that you only want to listen for once, call this method to remove the specific [`RtcEngineEvents`]{@link RtcEngineEvents} objects after you have received them.
* @param event The event type.
* @param listener The [`RtcAnnotationEventHandler`]{@link RtcAnnotationEventHandler} handler.
*/
removeListener<EventType extends keyof RtcAnnotationEventHandler>(event: EventType, listener: RtcAnnotationEventHandler[EventType]): void;
/**
* Removes all the [`RtcAnnotationEventHandler`]{@link RtcAnnotationEventHandler} handlers.
* @param event The event type.
*/
removeAllListeners<EventType extends keyof RtcAnnotationEventHandler>(event?: EventType): void;
/**
* @~english
* @brief Start the annotation.
* @param view The annotation display view provided by customer.
* @return
* - ResultCode.OK: Success
* - others: Failure
* @~chinese
* @brief 开始标注。
* @param view 客户提供的标注显示视图。
* @return
* - ResultCode.OK: 成功
* - 其他: 失败
*/
startAnnotation(view: RefObject<RtcSurfaceView>): Promise<ResultCode>;
/**
* @~english
* @brief Stop the annotation.
* @return
* - ResultCode.OK: Success
* - Others: Fail
* @~chinese
* @brief 停止标注
* @return
* - ResultCode.OK: 成功
* - 其他: 失败
*/
stopAnnotation(): Promise<ResultCode>;
/**
* @~english
* @brief Set annotation view visible/invisible.
* @param visible visible or not
* @return
* - ResultCode.OK: Success
* - Others: Fail
* @note annotation view is visible default
* @~chinese
* @brief 设置标注视图是否可见
* @param visible 是否可见
* @return
* - ResultCode.OK: 成功
* - 其他: 失败
* @note 标注视图默认是可见的
*/
setVisible(visible: boolean): Promise<ResultCode>;
/**
* @~english
* @brief Set annotation role type.
* @param type The annotation role type, PanoWBToolType enum type.
* @return
* - ResultCode.OK: Success
* - others: Failure
* @~chinese
* @brief 设置标注角色类型。
* @param type 标注角色,PanoWBRoleType 枚举类型。
* @return
* - ResultCode.OK: 成功
* - 其他: 失败
*/
setRoleType(type: WBRoleType): Promise<ResultCode>;
/**
* @~english
* @brief Set the annotation tool.
* @param type PanoWBToolType enum type.
* @return
* - ResultCode.OK: Success
* - others: Failure
* @~chinese
* @brief 设置标注工具。
* @param view PanoWBToolType 枚举类型。
* @return
* - ResultCode.OK: 成功
* - 其他: 失败
*/
setToolType(type: WBToolType): Promise<ResultCode>;
/**
* @~english
* @brief Set the annotation line width.
* @param width Valid value range: [1, 20].
* @return
* - ResultCode.OK: Success
* - others: Failure
* @~chinese
* @brief 设置标注线条宽度。
* @param width 有效值范围:[1, 20]。
* @return
* - ResultCode.OK: 成功
* - 其他: 失败
*/
setLineWidth(size: number): Promise<ResultCode>;
/**
* @~english
* @brief Set the annotation color.
* @param color PanoWBColor object.
* @return
* - ResultCode.OK: Success
* - others: Failure
* @~chinese
* @brief 设置标注颜色。
* @param color PanoWBColor 对象。
* @return
* - ResultCode.OK: 成功
* - 其他: 失败
*/
setColor(color: WBColor): Promise<ResultCode>;
/**
* @~english
* @brief Set the annotation font style.
* @param style PanoWBFontStyle enum type.
* @return
* - ResultCode.OK: Success
* - others: Failure
* @~chinese
* @brief 设置标注字体样式。
* @param color PanoWBFontStyle 枚举类型。
* @return
* - ResultCode.OK: 成功
* - 其他: 失败
*/
setFontStyle(style: WBFontStyle): Promise<ResultCode>;
/**
* @~english
* @brief Set the font size.
* @param size Valid value range: [10, 96].
* @return
* - ResultCode.OK: Success
* - others: Failure
* @~chinese
* @brief 设置字体大小。
* @param size 有效值范围:[10, 96]。
* @return
* - ResultCode.OK: 成功
* - 其他: 失败
*/
setFontSize(size: number): Promise<ResultCode>;
/**
* @~english
* @brief Undo the last operation of the annotation.
* @return
* - ResultCode.OK: Success
* - others: Failure
* @~chinese
* @brief 撤销标注上一次操作。
* @return
* - ResultCode.OK: 成功
* - 其他: 失败
*/
undo(): Promise<ResultCode>;
/**
* @~english
* @brief Redo the last undone operation of the annotation.
* @return
* - ResultCode.OK: Success
* - others: Failure
* @~chinese
* @brief 重做标注的上一次被撤销操作。
* @return
* - ResultCode.OK: 成功
* - 其他: 失败
*/
redo(): Promise<ResultCode>;
/**
* @~english
* @brief clear annotation content by specific user ID
* @param userId user ID
* @return
* - ResultCode.OK: Success
* - Others: Fail
* @note If the user isn't current user, the operation requires admin role.
* @~chinese
* @brief 清除指定用户绘制的标注内容
* @param userId 用户ID
* @return
* - OK: 成功
* - Others: 失败
* @note 如果指定用户不是当前用户,此操作需要管理员角色。
*/
clearUserContents(userId: string): Promise<ResultCode>;
/**
* @~english
* @brief clear annotation content
* @return
* - ResultCode.OK: Success
* - Others: Fail
* @note The operation requires admin role.
* @~chinese
* @brief 清除标注内容
* @return
* - OK: 成功
* - Others: 失败
* @note 此操作需要管理员角色。
*/
clearContents(): Promise<ResultCode>;
snapshot(outputDir: string): Promise<ResultCode>;
}
/**
* @ignore
*/
interface RtcAnnotationInterface {
startAnnotation(view: RefObject<RtcSurfaceView>): Promise<ResultCode>;
stopAnnotation(): Promise<ResultCode>;
setVisible(visible: boolean): Promise<ResultCode>;
setRoleType(type: WBRoleType): Promise<ResultCode>;
setToolType(type: WBToolType): Promise<ResultCode>;
setLineWidth(size: number): Promise<ResultCode>;
setColor(color: WBColor): Promise<ResultCode>;
setFontStyle(style: WBFontStyle): Promise<ResultCode>;
setFontSize(size: number): Promise<ResultCode>;
undo(): Promise<ResultCode>;
redo(): Promise<ResultCode>;
clearUserContents(userId: string): Promise<ResultCode>;
clearContents(): Promise<ResultCode>;
snapshot(outputDir: string): Promise<ResultCode>;
}
export {};