You can accomplish by having a DNS server on your network. (sounds expensive but some routers have the DNS role on them).
Create an A record to match your DDNS record but to point to the internal IP instead. This way when you are inside your network the router will send your request to the DVR internal IP.
Ex:
DDNS Record. MyDVR.ddns.org points to 1.1.1.1 (my WAN IP)
Internal DNS Record. MyDVR,ddns.org points to 192.168.1.1 (My DVR LAN IP)
When connected everywhere on the internet. your MyDVR.ddns.org URL will resolve 1.1.1.1 so it will connect to your WAN IP and NAT will forward to your DVR.
When connected whiting your LAN. your MyDVR.ddns.org URL will resolve 192.168.1.1 So it will connect directly to your DVR.
Some router also allows to create firewall rules to route the traffic back to the DVR but in some instances this create a risk that can be exploited by pentesting software.
You'll need to point a domain name to your IP address (assuming your home IP is static). This does raise concerns about security though which you will need to read up on. – Dave – 2013-09-30T08:15:21.163
Thanks, but I'm not sure if that would work. I'm already using DDNS to point a particular domain name to my public IP. And when I'm home, I'm still unable to access my IP camera using that domain name (and thus the need for the additional config of 192.168.1.2:8888 for local access). – silvernightstar – 2013-09-30T09:10:29.767
So, your public IP is pointing at your local computer yes? – Dave – 2013-09-30T09:21:37.870
1Seems like it's an issue with your home router. I know some of those doesn't allow hairpin connections (connections from inside to the public interface of the router). – Kent – 2013-09-30T10:06:54.350
@DaveRook no, only public IP's port 8888 is being forwarded to 192.168.1.2:8888 (the IP camera) – silvernightstar – 2013-10-01T04:33:49.480
@Kent Would you know of a resource where I could check whether my particular modem (Prolink ) supports hairpin connections? (I've checked that my router does) – silvernightstar – 2013-10-01T04:41:46.840
@silvernightstar: I don't know of any resources about specific router models. I only know there are some routers, in a general context, that doesn't allow hairpin connections. – Kent – 2013-10-01T12:08:38.243