gpt4 book ai didi

javascript - HTML/Javascript : How to add a live video stream from another website

转载 作者:行者123 更新时间:2023-11-28 02:13:18 25 4
gpt4 key购买 nike

为了方便起见,我目前正在尝试将来自另一个网站的实时视频流添加到我自己的网站中,但似乎无法使其正常工作。我已经使用 select 和 options 编写了一个下拉列表, select id="select camera"onchange="traffic()。有人可以告诉我下面的脚本做错了什么吗?

function traffic() <br>
{ <br>
location[0] = "<img src='http://131940.qld.gov.au/DMR.Controls/WebCams/DisplayImage.ashx?FilePath=\Metropolitan\mecure.jpg&R=1369294224610' alt='Brisbane City Traffic Camera is Currently Unavailable'width='500' height='400'>"; <br>
location[1] = "<img src='http://131940.qld.gov.au/DMR.Controls/WebCams/DisplayImage.ashx?FilePath=\Metropolitan\Rochedale_Pac_Mwy_Sth.jpg&R=1369294358098' alt='Rochedale Traffic Camera is Currently Unavailable'width='500' height='400'>"; <br>
location[2] = "<b>Select a Traffic Camera</b>" <br>
list=document.getElementById("select camera"); <br>
index=list.selectedIndex; <br>
document.getElementById("traffic").innerHTML=location[index]; <br>
}

提前感谢您!

最佳答案

当您更改选项时,它将创建一个到服务器的请求:

POST:
+ URL:
http://131940.qld.gov.au/DMRServices/WebCam/WebcamService.svc/GetNextRegionImage
+ Data: regionId=104
webcamId=204

它会响应如下内容:

{"d":{"__type":"WebCamDTO:#DMR.Web.DMRServices.WebCam","CurrentId":0,"CurrentIndex":0,"Description":"Toowoomba - Bottom of Range looking East. ","HasRedAlert":true,"RedAlertDescription":"Warrego Highway, Redwood - Congestion: Both Directions - On...","RedAlertLocation":"Darling Downs - REDWOOD","RedAlertTime":"03:00 PM","RedAlertUrl":"\/Regions\/DarlingDowns\/Road-Conditions.aspx?regionId=104&tab=incident","Url":"\/DMR.Controls\/WebCams\/DisplayImage.ashx?FilePath=Darling_Downs\/toowoomba-range-bottom-helidon.jpg"}}

您可以在响应结果中看到

"Url":"\/DMR.Controls\/WebCams\/DisplayImage.ashx?FilePath=Darling_Downs\/toowoomba-range-bottom-helidon.jpg"

这是您需要的图片链接

http://131940.qld.gov.au/DMR.Controls/WebCams/DisplayImage.ashx?FilePath=Darling_Downs/toowoomba-range-bottom-helidon.jpg

关于javascript - HTML/Javascript : How to add a live video stream from another website,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16756237/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com