国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

Asp.net FMS 開發(fā)視頻網(wǎng)站_.Net教程

2024-07-10 12:50:45
字體:
供稿:網(wǎng)友

推薦:如何用VB.net實現(xiàn)sql數(shù)據(jù)庫的備份與恢復
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click '備份數(shù)據(jù)庫 'BACKUP DATABASE Test TO DISK='C:Backup' WITH Format D

Asp.net FMS 開發(fā)視頻網(wǎng)站步驟:
1。下載FMS http://blogs.ugidotnet.org/kfra/archive/2006/10/04/50003.aspx,安裝配置。
2。使用flash制作FMS視頻采集的控件。
3。aspx頁面嵌入FMS采集控件,運行采集數(shù)據(jù)上傳到FMS服務(wù)器,修改數(shù)據(jù)庫的視頻文件存放地址。
4。頁面嵌入Flash播放控件,加入FLV處理流代碼:
1using System;
2using System.IO;
3using System.Web;
4
5
6/**//// <summary>
7/// Summary description for FLVStreaming
8/// </summary>
9public class FLVStreaming : IHttpHandler
10{
11 private static readonly byte[] _flvheader = HexToByte("464C5601010000000900000009"); //"FLV/x1/x1/0/0/0/x9/0/0/0/x9"
12
13 public FLVStreaming()
14 {
15 }
16
17 public void ProcessRequest(HttpContext context)
18 {
19 try
20 {
21 int pos;
22 int length;
23
24 // Check start parameter if present
25 string filename = Path.GetFileName(context.Request.FilePath);
26
27 using (FileStream fs = new FileStream(context.Server.MapPath(filename), FileMode.Open, FileAccess.Read, FileShare.Read))
28 {
29 string qs = context.Request.Params["start"];
30
31 if (string.IsNullOrEmpty(qs))
32 {
33 pos = 0;
34 length = Convert.ToInt32(fs.Length);
35 }
36 else
37 {
38 pos = Convert.ToInt32(qs);
39 length = Convert.ToInt32(fs.Length - pos) _flvheader.Length;
40 }
41
42 // Add HTTP header stuff: cache, content type and length
43 context.Response.Cache.SetCacheability(HttpCacheability.Public);
44 context.Response.Cache.SetLastModified(DateTime.Now);
45
46 context.Response.AppendHeader("Content-Type", "video/x-flv");
47 context.Response.AppendHeader("Content-Length", length.ToString());
48
49 // Append FLV header when sending partial file
50 if (pos > 0)
51 {
52 context.Response.OutputStream.Write(_flvheader, 0, _flvheader.Length);
53 fs.Position = pos;
54 }
55
56 // Read buffer and write stream to the response stream
57 const int buffersize = 16384;
58 byte[] buffer = new byte[buffersize];
59
60 int count = fs.Read(buffer, 0, buffersize);
61 while (count > 0)
62 {
63 if (context.Response.IsClientConnected)
64 {
65 context.Response.OutputStream.Write(buffer, 0, count);
66 count = fs.Read(buffer, 0, buffersize);
67 }
68 else
69 {
70 count = -1;
71 }
72 }
73 }
74 }
75 catch (Exception ex)
76 {
77 System.Diagnostics.Debug.WriteLine(ex.ToString());
78 }
79 }
80
81 public bool IsReusable
82 {
83 get { return true; }
84 }
85
86 private static byte[] HexToByte(string hexString)
87 {
88 byte[] returnBytes = new byte[hexString.Length / 2];
89 for (int i = 0; i < returnBytes.Length; i )
90 returnBytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16);
91 return returnBytes;
92 }
93
94}
95修改配置文件,運行頁面即可調(diào)出視頻,播放速度很不錯。雖說輕描淡寫但已經(jīng)給出應用Asp.net開發(fā)視頻網(wǎng)站的思路。

分享:如何解決CSV字段數(shù)據(jù)的雙引號問題
主要解決CSV字段數(shù)據(jù)帶有雙引號的問題 具體代碼如下: 以下為引用的內(nèi)容: Public Function ChangeCsvSplitLine(ByVal s

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 宜昌市| 绥棱县| 利川市| 通山县| 乐都县| 金塔县| 永吉县| 定结县| 大方县| 天台县| 全南县| 邵武市| 高安市| 娄烦县| 磴口县| 延吉市| 静宁县| 安徽省| 化隆| 定结县| 尉氏县| 永嘉县| 谢通门县| 桃源县| 绥芬河市| 会理县| 彩票| 乌海市| 清新县| 沽源县| 朝阳县| 阿城市| 东乡县| 巴林左旗| 洪泽县| 民丰县| 社旗县| 定远县| 金堂县| 怀仁县| 利辛县|