forked from imsyy/SPlayer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
video.js
121 lines (113 loc) · 2.35 KB
/
video.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import axios from "@/utils/request";
/**
* 视频
*/
/**
* 获取指定 MV 的详细信息
* @param {number} mvid - MV ID
*/
export const getVideoDetail = (mvid) => {
return axios({
method: "GET",
url: "/mv/detail",
params: {
mvid,
},
});
};
/**
* 获取指定 MV 的点赞转发评论数
* @param {number} mvid - MV ID
*/
export const getVideoInfo = (mvid) => {
return axios({
method: "GET",
url: "/mv/detail/info",
params: {
mvid,
timestamp: new Date().getTime(),
},
});
};
/**
* 获取指定 MV 的播放地址
* @param {number} id - 要查询的MV ID
* @param {string} [r=null] - 分辨率。默认值为null
*/
export const getVideoUrl = (id, r = null) => {
return axios({
method: "GET",
hiddenBar: true,
url: "/mv/url",
params: {
id,
r,
},
});
};
/**
* 获取与指定 MV 相似的 MV 列表
* @param {number} mvid - 要查询的 MV ID
*/
export const getSimiVideo = (mvid) => {
return axios({
method: "GET",
url: "/simi/mv",
params: {
mvid,
},
});
};
/**
* 收藏/取消收藏视频
* @param {number} t - 操作类型,1为收藏,2为取消收藏
* @param {number} id - 视频id
*/
export const likeVideo = (t, id) => {
return axios({
method: "GET",
url: "/video/sub",
params: {
t,
id,
timestamp: new Date().getTime(),
},
});
};
/**
* 收藏/取消收藏 MV
* @param {number} t - 操作类型,1为收藏,2为取消收藏
* @param {number} mvid - MV id
*/
export const likeMv = (t, mvid) => {
return axios({
method: "GET",
url: "/mv/sub",
params: {
t,
mvid,
timestamp: new Date().getTime(),
},
});
};
/**
* 全部 mv
* @param {string} area - 地区,可选值为全部,内地,港台,欧美,日本,韩国,不填则为全部
* @param {string} type - 类型,可选值为全部,官方版,原生,现场版,网易出品,不填则为全部
* @param {string} order - 排序,可选值为上升最快,最热,最新,不填则为上升最快
* @param {number} [limit=12] - 返回数量,默认12
* @param {number} [offset=0] - 偏移数量,默认0
*/
export const allMv = (area, type, order, limit = 12, offset = 0) => {
return axios({
method: "GET",
url: "/mv/all",
params: {
area,
type,
order,
limit,
offset,
},
});
};