m3u8视频播放器
m3u8播放器支持播放网络上所有主流音视频格式文件。例如:m3u8、hls、dash、flv、webtorrent、mp4等
接口地址
https://api.nxvav.cn/api/m3u8/
请求示例
shell
curl https://api.nxvav.cn/api/m3u8 -X POST -d 'url=https://ghfast.top/https://raw.githubusercontent.com/nuoxi4n/Demo_Video/refs/heads/main/hls/Merry_Christmas_Mr.Lawrence/Merry_Christmas_Mr.Lawrence.m3u8'
php
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.nxvav.cn/api/m3u8/?url=https://ghfast.top/https://raw.githubusercontent.com/nuoxi4n/Demo_Video/refs/heads/main/hls/Merry_Christmas_Mr.Lawrence/Merry_Christmas_Mr.Lawrence.m3u8',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
请求参数
参数名 | 类型 | 必填 | 说明 |
---|---|---|---|
url | string | 是 | 视频直链,支持 hls、dash、flv、webtorrent、mp4 等格式 |
type | string | 否 | 视频类型,可选值auto ,hls ,flv ,dash ,webtorrent ,normal 。不填默认auto |
cover | string | 否 | 视频封面图片直链链接 |
autoplay | boolean | 否 | 自动播放,可选值true ,false 。不填默认false |
live | boolean | 否 | 直播模式,可选值true ,false 。不填默认false |
loop | boolean | 否 | 循环播放,可选值true ,false 。不填默认false |
返回参数
返回参数 | 类型 | 说明 |
---|---|---|
HTML | text/html | 网页播放器 |
返回示例
text
Content-Type: text/html
Url: https://api.nxvav.cn/api/m3u8/?url=https://ghfast.top/https://raw.githubusercontent.com/nuoxi4n/Demo_Video/refs/heads/main/mp4/No_Doubt.mp4
json
{
"code": 201,
"msg": "视频地址无效"
}