user2421580
user2421580

Reputation: 25

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

I am currently trying to add live video-streams from another website to my own for convenience and cannot seem to get it to work. I have already written a droplist using select and options, select id="select camera" onchange="traffic(). Could someone please advise what I am doing wrong with the script below?

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>
    }

Thanking you in advance!

Upvotes: 2

Views: 2317

Answers (1)

Mr Jerry
Mr Jerry

Reputation: 1764

when you change in options, it will create a request to server:

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

and it will response something like:

{"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"}}

you can see in response result

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

it is image link which you need

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

Upvotes: 1

Related Questions