D-Link IP Cameras for Home > DCS-2330L

Embedding Live Stream in persona web page


i'm trying to embedding live stream from my DCS-2330L into my webpage..
i'm using the following two simple file :
1) mycam.html:
i'm trying to capture live stream from my IPCAM (Dlink DCS-2330L) and embedding it into my weather webpage. i'm using these two simple pieces of code: 1) HTML FILE-->mycam.html:
             <title>My Ip Cam</title>
             <meta charset="utf-8"/>
             <script type="text/javascript" src="https://code.jquery.com/jquery-   3.2.1.min.js"></script>
             <script type="text/javascript" src="mycam.js"></script>
                 <img id="mycam" src="" width='' alt=''/>

2) JS File:
               $(document).ready(function() {
                       function refr(){
                             $("#mycam").attr('src','http://myipcamaddr:portNumber /video1.mjpg');

Hardware:MacBook Pro

both file are in the same folder in this path: /Users/username/Sites/vscode/html/

Everything works fine if i open the html file in a web browser in this way:

but it doesn't work if i try to open the same html file via server web (localhost), in this way:
in this case in the console log of the browser appear repeatedly every 1 sec the following error and near the error the resource url (of my webcam stream...):
           "failed to load resource the server responded with a status of 403 (Forbidden) http://myipcamaddress:portNumber/video1.mjpg"

the problem is not connected to the access credential of my IpCam because as soon as i load the the page in both way :
file:///..etc...     and     http://localhost...etc...    a pop up appear asking me the user and the password of the IpCam. and i type in the right log-in

all the permission of directory and file in the DocumentRoot (for Apache) are correct... infact i tried with other scritps and they works smoothly

i think the problem depends on the fact that the JS file needs to connect to the ipcam url... and for some reason the browser doesn't allow this
(but only when i launch the html file via http://localhost...etc... as above stated, if the html is launched directly
 in this way --> file:///Users/<username>/Sites/vscode/html/mycam.html... everythings works again well)

but i need to show the streaming live via php so i need it to work via http://localhost/...etc... etc..

hope someone could give me some hint!!!

Thanks in advance

Best Regards


Not sure if any of this might be helpful:
http://forums.dlink.com/index.php?topic=50328.0 and http://forums.dlink.com/index.php?topic=64975.0

Unfortunately, both the first and the second example don't work as expected...
they behave as i said in my initial post...:

WORKS FINE if launched via:  file:///path/to/the/htmlfile.html

DON'T WORK if launched via:  http://localhost/etc..etc../htmlfile.html

anyway thanks for the hints



Good Luck.  ;)


[0] Message Index

Go to full version