当前位置:Gxlcms > html代码 > canvas.toDataURLimage/png报错处理方法推荐

canvas.toDataURLimage/png报错处理方法推荐

时间:2021-07-01 10:21:17 帮助过:36人阅读

问题背景:

遇到一个需求,要对播放的视频进行截图,视频使用video标签来播放,然后点击视频播放区域时截取实时的帧图片。

代码很简单如下:

  1. <div style="display:none">
  2. <div class="login-box" id="login-dialog">
  3. <div class="login-top"><a class="current" rel="nofollow" id="login1" onclick="setTab('login',1,2);">登录</a></div>
  4. <div class="login-form" id="nav-signin">
  5. <!-- <div class="login-ico"><a rel="nofollow" class="qq" id="qqlogin" target="_blank" href="/user-center-qqlogin.html"> QQ </a></div> -->
  6. <div class="login-box-form" id="con_login_1">
  7. <form id="loginform" action="/user-center-login.html" method="post" onsubmit="return false;">
  8. <p class="int-text">
  9. <input class="email" id="username" name="username" type="text" value="用户名或Email" onfocus="if(this.value=='用户名或Email'){this.value='';}" onblur="if(this.value==''){this.value='用户名或Email';};"></p>
  10. <p class="int-text">
  11. <input class="password1" type="password" id="password" name="password" value="******" onblur="if(this.value=='') this.value='******';" onfocus="if(this.value=='******') this.value='';">
  12. </p>
  13. <p class="int-info">
  14. <label class="ui-label"> </label>
  15. <label for="agreement" class="ui-label-checkbox">
  16. <input type="checkbox" value="" name="cookietime" id="cookietime" checked="checked">
  17. <input type="hidden" name="notforward" id="notforward" value="1">
  18. <input type="hidden" name="dosubmit" id="dosubmit" value="1">记住我的登录 </label>
  19. <a rel="nofollow" class="aright" href="/user-center-forgetpwd.html" target="_blank"> 忘记密码? </a></p>
  20. <p class="int-btn"><a rel="nofollow" id="loginbt" class="loginbtn"><span>登录</span></a></p>
  21. </form>
  22. </div>
  23. <form id="regform" action="/user-center-reg.html" method="post">
  24. <div class="login-reg" style="display: none;" id="con_login_2">
  25. <input type="hidden" name="t" id="t">
  26. <p class="int-text">
  27. <input id="email" name="email" type="text" value="Email" onfocus="if(this.value=='Email'){this.value='';}" onblur="if(this.value==''){this.value='Email';};"></p>
  28. <p class="int-text">
  29. <input id="uname" name="username" type="text" value="用户名或昵称" onfocus="if(this.value=='用户名或昵称'){this.value='';}" onblur="if(this.value==''){this.value='用户名或昵称';};"></p>
  30. <p class="int-text">
  31. <input type="password" id="pwd" name="password" value="******" onblur="if(this.value=='') this.value='******';" onfocus="if(this.value=='******') this.value='';"> </p>
  32. <p class="int-text1"><span class="inputbox">
  33. <input id="validate" name="validate" type="text" value="验证码" onfocus="if(this.value=='验证码'){this.value='';}" onblur="if(this.value==''){this.value='验证码';};">
  34. </span><span class="yzm-img"><img src="/user-checkcode-index" alt="看不清楚换一张" id="indexlogin"></span></p>
  35. <p class="int-info">
  36. <label>
  37. <input value="" name="agreement" id="agreement" checked="checked" type="checkbox">
  38. 我已阅读<a rel="nofollow" href="/user-center-agreement.html">用户协议</a>及<a rel="nofollow" href="/user-center-agreement.html">版权声明</a></label>
  39. </p>
  40. <p class="int-btn"><input type="hidden" name="dosubmit">
  41. <a rel="nofollow" class="loginbtn" id="register"><span>注册</span></a></p>
  42. </div>
  43. </form>
  44. </div>
  45. </div>
  46. </div>