JavaScript/AppleScript:获取html视频的当前时间 [英] JavaScript / AppleScript: Get current time of html video

查看:61
本文介绍了JavaScript/AppleScript:获取html视频的当前时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取视频的当前时间(用户代理必须使用AppleScript或AppleScript中的Javascript将其设置为iOS 10,iPhone.

I’d like to get the current time of this video (user agent must be set to iOS 10, iPhone) using Applescript or Javascript within AppleScript.

因为可以通过此方法更改视频位置…

As it is possible to change the video position with this…

tell application "Safari"

do JavaScript "document.getElementsByTagName('video')[0].currentTime = " & 90

end tell

...我想是这样的...

… I thought something like this…

tell application "Safari"

    set ttime to do JavaScript "document.getElementsByTagName('video')[0].currentTime()"

    return ttime

end tell

…可以解决问题-但事实并非如此.请帮忙:)

… would do the trick - but it doesn’t. Please help :)

推荐答案

HTMLMediaElement.currentTime 是属性,而不是函数.您无需调用它,因此删除括号:

HTMLMediaElement.currentTime is a property, not a function. You don't need to call it, so remove the parentheses:

set ttime to do JavaScript "document.getElementsByTagName('video')[0].currentTime"

这篇关于JavaScript/AppleScript:获取html视频的当前时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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