小编Ben*_*enG的帖子

HTML5 视频 - ashx 处理程序 - 寻求

我正在尝试使用 ashx 处理程序作为 HTML5 视频源。我可以做到这一点,但我无法在已经缓冲的视频上进一步前进。

我可以在使用标准 MP4 源的网络选项卡上看到,向前查找会创建另一个请求,但使用处理程序则不会。

有些视频超过 1 GB。

到目前为止,这是我必须让视频正常工作的内容:

public void ProcessRequest(HttpContext context)
{
    context.Response.Buffer = false;
    context.Response.ContentType = "video/mp4";
    FileInfo file = new FileInfo(path);
    int len = (int)file.Length, bytes;
    context.Response.AppendHeader("content-length", len.ToString());
    byte[] buffer = new byte[1024];
    Stream outStream = context.Response.OutputStream;
    using (Stream stream = File.OpenRead(path))
    {
        while (len > 0 && (bytes = stream.Read(buffer, 0, buffer.Length)) > 0)
        {
            outStream.Write(buffer, 0, bytes);
            len -= bytes;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

摘自 Marck Gravells 的帖子Best way to stream …

html video ashx video-streaming html5-video

3
推荐指数
1
解决办法
3271
查看次数

text()不会附加到同一行的第二个<span>

jQuery text()函数不会option从选择字段追加到span.我有两个select相同的字段div.它们是不同的,包含动态创建的数字.

function myFunction(selector) {
    var i;
    for (i = 1; i <= 999; i++) {
      var text = '00' + i;
      selector.options[i - 1] = new Option(text.substr(text.length - 3, 3));
    }
  }
  //usage:
myFunction(document.getElementById("patient_code"));

$('#patsiendikoodi_label #patient_code ').change(function(i, text) {
  var $this = $(this);
  $this.prev().find('.patsiendikoodi_label_nr').text($(this).find('option:selected').text());
}).change();



function patsient(selector) {
    var i;
    for (i = 1; i <= 99; i++) {
      var text = '0' + i;
      selector.options[i - 1] = new …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery

3
推荐指数
1
解决办法
148
查看次数

$(select).val().null的长度给出错误

我的表单中有一个select对象,使用Bootstrap-select.js插件进行样式设置.当我初始化选择框,并尝试获取它的值时,null直到我选择一个选项.在我的脚本中,我正在使用: -

$(select).val().length

然而,当这给出了一个错误$(select).val()null.我真的很想得到一个0.

我该怎么做呢?

jquery bootstrap-select

2
推荐指数
1
解决办法
1000
查看次数

使用多个选择器,每个选择器具有不同的事件

我需要这个:

$("#household").children().change(function(){
    alert("changed");
});

$('.ui-icon.ui-icon-closethick.delete').click(function(){
    alert("changed");
});
Run Code Online (Sandbox Code Playgroud)

变成这样的事情:

$("#household").children().change || $('.ui-icon.ui-icon-closethick.delete').click(function(){
    alert("changed");
});
Run Code Online (Sandbox Code Playgroud)

我知道底部代码不正确,但我希望它能解释我的意思.alert如果#household.children()更改并.ui-icon.ui-icon-closethick.delete单击,我希望执行,但不编写代码两次.

javascript jquery jquery-events

1
推荐指数
1
解决办法
54
查看次数

如何在字符串中查找所有正则表达式匹配

这可能太简单了,无法在网上找到,但我找到了答案的问题.

我得到字符串作为http响应文本,其中包含我想逐个抓取的子字符串以进一步处理.它的相对URL.

例如:

var string = "div classimage a hrefstring1.png img idEMIC00001 he19.56mm wi69.85mm srcstring1.png  separated by some html         div classimage a hrefstring2.png srcstring2.png div separated by some html many such relative urls";
var re = new RegExp("[a-z]{5,10}[0-9].png");
var match = re.exec(string)
WScript.Echo (match);
Run Code Online (Sandbox Code Playgroud)

这给了第一场比赛.我希望逐个获得所有收藏品.我正在使用Jscript.我是javascript的新手.

答案之后我试了这个.

var string = "div classimage a hrefstring1.png img idEMIC00001 he19.56mm wi69.85mm srcstring1.png  separated by some html         div classimage a hrefstring2.png srcstring2.png div separated by some html many such relative urls";
var re = new …
Run Code Online (Sandbox Code Playgroud)

javascript regex

1
推荐指数
1
解决办法
60
查看次数

如何在页面加载时从 URL 中清除 Hashtag

如果我向某人发送链接http://example.com/#about,我该如何清除页面加载时 URL 中的主题标签和文本http://example.com

我一直在构建利用 CSS:target属性的灯箱。我希望这样,如果有人发送或单击带有附加到 URL 的主题标签和文本的链接,页面基本上会忽略它或在加载时从 URL 中清除它。

我认为这将是一个非常常见的问题,答案很简单,但在我的研究中没有遇到任何问题。我愿意接受包含 JavaScript 和 jQuery 的答案。

javascript url anchor jquery hashtag

1
推荐指数
2
解决办法
2641
查看次数

选择前一个元素并使用css应用效果

<div>在一条水平线上有3 秒.每个宽度= 33.33%,我想div在悬停时将宽度改为50%,将其他两个改为25%.

<div id="A"></div>
<div id="B"></div>
<div id="C"></div>
Run Code Online (Sandbox Code Playgroud)

我可以将它应用于A as

#A:hover{width:50%}
#A:hover+#B
{width:25%}
#A:hover~#C
{width:25%}
Run Code Online (Sandbox Code Playgroud)

它工作正常.

当我们盘旋B

#B:hover{width:50%}
#B:hover+#A
{width:25%}
#B:hover~#C
{width:25%}
Run Code Online (Sandbox Code Playgroud)

B扩大到50%,C缩小到25%.但#A仍然是33.33%.

我怎样才能解决这个问题.

html javascript css jquery css3

0
推荐指数
1
解决办法
65
查看次数

如何在Laravel 5中通过ajax上传文件

我使用了jQuery-File-Upload插件(https://github.com/blueimp/jQuery-File-Upload),但没有用.这是我的HTML:

<!-- The fileinput-button span is used to style the file input field as button -->
    <span class="btn btn-success fileinput-button">
            <i class="glyphicon glyphicon-plus"></i>
            <span>Add files...</span>
            <!-- The file input field used as target for the file upload widget -->
            <input id="fileupload" type="file" name="files[]" multiple>
            <input type="hidden" class="hidden-token" name="_token" value="{!! csrf_token() !!}">
        </span>
    <br>
    <br>
    <!-- The global progress bar -->
    <div id="progress" class="progress">
        <div class="progress-bar progress-bar-success"></div>
    </div>
    <!-- The container for the uploaded files -->
    <div id="files" class="files"></div> …
Run Code Online (Sandbox Code Playgroud)

php ajax jquery laravel-5

-1
推荐指数
1
解决办法
3417
查看次数