I think there are something error in new version

F-IN-BOX for Delphi / Builder C++ / VCL
coolshadow
Posts: 67
Joined: Fri Oct 10, 2008 7:42 am

I think there are something error in new version

Postby coolshadow » Fri Nov 21, 2008 7:54 am

I'm using delphi2007, I downloaded the new version, and made a sample test app. In it ,I handled OnLoadExternalResourceEx, OnLoadExternalResource, OnLoadExternalResourceAsync.
But none of them was called.

I don't know way.

Code: Select all

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, FlashPlayerControl;

type
  TForm1 = class(TForm)
    FlashPlayerControl1: TFlashPlayerControl;
    procedure FlashPlayerControl1LoadExternalResourceAsync(ASender: TObject;
      const Path: WideString; out Stream: TStream);
    procedure FlashPlayerControl1LoadExternalResource(ASender: TObject;
      const URL: WideString; Stream: TStream);
    procedure FormShow(Sender: TObject);
    procedure FlashPlayerControl1LoadExternalResourceEx(ASender: TObject;
      const URL: WideString; Stream: TStream; out bHandled: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FlashPlayerControl1LoadExternalResource(ASender: TObject;
  const URL: WideString; Stream: TStream);
begin
application.MessageBox(PChar(AnsiString(url)),'',mb_ok);
end;

procedure TForm1.FlashPlayerControl1LoadExternalResourceAsync(ASender: TObject;
  const Path: WideString; out Stream: TStream);
begin
  application.MessageBox(PChar(AnsiString(path)),'',mb_ok);
  Stream:=TfileStream.Create('g:\\test.flv',fmopenread);
end;

procedure TForm1.FlashPlayerControl1LoadExternalResourceEx(ASender: TObject;
  const URL: WideString; Stream: TStream; out bHandled: Boolean);
begin
 application.MessageBox(PChar(AnsiString(url)),'',mb_ok);
end;

procedure TForm1.FormShow(Sender: TObject);
begin
form1.FlashPlayerControl1.LoadMovie(0,'g:\\test.swf');
end;

end.


And I've send my test app source and swf,flv file to your email.

Thanks.

coolshadow
Posts: 67
Joined: Fri Oct 10, 2008 7:42 am

Postby coolshadow » Fri Nov 21, 2008 8:06 am

In old versions, these events can be called.

BTW:

In c++ builder2007, I use this kind of code,

Code: Select all

void __fastcall TFplayer::FlashPlayerControl1LoadExternalResourceAsync(
     TObject *ASender, const WideString Path, TStream *Stream)
{

   if(Path=="video.flv")
   {
   Stream=new TFileStream("g:\\video.flv",fmOpenRead);
   }
}


At this time ,the swf and flv file I used was the same as above
But it get error like this
An unhandled win32 exception occured

And I've build your demo SampleA_FLVPlayer, but by debug it ,I found that the OnLoadExternalResourceAsync has never been called. :cry:
Last edited by coolshadow on Fri Nov 21, 2008 8:09 am, edited 1 time in total.

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Fri Nov 21, 2008 8:06 am

Thank you for your question.

Becuase these events are called when you load your movie from a TStream.

For other cases, you should use global handlers:
http://www.f-in-box.com/delphi/help/ind ... ndler.html
http://www.f-in-box.com/delphi/help/ind ... lerex.html
http://www.f-in-box.com/delphi/help/ind ... async.html

Thank you.
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

coolshadow
Posts: 67
Joined: Fri Oct 10, 2008 7:42 am

Postby coolshadow » Fri Nov 21, 2008 8:19 am

Softanics wrote:Thank you for your question.

Becuase these events are called when you load your movie from a TStream.

For other cases, you should use global handlers:
http://www.f-in-box.com/delphi/help/ind ... ndler.html
http://www.f-in-box.com/delphi/help/ind ... lerex.html
http://www.f-in-box.com/delphi/help/ind ... async.html

Thank you.


Ok, I got this.

But why I got error when using OnLoadExternalResourceAsync

Code: Select all

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "FlashPlayerControl"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
   : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FlashPlayerControl1LoadExternalResource(
     TObject *ASender, const WideString URL, TStream *Stream)
{
   AnsiString url=URL;
   TFileStream *out=new TFileStream("g:\"+url,fmOpenRead);
   out->Seek(0,soFromBeginning);
   Stream->CopyFrom(out,out->Size);
   out->Free();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FlashPlayerControl1LoadExternalResourceAsync(
     TObject *ASender, const WideString Path, TStream *Stream)
{
   AnsiString path=Path;
   Stream=new TFileStream("g:\"+Path,fmOpenRead);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormShow(TObject *Sender)
{
   TFileStream *s=new TFileStream("g:\\test.swf",fmOpenRead);
   this->FlashPlayerControl1->PutMovieFromStream(s);
   s->Free();
}
//---------------------------------------------------------------------------

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Fri Nov 21, 2008 8:27 am

Which error?...

Could you please check, after:

Code: Select all

Stream=new TFileStream("g:\\"+Path,fmOpenRead);


Stream is nil ?
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Fri Nov 21, 2008 8:31 am

coolshadow wrote:At this time ,the swf and flv file I used was the same as above
But it get error like this
An unhandled win32 exception occured


Oh... may be you can send me a project which produces this exception?

coolshadow wrote:And I've build your demo SampleA_FLVPlayer, but by debug it ,I found that the OnLoadExternalResourceAsync has never been called. :cry:


Yes, you should change "http://FLV/flashvideo.flv" to just "flashvideo.flv", and the event will be called.

Thank you.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

coolshadow
Posts: 67
Joined: Fri Oct 10, 2008 7:42 am

Postby coolshadow » Fri Nov 21, 2008 8:43 am

Softanics wrote:
coolshadow wrote:At this time ,the swf and flv file I used was the same as above
But it get error like this
An unhandled win32 exception occured


Oh... may be you can send me a project which produces this exception?

coolshadow wrote:And I've build your demo SampleA_FLVPlayer, but by debug it ,I found that the OnLoadExternalResourceAsync has never been called. :cry:


Yes, you should change "http://FLV/flashvideo.flv" to just "flashvideo.flv", and the event will be called.

Thank you.


done

coolshadow
Posts: 67
Joined: Fri Oct 10, 2008 7:42 am

Postby coolshadow » Fri Nov 21, 2008 8:44 am

Softanics wrote:Which error?...

Could you please check, after:

Code: Select all

Stream=new TFileStream("g:\"+Path,fmOpenRead);


Stream is nil ?


Not nil
I think. Because we can't see the second messagebox
AnsiString path=Path;
Application->MessageBoxA("call","",MB_OK);
Stream=new TFileStream("g:\"+Path,fmOpenRead);
if(NULL==Stream)
{
Application->MessageBoxA("NULL","",MB_OK);
}

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Fri Nov 21, 2008 9:32 am

It seems the problem is the following. Builder C++ adds incorrect handler:

Code: Select all

void __fastcall TForm1::FlashPlayerControl1LoadExternalResourceAsync(
     TObject *ASender, const WideString Path, TStream *Stream)
{
   AnsiString path=Path;
   Stream=new TFileStream("g:\\"+Path,fmOpenRead | fmShareDenyWrite);
}


But it should be:

Code: Select all

void __fastcall TForm1::FlashPlayerControl1LoadExternalResourceAsync(
     TObject *ASender, const WideString Path, TStream* &Stream)
{
   AnsiString path=Path;
   Stream=new TFileStream("g:\\"+Path,fmOpenRead |fmShareDenyWrite);
}


What's strange is that FlashPlayerControl.hpp contains the right declaration:

Code: Select all

typedef void __fastcall (__closure *TFlashPlayerControlOnLoadExternalResourceAsync)(System::TObject* ASender, const System::WideString Path, /* out */ Classes::TStream* &Stream);


Thank you.

PS please check your email.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

coolshadow
Posts: 67
Joined: Fri Oct 10, 2008 7:42 am

Postby coolshadow » Fri Nov 21, 2008 9:41 am

Softanics wrote:It seems the problem is the following. Builder C++ adds incorrect handler:

Code: Select all

void __fastcall TForm1::FlashPlayerControl1LoadExternalResourceAsync(
     TObject *ASender, const WideString Path, TStream *Stream)
{
   AnsiString path=Path;
   Stream=new TFileStream("g:\"+Path,fmOpenRead | fmShareDenyWrite);
}


But it should be:

Code: Select all

void __fastcall TForm1::FlashPlayerControl1LoadExternalResourceAsync(
     TObject *ASender, const WideString Path, TStream* &Stream)
{
   AnsiString path=Path;
   Stream=new TFileStream("g:\"+Path,fmOpenRead |fmShareDenyWrite);
}


What's strange is that FlashPlayerControl.hpp contains the right declaration:

Code: Select all

typedef void __fastcall (__closure *TFlashPlayerControlOnLoadExternalResourceAsync)(System::TObject* ASender, const System::WideString Path, /* out */ Classes::TStream* &Stream);


Thank you.

PS please check your email.


I tried it, and it works well.
Thank you very much

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Fri Nov 21, 2008 9:48 am

coolshadow wrote:I tried it, and it works well.
Thank you very much


Thank you... Now I'm thinking how to make Builder C++ adding the correct declarations...
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

coolshadow
Posts: 67
Joined: Fri Oct 10, 2008 7:42 am

Postby coolshadow » Fri Nov 21, 2008 9:52 am

Softanics wrote:
coolshadow wrote:I tried it, and it works well.
Thank you very much


Thank you... Now I'm thinking how to make Builder C++ adding the correct declarations...

This also happens when using OnLoadExternalResourceEx

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Sun Nov 23, 2008 8:24 pm

coolshadow wrote:
Softanics wrote:
coolshadow wrote:I tried it, and it works well.
Thank you very much


Thank you... Now I'm thinking how to make Builder C++ adding the correct declarations...

This also happens when using OnLoadExternalResourceEx


You're right, that's why we have just issued a fix for this problem, now the events work well with Builder C++:
http://f-in-box.com/blog/f-in-box-delph ... available/

Thank you.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html


Return to “Delphi / Builder / VCL Edition”

Who is online

Users browsing this forum: No registered users and 21 guests

cron