小编Rah*_*are的帖子

如何检查视频是否连续播放 30 秒而不管起点如何?

我有一个 HTML 格式的视频元素

<video id="video_player" controls>
  <source src="{{object.video_file.url}}" type="video/mp4">
    Your browser does not support the video tag.
</video>
Run Code Online (Sandbox Code Playgroud)

我想要的是检查视频是否连续播放了 30 秒,而不管它从哪里开始,以获得计数。

如何在此处为此编写 JavaScript

$("#video_player")[0].addEventListener('timeupdate',(e) =>{
 // logic
})
Run Code Online (Sandbox Code Playgroud)

javascript

4
推荐指数
1
解决办法
57
查看次数

一旦满足条件就停止postgres中的递归

我有这张层次结构表

select * from product_categories;
 id | parent_id |     item     |     rule
----+-----------+--------------+---------------
  1 |           | ecomm        |
  2 |         1 | grocceries   |
  3 |         1 | electronics  |
  5 |         3 | TV           |
  6 |         4 | touch_screen | Rules applied
  7 |         4 | qwerty       |
  8 |         6 | iphone       |
  4 |         3 | mobile       | mobile rules
Run Code Online (Sandbox Code Playgroud)

我想从 iPhone 进行遍历,一旦遇到“规则”不为 NULL 的行,我想选择该行并完成递归,我正在使用这个查询,

WITH RECURSIVE items AS (
        SELECT id, item, parent_id, rule
        FROM …
Run Code Online (Sandbox Code Playgroud)

sql postgresql recursive-query common-table-expression

3
推荐指数
1
解决办法
733
查看次数