HTML / Javascript:如何从其他网站添加实时视频流

时间:2013-05-26 04:25:40

标签: javascript html video-streaming live-streaming

我目前正在尝试将来自其他网站的实时视频流添加到我自己的视频流中以方便使用,似乎无法让它工作。我已经使用select和options编写了一个droplist,选择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>
    }

提前感谢你!

1 个答案:

答案 0 :(得分:1)

当你更改选项时,它会向服务器创建一个请求:

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