211 lines
5.8 KiB
TypeScript
211 lines
5.8 KiB
TypeScript
// types/video.d.ts
|
|
/**
|
|
* 视频相关类型定义
|
|
* 完全基于原项目 medicine_app 的数据结构
|
|
*/
|
|
|
|
import type { IApiResponse } from './book'
|
|
|
|
/**
|
|
* 视频基本信息
|
|
* 对应原项目中的视频数据结构
|
|
*/
|
|
export interface IVideoInfo {
|
|
id: number // 视频 ID
|
|
title: string // 视频标题
|
|
type: '1' | '2' | string // 类型: 1-视频 2-音频
|
|
video?: string // 阿里云视频 ID(原始)
|
|
videoId?: string // 阿里云视频 ID(处理后,移除等号)
|
|
videoUrl?: string // 视频 URL(普通视频)
|
|
m3u8Url?: string | null // M3U8 地址(标准加密)
|
|
playAuth?: string // 播放凭证
|
|
sort?: number // 排序
|
|
chapterId?: number // 章节 ID
|
|
courseId?: number // 课程 ID
|
|
catalogueId?: number // 目录 ID
|
|
userCourseVideoPositionEntity?: {
|
|
position: number // 服务器记录的播放位置(秒)
|
|
}
|
|
[key: string]: any // 允许其他字段
|
|
}
|
|
|
|
/**
|
|
* 视频数据(扩展)
|
|
* 包含播放时间等额外信息
|
|
*/
|
|
export interface IVideoData extends IVideoInfo {
|
|
firstTime?: number // 初始播放时间(秒)
|
|
time?: number // 当前播放时间(秒)
|
|
}
|
|
|
|
/**
|
|
* 本地存储的视频列表项
|
|
* 存储在 localStorage 的 videoOssList 中
|
|
*/
|
|
export interface IVideoStorageItem {
|
|
id: number // 视频 ID
|
|
time: number // 播放时间(秒)
|
|
[key: string]: any // 其他视频信息
|
|
}
|
|
|
|
/**
|
|
* 检查视频请求参数
|
|
* 对应 sociology/course/checkVideo 接口
|
|
*/
|
|
export interface ICheckVideoRequest {
|
|
id?: number // 视频 ID
|
|
video?: string // 视频标识
|
|
courseId?: number // 课程 ID
|
|
catalogueId?: number // 目录 ID
|
|
chapterId?: number // 章节 ID
|
|
[key: string]: any // 允许其他参数
|
|
}
|
|
|
|
/**
|
|
* 检查视频响应
|
|
* 对应 sociology/course/checkVideo 接口返回
|
|
*/
|
|
export interface ICheckVideoResponse extends IApiResponse {
|
|
video: IVideoInfo // 视频信息
|
|
}
|
|
|
|
/**
|
|
* 保存播放位置请求参数
|
|
* 对应 sociology/course/saveCoursePosition 接口
|
|
*/
|
|
export interface ISaveCoursePositionRequest {
|
|
videoId: number // 视频 ID
|
|
position: number // 播放位置(秒)
|
|
}
|
|
|
|
/**
|
|
* 保存播放位置响应
|
|
* 对应 sociology/course/saveCoursePosition 接口返回
|
|
*/
|
|
export interface ISaveCoursePositionResponse extends IApiResponse {
|
|
// 继承基础响应结构
|
|
}
|
|
|
|
/**
|
|
* 记录错误视频请求参数
|
|
* 对应 medical/course/addErrorCourse 接口
|
|
* 用于记录 iOS 不支持的视频
|
|
*/
|
|
export interface IAddErrorCourseRequest {
|
|
chapterId: number // 章节 ID
|
|
videoId: number // 视频 ID
|
|
sort: number // 排序
|
|
}
|
|
|
|
/**
|
|
* 记录错误视频响应
|
|
* 对应 medical/course/addErrorCourse 接口返回
|
|
*/
|
|
export interface IAddErrorCourseResponse extends IApiResponse {
|
|
// 继承基础响应结构
|
|
}
|
|
|
|
/**
|
|
* 章节详情
|
|
* 用于视频列表组件
|
|
*/
|
|
export interface IChapterDetail {
|
|
id: number // 章节 ID
|
|
title: string // 章节标题
|
|
imgUrl?: string // 章节图片
|
|
content?: string // 章节内容
|
|
questions?: string // 思考题
|
|
[key: string]: any // 其他字段
|
|
}
|
|
|
|
/**
|
|
* 平台类型
|
|
*/
|
|
export type PlatformType = 'ios' | 'android' | 'h5' | null
|
|
|
|
/**
|
|
* 屏幕方向类型
|
|
*/
|
|
export type ScreenOrientationType = 'portrait-primary' | 'landscape-primary'
|
|
|
|
/**
|
|
* 播放器配置选项
|
|
* 对应阿里云播放器配置
|
|
*/
|
|
export interface IPlayerOptions {
|
|
id: string // 容器 ID
|
|
width: string // 宽度
|
|
height: string // 高度
|
|
autoplay?: boolean // 自动播放
|
|
playsinline?: boolean // 内联播放
|
|
controlBarVisibility?: 'hover' | 'click' | 'always' // 控制栏显示方式
|
|
useH5Prism?: boolean // 使用 H5 播放器
|
|
qualitySort?: 'asc' | 'desc' // 清晰度排序
|
|
isLive?: boolean // 是否直播
|
|
rePlay?: boolean // 是否重播
|
|
cover?: string // 封面图
|
|
|
|
// 私有加密视频配置
|
|
vid?: string // 视频 ID
|
|
playauth?: string // 播放凭证
|
|
encryptType?: number // 加密类型: 1-私有加密
|
|
playConfig?: {
|
|
EncryptType: string // 加密类型名称
|
|
}
|
|
|
|
// 标准加密/普通视频配置
|
|
source?: string // 视频地址
|
|
|
|
// 组件配置
|
|
components?: Array<{
|
|
name: string
|
|
type: any
|
|
args?: any[]
|
|
}>
|
|
|
|
// 皮肤布局
|
|
skinLayout?: Array<{
|
|
name: string
|
|
align?: string
|
|
x?: number
|
|
y?: number
|
|
children?: Array<{
|
|
name: string
|
|
align?: string
|
|
x?: number
|
|
y?: number
|
|
}>
|
|
}>
|
|
}
|
|
|
|
/**
|
|
* 全屏状态变化数据
|
|
*/
|
|
export interface IScreenChangeData {
|
|
status: boolean // 全屏状态
|
|
primary: ScreenOrientationType // 屏幕方向
|
|
}
|
|
|
|
/**
|
|
* 播放时间记录数据
|
|
*/
|
|
export interface IRecordTimeData {
|
|
time: number // 播放时间(秒)
|
|
status?: string // 播放状态
|
|
}
|
|
|
|
/**
|
|
* 错误提示数据
|
|
*/
|
|
export interface IOpenShowData {
|
|
msg?: string // 错误消息
|
|
}
|
|
|
|
/**
|
|
* 初始化数据
|
|
*/
|
|
export interface IInitData {
|
|
currentVideo: IVideoInfo // 当前视频
|
|
currentVideoList?: IVideoInfo[] // 视频列表
|
|
}
|