本文介绍了请使用ashx帮助获取视频的Object标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<object width="100%" height="100%" id="gsp_player_api" data="Players/flowplayer-3.2.5.swf"
type="application/x-shockwave-flash">
<param name="allowfullscreen" value="true">
<param name="allowscriptaccess" value="always">
<param name="quality" value="high">
<param name="cachebusting" value="false">
<param name="bgcolor" value="#000000">
<param name="wmode" value="opaque">
<param name="flashvars" value='config={"clip":{"autoPlay":true,"scaling":"fit","url":"VideoHandler.ashx?imgID=2"},"playerId":"gsp_player","playlist":[{"autoPlay":true,"scaling":"fit","url":"VideoHandler.ashx?imgID=2"}]}'>
</object>
<%@ WebHandler Language="C#" Class="VideoHandler" %>
using System;
using System.Web;
using System.Data.SqlClient;
using System.Data;
public class VideoHandler : IHttpHandler {
Class1 objcls = new Class1();
public void ProcessRequest (HttpContext context) {
string imageId = context.Request.QueryString["imgID"];
SqlDataReader dr = objcls.SP_GET_VIDEO_BY_ID(imageId);
if (dr.HasRows)
{
while (dr.Read())
{
context.Response.BinaryWrite((byte[])dr["VIDEO"]);
context.Response.Flush();
}
context.Response.End();
}
}
public bool IsReusable {
get {
return false;
}
}
}
错误
200,Stream not found,NetStream.Play.StreamNotFound,clip:[Clip]http:// localhost:6259 / VideoHandler.ashx?imgID = 2
Error
200, Stream not found, NetStream.Play.StreamNotFound, clip: "[Clip]"http://localhost:6259/VideoHandler.ashx?imgID=2"
推荐答案
<object id="flowplayer" data="flowplayer-3.2.2.swf" type="application/x-shockwave-flash" width="320" height="240" >
<param name="movie" value="flowplayer-3.2.2.swf">
<param name="allowfullscreen" value="true">
<param name="flashvars" value="config={'clip':{'url':'mymovie.mp4','autoPlay':false}}">
</object>
你的url属性值是VideoHandler.ashx 。如果是这样,那么在本地主机服务器http:// localhost:6259应该有该ashx文件,它应该将视频流写入Httpresponse对象。
your url propery value is VideoHandler.ashx. If so then in your local host server http://localhost:6259" should have that ashx file and it should write video stream to Httpresponse object.
这篇关于请使用ashx帮助获取视频的Object标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!