- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
其他都可以,但是currentTime
的设置:
我尝试了一些方法,例如:
videojs("example_video_1", {}, function() {
this.currentTime(200);
this.play();
});
这是行不通的。
videojs("example_video_1").ready(function(){
this.currentTime(200);
});
这也行不通。
var dom = document.getElementById('example_video_1');
dom.addEventListener("loadedmetadata", function() {
dom.currentTime = 100;
}, false); // ok for no video.js
videojs(dom);
不工作。甚至反转addEventListener
和init videojs 的行。
我尝试了 videojs 事件。
var player = videojs("example_video_1");
alert(player.addEvent);
alert(player.addEventListener);
这些API都不存在,如何在videojs
中绑定(bind)Event?
最佳答案
这就是我如何在启动时在定义的位置播放视频(它消除了视频首先开始然后才跳转到视频位置的问题):
$(document).ready(function()
{
var timecode = 120;
var initdone = false;
// wait for video metadata to load, then set time
video.on("loadedmetadata", function(){
video.currentTime(timecode);
});
// iPhone/iPad need to play first, then set the time
// events: https://www.w3.org/TR/html5/embedded-content-0.html#mediaevents
video.on("canplaythrough", function(){
if(!initdone)
{
video.currentTime(timecode);
initdone = true;
}
});
}); // END ready
关于ios - 如何在 Safari for iOS 的 video.js 中设置 currentTime,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28823567/
在这段代码中,我有 video.currentTime = {value}而且效果很好。 但是当我尝试按 Crtl+Shift+R 重新加载页面时,它会将 video.currentTime 设置为
我希望能够将视频重新加载到 HTML5 视频中,而无需在加载时重置 currentTime。我目前的做法如下: Get current time position Set time position
如何获取YouTube视频的当前时间? 我一直在搜索YouTube api,但我不明白: https://developers.google.com/youtube/js_api_reference?
我正在尝试编写一段 Javascript 以定时间隔在两个视频之间切换(不要问)。更糟糕的是,每个视频都必须从特定位置开始(大约十秒,再说一遍,不要问。) 我通过使用 YUI Async 库触发以间隔
我在我的应用程序中播放的音频有问题。我有 HTML 音频: 然后在我的游戏中我有这样的代码 jQuery('#correct-sound').get(0)
我希望我的audio2 文件在audio1.currentTime 为3 秒时播放,但我无法使其工作。我是 javascript 的新手,我错过了什么?这是我当前的 JavaScript 代码:
使用 Web Audio API 使用振荡器生成基本音调,但存在改变演奏音符的持续时间(以秒为单位)的问题。 问题在于“维持”变量未按预期工作以停止振荡器。该变量按预期播放一个音符,然后其余音符无限持
这是我的代码: public void idoKiiras(){ String idostring = new String(); idostring.valueOf(System.
我目前正在尝试编写学校时间表。我总是在开学第一天检查我们在学校拿到的纸质格式。这就是我的问题: 我想在一天中的某个时刻显示一个标签(有关类(class)的信息)。我的意思是,如果时钟是 10:20,它
我想我在 JavaScript Audio API 上发现了一个错误。 我的代码运行得非常完美: var audio=new Audio(); var lastPause; var myPlayer=
在我问我的问题之前,我只是想说我对 Javascript 和 StackOverflow 一般都是菜鸟,所以如果这个问题太愚蠢,我想提前道歉。 无论如何,我正在学习 Javascript,现在我正在试
所以,我有一些代码由于某些奇怪的原因而不起作用。它的任务是,更改 id 为 blogtxt 的元素的属性 class IF day 变量等于 4、5 或 6(周五、周六、周日)我还希望在 day =
我在音频 html5 中使用 currentTime 时遇到问题。它在控制台中给我一个错误 InvalidStateError: An attempt was made to use an objec
当我更改其中一个 AVAudioPlayer 的 rate 并稍后调用 currentTime 时,我得到了错误的值。这是为什么? 例如,这段代码没有像我期望的那样工作: AVAudioPlayer*
当我在暂停播放器后更改 AVAudioPlayer 的 currentTime 时,它会出现滞后(一些时间为正,一些时间为负)。 [self.bookAudioPlayer pause]; [self
我有两个服务,服务 A 和服务 B。 我在服务 B 上调用方法 doStuff() 并在数据库中创建一个条目,其中包含 system.CurrentTime()当时运行 B 代码的计算机。 我在服务
我有一个简单的 HTML 页面,我在该页面上播放视频。我使用滚动条作为搜索栏。换句话说,只要用户滚动,视频就会播放。 我已经在几个地方看到过这种效果,并且想自己创建它。我写的脚本可以正常运行,但有一个
我有如下设置,在装有 iOS 10.3 的 iPhone 5s 上进行测试,包括调试和未调试。 AVAudioRecorder 触发 record(forDuration: 5.0) CADispla
这是一个 link to the sandbox .我正在寻找操纵 的最佳方法元素的当前时间。在我的沙箱中,我已经能够通过让按钮调用函数来做到这一点 seek()这改变了 video 的状态, 对
我正在尝试从声音文件中的某个点开始播放声音 (mp3)。我希望它可以在大多数移动设备上运行,并且确实可以,但 Windows Phone 8 似乎存在问题。它在三星 Galaxy 和 iPhone 上
我是一名优秀的程序员,十分优秀!