weblive外部播放器使用原始地址
This commit is contained in:
@@ -59,7 +59,10 @@ export async function GET(request: NextRequest) {
|
|||||||
const streamUrl = `${sFlvUrl}/${sStreamName}.${sFlvUrlSuffix}?${newAntiCode}`;
|
const streamUrl = `${sFlvUrl}/${sStreamName}.${sFlvUrlSuffix}?${newAntiCode}`;
|
||||||
const proxyUrl = `/api/web-live/proxy/proxy.flv?url=${encodeURIComponent(streamUrl)}`;
|
const proxyUrl = `/api/web-live/proxy/proxy.flv?url=${encodeURIComponent(streamUrl)}`;
|
||||||
|
|
||||||
return NextResponse.json({ url: proxyUrl });
|
return NextResponse.json({
|
||||||
|
url: proxyUrl,
|
||||||
|
originalUrl: streamUrl
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return NextResponse.json({ error: '不支持的平台' }, { status: 400 });
|
return NextResponse.json({ error: '不支持的平台' }, { status: 400 });
|
||||||
|
|||||||
+14
-12
@@ -18,6 +18,7 @@ export default function WebLivePage() {
|
|||||||
const [sources, setSources] = useState<any[]>([]);
|
const [sources, setSources] = useState<any[]>([]);
|
||||||
const [currentSource, setCurrentSource] = useState<any | null>(null);
|
const [currentSource, setCurrentSource] = useState<any | null>(null);
|
||||||
const [videoUrl, setVideoUrl] = useState('');
|
const [videoUrl, setVideoUrl] = useState('');
|
||||||
|
const [originalVideoUrl, setOriginalVideoUrl] = useState('');
|
||||||
const [activeTab, setActiveTab] = useState<'rooms' | 'platforms'>('rooms');
|
const [activeTab, setActiveTab] = useState<'rooms' | 'platforms'>('rooms');
|
||||||
const [isChannelListCollapsed, setIsChannelListCollapsed] = useState(false);
|
const [isChannelListCollapsed, setIsChannelListCollapsed] = useState(false);
|
||||||
const [isVideoLoading, setIsVideoLoading] = useState(false);
|
const [isVideoLoading, setIsVideoLoading] = useState(false);
|
||||||
@@ -119,6 +120,7 @@ export default function WebLivePage() {
|
|||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
setVideoUrl(data.url);
|
setVideoUrl(data.url);
|
||||||
|
setOriginalVideoUrl(data.originalUrl || data.url);
|
||||||
} else {
|
} else {
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
setErrorMessage(data.error || '获取直播流失败');
|
setErrorMessage(data.error || '获取直播流失败');
|
||||||
@@ -321,8 +323,8 @@ export default function WebLivePage() {
|
|||||||
<button
|
<button
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (videoUrl) {
|
if (originalVideoUrl) {
|
||||||
window.open(`potplayer://${videoUrl}`, '_blank');
|
window.open(`potplayer://${originalVideoUrl}`, '_blank');
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
className='group relative flex items-center justify-center gap-1 w-8 h-8 lg:w-auto lg:h-auto lg:px-2 lg:py-1.5 bg-white hover:bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 text-xs font-medium rounded-md transition-all duration-200 shadow-sm hover:shadow-md cursor-pointer overflow-hidden border border-gray-300 dark:border-gray-600 flex-shrink-0'
|
className='group relative flex items-center justify-center gap-1 w-8 h-8 lg:w-auto lg:h-auto lg:px-2 lg:py-1.5 bg-white hover:bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 text-xs font-medium rounded-md transition-all duration-200 shadow-sm hover:shadow-md cursor-pointer overflow-hidden border border-gray-300 dark:border-gray-600 flex-shrink-0'
|
||||||
@@ -342,8 +344,8 @@ export default function WebLivePage() {
|
|||||||
<button
|
<button
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (videoUrl) {
|
if (originalVideoUrl) {
|
||||||
window.open(`vlc://${videoUrl}`, '_blank');
|
window.open(`vlc://${originalVideoUrl}`, '_blank');
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
className='group relative flex items-center justify-center gap-1 w-8 h-8 lg:w-auto lg:h-auto lg:px-2 lg:py-1.5 bg-white hover:bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 text-xs font-medium rounded-md transition-all duration-200 shadow-sm hover:shadow-md cursor-pointer overflow-hidden border border-gray-300 dark:border-gray-600 flex-shrink-0'
|
className='group relative flex items-center justify-center gap-1 w-8 h-8 lg:w-auto lg:h-auto lg:px-2 lg:py-1.5 bg-white hover:bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 text-xs font-medium rounded-md transition-all duration-200 shadow-sm hover:shadow-md cursor-pointer overflow-hidden border border-gray-300 dark:border-gray-600 flex-shrink-0'
|
||||||
@@ -363,8 +365,8 @@ export default function WebLivePage() {
|
|||||||
<button
|
<button
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (videoUrl) {
|
if (originalVideoUrl) {
|
||||||
window.open(`mpv://${videoUrl}`, '_blank');
|
window.open(`mpv://${originalVideoUrl}`, '_blank');
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
className='group relative flex items-center justify-center gap-1 w-8 h-8 lg:w-auto lg:h-auto lg:px-2 lg:py-1.5 bg-white hover:bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 text-xs font-medium rounded-md transition-all duration-200 shadow-sm hover:shadow-md cursor-pointer overflow-hidden border border-gray-300 dark:border-gray-600 flex-shrink-0'
|
className='group relative flex items-center justify-center gap-1 w-8 h-8 lg:w-auto lg:h-auto lg:px-2 lg:py-1.5 bg-white hover:bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 text-xs font-medium rounded-md transition-all duration-200 shadow-sm hover:shadow-md cursor-pointer overflow-hidden border border-gray-300 dark:border-gray-600 flex-shrink-0'
|
||||||
@@ -384,9 +386,9 @@ export default function WebLivePage() {
|
|||||||
<button
|
<button
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (videoUrl) {
|
if (originalVideoUrl) {
|
||||||
window.open(
|
window.open(
|
||||||
`intent://${videoUrl}#Intent;package=com.mxtech.videoplayer.ad;S.title=${encodeURIComponent(
|
`intent://${originalVideoUrl}#Intent;package=com.mxtech.videoplayer.ad;S.title=${encodeURIComponent(
|
||||||
currentSource?.name || '直播'
|
currentSource?.name || '直播'
|
||||||
)};end`,
|
)};end`,
|
||||||
'_blank'
|
'_blank'
|
||||||
@@ -410,8 +412,8 @@ export default function WebLivePage() {
|
|||||||
<button
|
<button
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (videoUrl) {
|
if (originalVideoUrl) {
|
||||||
window.open(`nplayer-${videoUrl}`, '_blank');
|
window.open(`nplayer-${originalVideoUrl}`, '_blank');
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
className='group relative flex items-center justify-center gap-1 w-8 h-8 lg:w-auto lg:h-auto lg:px-2 lg:py-1.5 bg-white hover:bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 text-xs font-medium rounded-md transition-all duration-200 shadow-sm hover:shadow-md cursor-pointer overflow-hidden border border-gray-300 dark:border-gray-600 flex-shrink-0'
|
className='group relative flex items-center justify-center gap-1 w-8 h-8 lg:w-auto lg:h-auto lg:px-2 lg:py-1.5 bg-white hover:bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 text-xs font-medium rounded-md transition-all duration-200 shadow-sm hover:shadow-md cursor-pointer overflow-hidden border border-gray-300 dark:border-gray-600 flex-shrink-0'
|
||||||
@@ -431,9 +433,9 @@ export default function WebLivePage() {
|
|||||||
<button
|
<button
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (videoUrl) {
|
if (originalVideoUrl) {
|
||||||
window.open(
|
window.open(
|
||||||
`iina://weblink?url=${encodeURIComponent(videoUrl)}`,
|
`iina://weblink?url=${encodeURIComponent(originalVideoUrl)}`,
|
||||||
'_blank'
|
'_blank'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user