更新:课程视频播放改成原生video组件
This commit is contained in:
@@ -1,35 +1,24 @@
|
||||
// api/modules/video.ts
|
||||
/**
|
||||
* 视频相关 API
|
||||
* 完全保持原项目接口路径和调用方式
|
||||
*/
|
||||
|
||||
import { createRequestClient } from '../request'
|
||||
import { SERVICE_MAP } from '../config'
|
||||
import type {
|
||||
ICheckVideoRequest,
|
||||
ICheckVideoResponse,
|
||||
ISaveCoursePositionRequest,
|
||||
ISaveCoursePositionResponse,
|
||||
IAddErrorCourseRequest,
|
||||
IAddErrorCourseResponse
|
||||
} from '@/types/video'
|
||||
import type { IApiResponse } from '../types'
|
||||
import type { IVideoCheckResponse } from '@/types/video'
|
||||
|
||||
const client = createRequestClient({ baseURL: SERVICE_MAP.MAIN })
|
||||
|
||||
/**
|
||||
* 视频相关 API
|
||||
* 视频相关API
|
||||
*/
|
||||
export const videoApi = {
|
||||
/**
|
||||
* 检查视频并获取播放凭证
|
||||
* 原接口: sociology/course/checkVideo
|
||||
*
|
||||
* @param data 视频信息(id, video, courseId, catalogueId, chapterId 等)
|
||||
* @returns 视频详细信息,包含 playAuth, videoId, m3u8Url, videoUrl 等
|
||||
* 获取视频播放信息
|
||||
* 接口: sociology/course/checkVideo
|
||||
* 方法: POST
|
||||
*/
|
||||
checkVideo(data: ICheckVideoRequest) {
|
||||
return client.request<ICheckVideoResponse>({
|
||||
checkVideo(data: {
|
||||
id: number
|
||||
}) {
|
||||
return client.request<IVideoCheckResponse>({
|
||||
url: 'sociology/course/checkVideo',
|
||||
method: 'POST',
|
||||
data
|
||||
@@ -37,14 +26,15 @@ export const videoApi = {
|
||||
},
|
||||
|
||||
/**
|
||||
* 保存课程播放位置
|
||||
* 原接口: sociology/course/saveCoursePosition
|
||||
*
|
||||
* @param data 包含 videoId 和 position(秒数)
|
||||
* @returns 保存结果
|
||||
* 保存播放进度
|
||||
* 接口: sociology/course/saveCoursePosition
|
||||
* 方法: POST
|
||||
*/
|
||||
saveCoursePosition(data: ISaveCoursePositionRequest) {
|
||||
return client.request<ISaveCoursePositionResponse>({
|
||||
saveCoursePosition(data: {
|
||||
videoId: number
|
||||
position: number
|
||||
}) {
|
||||
return client.request<IApiResponse>({
|
||||
url: 'sociology/course/saveCoursePosition',
|
||||
method: 'POST',
|
||||
data
|
||||
@@ -52,14 +42,16 @@ export const videoApi = {
|
||||
},
|
||||
|
||||
/**
|
||||
* 记录 iOS 不支持的视频
|
||||
* 原接口: medical/course/addErrorCourse
|
||||
*
|
||||
* @param data 包含 chapterId, videoId, sort
|
||||
* @returns 记录结果
|
||||
* 报告错误视频
|
||||
* 接口: medical/course/addErrorCourse
|
||||
* 方法: POST
|
||||
*/
|
||||
addErrorCourse(data: IAddErrorCourseRequest) {
|
||||
return client.request<IAddErrorCourseResponse>({
|
||||
addErrorCourse(data: {
|
||||
chapterId: number
|
||||
videoId: number
|
||||
sort: number
|
||||
}) {
|
||||
return client.request<IApiResponse>({
|
||||
url: 'medical/course/addErrorCourse',
|
||||
method: 'POST',
|
||||
data
|
||||
|
||||
Reference in New Issue
Block a user