- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
以下适用于 Chrome 但不适用于 Firefox:
var myVideo = document.getElementById('myVideo')
myVideo.currentTime = 570
<video id="myVideo" controls>
<source src="myVideo.mp4" type="video/mp4">
</video>
在 Firefox 中它说
InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable
第 2 行。
最佳答案
当对象(在本例中为视频)加载不足,无法设置 currentTime
并向前跳时,就会发生该错误。
您必须等到视频可以播放后才能设置currentTime
var myVideo = document.getElementById('myVideo')
myVideo.addEventListener('canplaythrough', function() {
myVideo.currentTime = 570;
}, false);
关于javascript - InvalidStateError : An attempt was made to use an object that is not, 或不再可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34970272/
我刚开始学习 websockets,我得到了一个奇怪的错误: window.onload = function(){ var service = new WebSocket(
我正在编写一个 JavaScript/HTML5 Windows 8 应用程序。写入 IndexedDB 时偶尔会出现 InvalidStateError。我的功能在下面,它发生在第一行。有没有办法保
我正在建立一个网站,当您将鼠标指针移到视频上时,视频就会开始播放。当用户离开视频区域时,它会暂停并跳回第一帧。这在除 IE 之外的所有浏览器中都能完美运行。当我打开开发控制台时,它会在处理停止功能的代
我正在集成一个使用 IndexedDB 的 javascript 库,但是当 Firefox 处于隐私浏览/窗口模式时它会“粗鲁地”失败。该库返回一个 500 内部错误,同时 Firefox 向控制台
我已经阅读了另一个线程,它并不好:Put data into JSON with Jquery 每当我尝试对对象数组进行 JSON.stringify 时,我都会收到一条错误消息: Uncaught
我已经使用 vue-cli 工具配置了一个简单的 Vue 项目: vue init webpack my-project 现在我想在页面呈现之前通过网络套接字发送一些信息。由于我不想将此逻辑绑定(bi
什么会导致 Promise 在此处被 'InvalidStateError' 拒绝? const SERVICE_WORKER_VERSION = "3.0.0"; // is updated in
当我在 iOS 上调用 Audio.stopAudio() 时,会导致 InvalidStateError。它引用了 Three.js:38399。有人在使用 Three.js/A-Frame 时遇到
使用此处提供的基本示例:https://developer.here.com/javascript-apis/documentation/v3/maps/topics/quick-start.html
我正在为桌面共享编写一个简单的 WebRTC Google Chrome 扩展程序。我尝试使用 getusermedia,但每次调用错误回调函数时返回的错误是: NavigatorUserMediaE
我无法将 Angular2 前端与 Spring 的 websocket 后端连接起来。 Spring配置xml文件:
我收到此错误消息: Uncaught InvalidStateError: Failed to read the 'selectionDirection' property from 'HTMLInp
情况 我有一个类似网格的无序列表,其中包含 144 (90px x 90px) 个图像 (12x12),可以旋转。我的最终目标是获取 144 个图像网格并将其保存为 1 个图像。 当前解决方案 我当前
当在 Javascript 中使用 stomp.js 和 sockjs 时,我可以与 Spring Boot 后端很好地连接。 当在 Angular5 中使用 stompjs 和 sockjs 时,我
以下适用于 Chrome 但不适用于 Firefox: var myVideo = document.getElementById('myVideo') myVideo.currentTime = 5
我正在编写一个 Web 应用程序,我想在其中使用 SSL 通过 Tornado WebSockets 从客户端向服务器端发送 JSON 代码。当我想建立连接时,谷歌浏览器在控制台日志中显示错误: Un
我在 IE11 中遇到这个错误,我临时更改了一个数字上的所有变量,但我无法摆脱这个错误。 audio.currentTime = 10; 错误看起来像: SCRIPT5022: InvalidStat
在 Firefox 17.0.1 中,当我尝试打开 IndexedDB 数据库时,Firebug 控制台向我显示了一个InvalidStateError 异常。还引发了 request.onerror
我正在创建一个 webRTC 视频聊天,当从 firefox 发起调用并且接收者正在使用 chrome 时,它会向调用者显示所有事件成员,此错误显示为“未捕获( promise 中)DOMExce
我在实现绕过 Internet Explorer 中“下载”属性缺失行为的解决方案时遇到了一些问题。 用户可以下载三种类型的文件: CSV geoJSON 知识分子语言 所以在 Chrome 和 FF
我是一名优秀的程序员,十分优秀!