Somehow the event is raised correctly now. the URL has the correct value.
BUT:
The desired flv is nor played. All I see is a white surface.
Can anyone help?
Original:
I'm trying to play a flv file from stream. I used this HowTo: http://www.f-in-box.com/dotnet/help/ind ... tream.html
But whenn the event get fired it has the wrong URL.
The URL ist the Aplliction.StartupPath (\\?\C:\Visual Studio 2008\Projects\FLVPlayer\FLVPlayer\bin\Debug\FLVPlayer.vshost.exe).
What I'm doing wrong?
Here is my created flash movie (ActionScript2):
http://remixshare.com/dl/sd4ysu62ul/FLV2.fla
Here is my Code in C#:
Code: Select all
// The variable flash = new f_in_box__lib.f_in_box__control();
// FLV2.swf is the embeded movie from the HowTo
namespace FLVPlayer
{
public partial class Form1 : Form
{
private f_in_box__lib.AxCode axCode;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// Loads flash.ocx from resource
Stream streamWithFlashOCXCode = Assembly.GetExecutingAssembly().GetManifestResourceStream("FLVPlayer.Resources.Flash10n.ocx");
if (streamWithFlashOCXCode == null)
{
MessageBox.Show("Resource 'Flash10n.ocx' not found");
return;
}
axCode = new f_in_box__lib.AxCode(streamWithFlashOCXCode);
flash.AxCode.OnLoadExternalResourceByFullPath += new f_in_box__lib.AxCode.OnLoadExternalResourceByFullPathEventHandler(AxCode_OnLoadExternalResourceByFullPath);
flash.PutMovieFromStream(this.GetType().Assembly.GetManifestResourceStream("FLVPlayer.Resources.FLV2.swf"));
flash.FlashMethod_Play();
}
private void AxCode_OnLoadExternalResourceByFullPath(object sender, string URL, Stream Stream, ref bool Handled)
{
if (URL == "http://FLV/FlashVideo.flv")
{
Stream flvStream = this.GetType().Assembly.GetManifestResourceStream("FLVPlayer.Resources.Chapter1_de.flv.flv");
const int size = 64 * 1024;
byte[] buffer = new byte[size];
int eeadBytes;
while ((eeadBytes = flvStream.Read(buffer, 0, size)) > 0)
{
try
{
Stream.Write(buffer, 0, size);
}
catch (IOException e)
{
// Loading is interrupted
break;
}
}
Stream.Close();
Handled = true;
}
}
}