javascript
  • html
  • video-streaming
  • live-streaming
  • 2013-05-26 55 views 1 likes 
    1

    我目前試圖從另一個網站添加實時視頻流到我自己的方便,似乎無法得到它的工作。使用選擇和選項,選擇ID =「選擇相機」的onchange =「交通()。可能有人請指教一下我做錯了下文?HTML/Javascript:如何添加從另一個網站的實時視頻流

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

    腳本請多關照我已經寫了droplist !

    +0

    仔細查看該網站提供的API圖片鏈接。 –

    回答

    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 
    
    +0

    所以先生傑裏,你是說我需要將圖像鏈接改爲:
    \\ location [0] =「Brisbane City Traffic Camera is Currently Unavailable」 – user2421580

    +0

    無視以前的評論,我把它的工作!謝謝!! – user2421580

    相關問題