I do not know what is ocurring on your PC, but here LoadFromURL works just fine. I made a small demo that refreshes the url every 10 seconds, which it does... but I do not know how often bbc updates the camera image. It seems like it may be less frequent then 10 seconds but I have no way of knowing for sure.
I ran the demo for severval minutes until I got sick of watching headlights go by. Not much to look at at night. <grin>... I never got an exception while testing the demo even though the url was refreshed over a hundred times.
I do not see a way to attach a zip file in this forum so you can get the demo project. Send me your email and I'll send it along.
Meanwhile here is the code:
// ------------------------------------------------------------------------------
// ImageENViewURL : 1.0
// Copyright (c) 2011 : Copyright Adirondack Software & Graphics
// Created : 07-14-2011
// Last Modification : 07-14-2011
// Description : uMain Unit
// Compiler : Delphi 2010
// This file is copyright (C) W W Miller, 1986-2011.
// It may be used without restriction. This code distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
// ------------------------------------------------------------------------------
unit uMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls, IEView, ImageENView;
type
TForm1 = class( TForm )
Panel1: TPanel;
Button1: TButton;
ImageEnView1: TImageEnView;
StatusBar1: TStatusBar;
Timer1: TTimer;
CheckBox1: TCheckBox;
ProgressBar1: TProgressBar;
Timer2: TTimer;
procedure Button1Click( Sender: TObject );
procedure Timer1Timer( Sender: TObject );
procedure CheckBox1Click( Sender: TObject );
procedure FormCreate( Sender: TObject );
procedure ImageEnView1FinishWork( Sender: TObject );
procedure ImageEnView1Progress( Sender: TObject; per: Integer );
procedure Timer2Timer( Sender: TObject );
private
{ Private declarations }
TimerUpdateInterval: Integer;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click( Sender: TObject );
var
AURL: string;
begin
Screen.Cursor := crHourglass;
try
// AURL := 'http://www.bbc.co.uk/travelnews/suffolk/trafficcameras/highwaysagency/56496/image/?enabled=1&asset=56496.jpg&epoch=1310540660Žion=suffolk&cachebuster=1310541125919';
AURL := 'http://www.bbc.co.uk/travelnews/devon/trafficcameras/highwaysagency/43001/image/?region=devon&epoch=1310630764&asset=49566.jpg&enabled=1&cachebuster=1310630764';
ImageEnView1.IO.LoadFromURL( AURL );
ImageEnView1.Update;
StatusBar1.Panels[ 0 ].Text := AURL;
StatusBar1.Panels[ 0 ].Text := AURL;
TimerUpdateInterval := 10;
StatusBar1.Panels[ 1 ].Text := 'Click the enabled checkbox to update every 10 seconds';
finally
Screen.Cursor := crDefault;
end;
end;
procedure TForm1.CheckBox1Click( Sender: TObject );
var
AURL: string;
begin
Timer1.Enabled := CheckBox1.Checked;
if CheckBox1.Checked then
begin
Screen.Cursor := crHourglass;
try
// AURL := 'http://www.bbc.co.uk/travelnews/suffolk/trafficcameras/highwaysagency/56496/image/?enabled=1&asset=56496.jpg&epoch=1310540660Žion=suffolk&cachebuster=1310541125919';
AURL := 'http://www.bbc.co.uk/travelnews/devon/trafficcameras/highwaysagency/43001/image/?region=devon&epoch=1310630764&asset=49566.jpg&enabled=1&cachebuster=1310630764';
ImageEnView1.IO.LoadFromURL( AURL );
ImageEnView1.Update;
TimerUpdateInterval := 10;
StatusBar1.Panels[ 0 ].Text := AURL;
StatusBar1.Panels[ 1 ].Text := 'Next Refresh In: ' + IntToStr( TimerUpdateInterval ) + ' seconds';
finally
Screen.Cursor := crDefault;
end;
end
else
StatusBar1.Panels[ 1 ].Text := '';
Timer2.Enabled := CheckBox1.Checked;
end;
procedure TForm1.FormCreate( Sender: TObject );
begin
Timer1.Enabled := False;
Timer2.Enabled := False;
TimerUpdateInterval := 10;
end;
procedure TForm1.ImageEnView1FinishWork( Sender: TObject );
begin
ProgressBar1.Position := 0;
end;
procedure TForm1.ImageEnView1Progress( Sender: TObject; per: Integer );
begin
ProgressBar1.Position := per;
end;
procedure TForm1.Timer1Timer( Sender: TObject );
// load the url every 10 seconds
var
AURL: string;
begin
Screen.Cursor := crHourglass;
try
// AURL := 'http://www.bbc.co.uk/travelnews/suffolk/trafficcameras/highwaysagency/56496/image/?enabled=1&asset=56496.jpg&epoch=1310540660Žion=suffolk&cachebuster=1310541125919';
AURL := 'http://www.bbc.co.uk/travelnews/devon/trafficcameras/highwaysagency/43001/image/?region=devon&epoch=1310630764&asset=49566.jpg&enabled=1&cachebuster=1310630764';
TimerUpdateInterval := 10;
ImageEnView1.IO.LoadFromURL( AURL );
ImageEnView1.Update;
StatusBar1.Panels[ 0 ].Text := AURL;
Timer2.Enabled := True;
finally
Screen.Cursor := crDefault;
end;
end;
procedure TForm1.Timer2Timer( Sender: TObject );
// show the elapsed time every second
begin
Dec( TimerUpdateInterval );
StatusBar1.Panels[ 1 ].Text := 'Next Refresh In: ' + IntToStr( TimerUpdateInterval + 1 ) + ' seconds';
end;
end.
William Miller