I am in ASP.NET 2.0. I have uploaded a QuickTime movie to the database. It now resides as a byte array in sql server 2005. I am trying to determine how to read the bytes back out, maybe convert them to a stream and display the movie in the browser or some sort of device. I know this is broad, but can anyone even give me pointers on where to get started or if I am going about this the right way?
我在ASP.NET 2.0中。我已将QuickTime影片上传到数据库。它现在作为sql server 2005中的字节数组存在。我试图确定如何读回字节,可能将它们转换为流并在浏览器或某种设备中显示电影。我知道这很广泛,但是有人甚至可以指出我从哪里开始,或者我是否正确地采用这种方式?
4 个解决方案
#1
This article: Save and Restore Files/Images to SQL Server Database will give you pointers how to read the bytes from the database.
本文:保存和还原文件/图像到SQL Server数据库将为您提供如何从数据库中读取字节的指针。
#2
Mitch has shown how to get the bytes. The next thing for you to figure out is how you would display a video - any video in a normal HTML page. ASP.NET will eventually render a normal HTML page, so you'll have to figure this part out eventually.
米奇已经展示了如何获得字节。接下来要弄清楚的是如何显示视频 - 普通HTML页面中的任何视频。 ASP.NET最终将呈现一个普通的HTML页面,因此您最终必须弄清楚这一部分。
Once you've got that figured, all you have to do is take Mitch's bytes, and connect them with your "play video" thing, and you'll be all set.
一旦你得到了这个数字,你所要做的就是拿Mitch的字节,并将它们与你的“播放视频”事物联系起来,你就会全力以赴。
#3
You will need to make an ASP.NET page which reads the content as already discussed and set the appropriate MIME type using ContentType = "video/quicktime" when your page streams it out.
您需要创建一个ASP.NET页面,该页面读取已经讨论过的内容,并在页面流出时使用ContentType =“video / quicktime”设置相应的MIME类型。
If you need a page which contains the video in a window, you would make a separate (static or aspx) page that wraps the viewing component in HTML with a reference to your streaming page to provide the video. The page I linked to also shows how you can launch in QuickTime.
如果您需要一个包含窗口中视频的页面,您可以创建一个单独的(静态或aspx)页面,该页面以HTML格式包含查看组件,并引用您的流式页面以提供视频。我链接的页面还显示了如何在QuickTime中启动。
#4
this is an ugly solution. I have been asked to do this in a project and it's a nightmare. You can't really 'stream' a compressed movie like that out of a database. If you write the binary contents to a generated http response, a) if the movie is big you don't get a response until the whole payload comes (i.e. no buffering) b) in my case I'm getting an error because the embedded player wants to stream. The solution is to generate a temporary file on a media server and provide this connection to the embedded player.
这是一个丑陋的解决方案。我被要求在一个项目中这样做,这是一场噩梦。你不能真正“流”出一个像数据库那样的压缩电影。如果你将二进制内容写入生成的http响应,a)如果电影很大,你就不会得到响应,直到整个有效载荷到来(即没有缓冲)b)在我的情况下我得到一个错误,因为嵌入玩家想要流。解决方案是在媒体服务器上生成临时文件,并将此连接提供给嵌入式播放器。
#1
This article: Save and Restore Files/Images to SQL Server Database will give you pointers how to read the bytes from the database.
本文:保存和还原文件/图像到SQL Server数据库将为您提供如何从数据库中读取字节的指针。
#2
Mitch has shown how to get the bytes. The next thing for you to figure out is how you would display a video - any video in a normal HTML page. ASP.NET will eventually render a normal HTML page, so you'll have to figure this part out eventually.
米奇已经展示了如何获得字节。接下来要弄清楚的是如何显示视频 - 普通HTML页面中的任何视频。 ASP.NET最终将呈现一个普通的HTML页面,因此您最终必须弄清楚这一部分。
Once you've got that figured, all you have to do is take Mitch's bytes, and connect them with your "play video" thing, and you'll be all set.
一旦你得到了这个数字,你所要做的就是拿Mitch的字节,并将它们与你的“播放视频”事物联系起来,你就会全力以赴。
#3
You will need to make an ASP.NET page which reads the content as already discussed and set the appropriate MIME type using ContentType = "video/quicktime" when your page streams it out.
您需要创建一个ASP.NET页面,该页面读取已经讨论过的内容,并在页面流出时使用ContentType =“video / quicktime”设置相应的MIME类型。
If you need a page which contains the video in a window, you would make a separate (static or aspx) page that wraps the viewing component in HTML with a reference to your streaming page to provide the video. The page I linked to also shows how you can launch in QuickTime.
如果您需要一个包含窗口中视频的页面,您可以创建一个单独的(静态或aspx)页面,该页面以HTML格式包含查看组件,并引用您的流式页面以提供视频。我链接的页面还显示了如何在QuickTime中启动。
#4
this is an ugly solution. I have been asked to do this in a project and it's a nightmare. You can't really 'stream' a compressed movie like that out of a database. If you write the binary contents to a generated http response, a) if the movie is big you don't get a response until the whole payload comes (i.e. no buffering) b) in my case I'm getting an error because the embedded player wants to stream. The solution is to generate a temporary file on a media server and provide this connection to the embedded player.
这是一个丑陋的解决方案。我被要求在一个项目中这样做,这是一场噩梦。你不能真正“流”出一个像数据库那样的压缩电影。如果你将二进制内容写入生成的http响应,a)如果电影很大,你就不会得到响应,直到整个有效载荷到来(即没有缓冲)b)在我的情况下我得到一个错误,因为嵌入玩家想要流。解决方案是在媒体服务器上生成临时文件,并将此连接提供给嵌入式播放器。