@jxstjh/jhvideo
Version:
HTML5 jhvideo base on MPEG2-TS Stream Player
127 lines (118 loc) • 3.75 kB
text/typescript
export type DeviceType = 'pvg67' | 'pvgplus' | 'rtsp' | 'gb28181';
export type ProtocolType = 'httpflv' | 'websocketflv' | 'hls' | 'webrtc';
export type Streamtype = 'vod' | 'live';
export enum BarItemType {
BTN = 'btn',
LABEL = 'label'
}
export enum PlayerMode {
DESKTOP = 'desktop',
MOBILE = 'mobile'
}
export interface ToolBarItem {
type: BarItemType;
label?: string;
icon?: string;
className?: string;
cmd?: string;
cb?: Function;
tip?: string;
}
export interface shapeItem {
x: number;
y: number;
}
export interface StreamOpt {
// user: string; // Pvg/gb登录用户名
// password: string; // pvg/gb登录密码
// ip: string; // pvg/gb的 ip
// port: string; // pvg / gb端口
// channel: string; // pvg/gb通道号, pvm中的id。pvgplus可在末尾用#传入媒体参数, 包括video、audio、profile, 具体取值: video:H264 H265 MPEG4;audio:AAC G711 G726 G729;profile:CIF D1 HD 0 1 2 三种媒体参数任意组合,无先后顺序,例如 #D1、#H264#HD#G711、#G711#HD#H264, profile中的0、1、2、...代表主子码流
aisleId: string; // 通道业务主键
passage:string // 主/副码流
title?: string; // 通道名称
url?: string; // Rtsp的地址
sipServerId?: string; // 国标网关id
streamtype?: Streamtype;
deviceType?: DeviceType;
protocolType?: ProtocolType;
protocol:'ws'|'wss'
isptz?: boolean; // 是否云台控制
beginTime?: string; // 录像开始时间
endTime?: string; // 录像结束时间
vod?: number; // 录像存储类型: 0:服务录像 1~255:设备录像,
headerToolBar?: Array<ToolBarItem>, // header toolbae
footerToolBar?: Array<ToolBarItem>, // footer toolbae
hideHeaderToolBar?: boolean; // 是否隐藏对应工具栏
hideFooterToolBar?: boolean; // 是否隐藏对应工具栏
enableWorker?: boolean; // 是否启用web worker,
workerPath?: 'static/'; // h265 解码文件根相对路径
isDraw?:boolean,
shape?:Array<shapeItem>,
isTalk?:boolean,
autoTalk?:boolean,
autoAudio?:boolean,
dateTime?:string,
}
export interface ControllerOpt {
hideTools?: boolean; // 是否隐藏工具栏
}
export const defaultStreamOpt = {
// user: 'admin',
passage: '0',
deviceType: "pvgplus",
isptz: false,
// password: "a123456",
protocolType: "websocketflv",
protocol:'ws',
streamtype: "live",
footerToolBar: [],
headerToolBar: [],
enableWorker: false,
autoAudio: true,
isDraw: false,
isTalk: true
};
export const defaultControllerOpt: ControllerOpt = {
hideTools: true
};
export const createDefaultStreamOpt = () => {
const url = window.location.protocol;
const protocol = url === 'https:' ? 'wss' : 'ws'
return Object.assign({}, {...defaultStreamOpt, protocol});
}
export const createDefaultControllerOpt = () => {
return Object.assign({}, defaultControllerOpt);
}
export type StreamSpeed = -3 | -2 | -1| 0 | 1 | 2 | 3;
export interface PTZParam {
streamId?: string; // 流id
cmd: number;
value: number;
}
export enum JPEvent {
DESTROY = 'destroy',
INITED = 'inited',
CREATED = 'created',
SEEKED = 'seeked',
PLAY = 'play',
CANPLAY= 'canPlay',
PAUSE = 'pause',
ERROR = 'error',
CLOSE = 'close',
FullScreen = 'fullScreen',
SCREENSHOT = 'screenshot',
}
export enum StyleSize {
XS = 'xs',
SM = 'sm',
MD = 'md',
LG = 'lg',
}
export enum Direction {
TL = 1,
TR = 2,
DR = 3,
DL = 4,
NAN = 0
}