PDA

View Full Version : Autoplay crashes when project is on a non writable support (CD or locked USB key)


slbreizh
10-10-2007, 03:27 PM
Hi,
My project plays a DIVX movie. It could run on a computer without the adequate codec. I rely on the Video.Load(..) method to give me an error if the divx codec is not installed. If Video.Load(...) gives me an error (usually 1001), I propose a page to the user to install the codec (embedded in my application).
This works perfectly if I export my project in a folder on my HDD or on a USB key. But Video.Load(....) forces Autoplay runtime to crash violently with a "Unhandled Win32 exception" if my project is burned on a CD or if I lock my USB key for writting !!!!
I've noticed that when Video.Load(...) starts on a PC without the Divx codec a file called 'adv1.err' is created on the root of the project (with nothing in it). I can imagine that if you do that on a non writable support it could create big troubles and I'm pretty sure it is the cause of the crash. But why would you do that?
Please tell how to avoid that? Is it a project setting or a bug?
I'm using Autoplay V6.0.5.0 on Windows XP.
I'm in the process of evaluating softwares for CD autoplay for my company.

Here is my code for the OnShow event of my single page (nothing else in my project so far):

Debug.ShowWindow(true);
Debug.SetTraceMode(true);
Dialog.Message("Test", "File exists?");
if (File.DoesExist("\\Autoplay\\Videos\\myvideo.avi")) then
Dialog.Message("Load", "Load myvideo.. ");
Video.Load("Video1", "\\AutoPlay\\Videos\\myvideo.avi", false, false);
else
Video.Load("Video1", "\\AutoPlay\\Videos\\missing.mpg", false, false);
end
error_code = Application.GetLastError();
if (error_code ~= 0) then
Dialog.Message("Error", "Load Error: "..error_code);
-- propose here to install codec --
else
Video.Play("Video1");
error_code = Application.GetLastError();
if (error_code ~= 0) then
--Dialog.Message("Error", "Play Error: "..error_code);
end
end

RizlaUK
10-10-2007, 03:38 PM
i think, in this case you would be better off checking for the codecs presence on the users system,

if the missing codec is causing the app to crash violently then you need to beef up your error checking, just use "File.DoesExist" to check for the codecs presence

EDIT: Also you can slim your code down a bit by using
if (File.DoesExist("\\PATH\\TO\\CODEC") ) then
Video.Load("Video1", "\\AutoPlay\\Videos\\myvideo.avi", true, false);
else
-- propose here to install codec --
end

slbreizh
10-10-2007, 04:05 PM
Thanks but two things.
First, detecting if a codec is installed on a Windows system is not as obvious as checking if a file is on the system. You need to read the registry and it depends of the Windows version (XP, Vista...). Unless you have a recipe that I'd love to know.
Second, and most important, why this line of code:
Video.Load("Video1", "\\AutoPlay\\Videos\\myvideo.avi", true, false);
works perfectly when running on a HDD and crash Autoplay.exe when run on a CD. If this is not a bug, I'd like to know what's a bug.

RizlaUK
10-10-2007, 04:24 PM
ok, you can get the CLSID of the codec as you already have it installed on your system and check the users reg for the same CLSID, im not so hot on codec stuff so "hopefuly" someone will jump in here

i agree that it dosent seem right that it works on hdd but not on cd rom, at first glance i would say its a bug, but theres nearly always a simple solution round the matter....its just finding it

maybe post it as a bug and see what the IR guys say

Radioguy
10-10-2007, 04:26 PM
I don't think its a bug as much as divx codec is not a default format maybe?

From the help file:
The video object is compatible with the following video formats:

.asf, .asx, .wax, .wmv, .wvx, .wmp, .wmx, .avi, .mpg, .mpeg, .m1v, .mpa, .mpe, .mpv2

slbreizh
10-10-2007, 04:27 PM
I'll do it. Thank you.

slbreizh
10-10-2007, 04:34 PM
The world of video format is a jungle. To make it short, avi is file format (or file wrapper) not a video format. You can put MPEG4 (divx,xvid...), H264, MPEG2(dvd) video in a avi file. It is just a file structure understood by Windows Media Player. And yes, my movie is a MPEG4 divx encoded wrapped in an avi file format.