HTML5视频播放按钮在Firefox中不起作用 [英] HTML5 video play button not working in Firefox

查看:177
本文介绍了HTML5视频播放按钮在Firefox中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我单击播放"按钮时,它会转到时间轴的末尾.但是,如果您将股票行情指示器拖动到中间的某个地方(或真正的任何地方),它将播放视频.那么为什么它最初不播放?

When I click the play button, it just goes to the end of the timeline. But if you drag the ticker somewhere in the middle (or anywhere really) it plays the video. So why won't it play initially?

它可以在除firefox之外的所有其他浏览器中使用.我正在使用Firefox 17 感谢您的帮助.谢谢.

It works in every other browser other than firefox. Im using Firefox 17 I appreciate the help. Thanks.

此处是链接 http://www.lonestarveincenter.com/

推荐答案

对不起,但我找到了解决此问题的方法.

Sorry for the necromancy but I found the answer to this problem.

onClick()事件不起作用的原因是因为Firefox在每个视频元素中添加了它自己的onCLick事件,因此,每当您单击视频时,视频便开始播放,然后立即停止.

The reason why your onClick() event isn't working is because Firefox has it's own onCLick event added to each video element hence whenever you click the video the video starts playing then instantly stops.

function playPause() {
  'Before this event is fired the FF onClick event is fired'
  player = document.getElementById("PlayerID")
    var playBtn = document.getElementById('<%= img.ClientID %>');
    if (!player.paused) { 'Player is playing and will go through this code block'
      playBtn.setAttribute('Style', 'display: block;');
      player.pause();
    }

    else { 'Player is playing and will skip this code block'
      playBtn.setAttribute('Style', 'display: none;');
      player.play();
    }
  } 

这篇关于HTML5视频播放按钮在Firefox中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆