F-IN-BOX ASP.Net Help >> Classes >> FLVPlayerControl >> Events

OnProvideFLVContent

Leave FlashVideoURL property empty and handle this event to provide movie content on-the-fly (for example, from resource):

[ C# ]
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace f_in_box__aspnet_Demo
{
	public class WebForm1 : System.Web.UI.Page
	{
		protected f_in_box__aspnet.FLVPlayerControl FLVPlayerControl1;

		private void InitializeComponent()
		{    
			this.FLVPlayerControl1.OnProvideFLVContent += new f_in_box__aspnet.FLVPlayerControl.ProvideFLVContentDelegate(this.FLVPlayerControl1_OnProvideFLVContent);
		}

		private void FLVPlayerControl1_OnProvideFLVContent(object source, System.IO.Stream FLVStream)
		{
			System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
	
			System.IO.Stream FromStream = a.GetManifestResourceStream("f_in_box__aspnet_Demo.flashvideo.flv");

			const int nSize = 64 * 1024;
			byte[] buffer = new byte[nSize];
	
			int nReadBytes;
	
			while (true)
			{
				nReadBytes = FromStream.Read(buffer, 0, nSize);
	
				if (0 == nReadBytes)
					break;
	
				FLVStream.Write(buffer, 0, nReadBytes);
			}
		}
}


Copyright © 2004 - 2007 Softanics. All rights reserved.
F-IN-BOX is a trademark of Softanics.
Macromedia and Shockwave Flash are trademarks of Adobe