tia是什么| 花生有什么营养| 嗳气是什么原因引起的| 说三道四的意思是什么| 气口是什么意思| 怕冷的女人是什么原因| 什么是丘疹| 什么力气| 心气虚吃什么中成药| 陪嫁一般陪些什么东西| 冬眠的动物有什么| 共号是什么意思| 15朵玫瑰花代表什么意思| 为什么叫五七干校| 被和谐了是什么意思| 婴儿大便绿色是什么原因| 4.26是什么星座| 吃什么软化血管| 什么什么的落叶| 胃不好喝什么茶好| 面粉是什么粉| 2002年属马的是什么命| 男人为什么离不开情人| 罗红霉素和红霉素有什么区别| 晚上梦到蛇是什么意思| 清清什么| 抬举征阳性是什么意思| 精液带血是什么原因| 幺妹是什么意思| 白细胞高是什么问题| 欧是什么意思| 嗓子疼喝什么| 脚底红是什么原因| 胎盘吃了对身体有什么好处| 怀孕初期不能吃什么| 公卿是什么意思| 结论是什么意思| 雨中漫步是什么意思| 冰箱发烫是什么原因| 什么蔬菜是温性的| 千什么一发| 湿气重是什么原因引起的| 勃不起来吃什么药| 梦见流水是什么征兆| 申时左眼跳是什么预兆| 什么是隐匿性包茎| 马齿苋别名叫什么| 生粉是什么粉| 三尖瓣少量反流是什么意思| 1月22是什么星座| 夏天脚开裂是什么原因| 睫角守宫吃什么| 吃什么能补头发| 公务员是做什么工作的| 脑动脉瘤是什么原因引起的| 搏击是什么运动| 更年期什么时候开始| 一什么笑声| 男性下体瘙痒用什么药| 左右逢源是什么生肖| ad是什么| 手会发抖是什么原因| 六月十四是什么星座| 脂蛋白a高是什么原因引起的| 一什么黑影| 姓傅的男孩取什么名字| 霜降是什么意思| 有机是什么意思| 家里飞蛾多是什么原因| 灭蚂蚁什么药最有效| 包馄饨用猪肉什么部位| 胜利在什么| 世界上最长的河流是什么| 怀孕了吃什么| 吃完饭打嗝是什么原因| 眼睛眼屎多是什么原因| 今晚吃什么家常菜| 沂字五行属什么| 宜宾燃面为什么叫燃面| 金与什么相生相克| 睡觉腿抽筋是什么原因| 蹦蹦跳跳是什么生肖| 神经痛吃什么药效果好| 做梦搬家是什么意思| 烧腊是什么意思| 什么的粉墙| 阴历7月22什么日子| 1998年属虎的是什么命| 阴道炎是什么原因引起的| 麂皮是什么材质| 反流性食管炎不能吃什么食物| 众是什么意思| 欢愉是什么意思| 头出虚汗是什么原因引起的| 无纺布是什么材料做的| 灯红酒绿是什么意思| 青海省会城市叫什么| 浮生若梦是什么意思| 黄桃不能和什么一起吃| 瑞舒伐他汀钙片治什么病| 狗肚子有虫子吃什么药| 普拉提是什么运动| 杏子不能和什么一起吃| 胃口疼是什么原因| 3月8日是什么星座| 淋病和梅毒有什么区别| zara中文叫什么| 天生一对是什么意思| 火鸡面是什么| 尿常规白细胞高是什么原因| 黄芪泡水喝有什么好处| 猕猴桃树长什么样| 馨是什么意思| 狐狸和乌鸦告诉我们什么道理| 六级什么时候考| 希尔福是什么药| 2023是什么年| pc肌是什么| 胱抑素c高是什么原因| 吃什么东西去湿气| 什么蘑菇| 利血平是什么药| 为什么女生会来月经| 什么不止| 子宫内膜薄是什么原因造成的| 拉屎的时候拉出血来是什么原因| 杨五行属什么| 细菌感染引起的发烧吃什么药| 子宫内膜脱落是什么意思| 什么是腺瘤| 什么叫个性强| rom是什么意思| fda是什么意思| 群青色是什么颜色| bonnie是什么意思| 心率过缓有什么危害| 13岁属什么| hda是什么| 总胆红素升高是什么原因| 青梅竹马什么意思| 风流是什么意思| 大雄宝殿是什么意思| 男人喜欢什么姿势| 十二指肠胃溃疡吃什么药| 荞麦枕头有什么好处| 白居易是诗什么| 蛇脱皮在家有什么预兆| 承上启下是什么意思| 马凡氏综合症是什么病| 腰间盘膨出是什么意思| 墨绿色是什么颜色| 正月二十是什么星座| 鑫字代表什么生肖| 东北人喜欢吃什么菜| a1什么意思| 什么是两栖动物| ict是什么意思| 10.19什么星座| 一个月一个并念什么| 什么叫微创手术| 57年的鸡是什么命| 牙周炎吃什么药最好| 十点多是什么时辰| 军士长是什么军衔| 二郎神叫什么名字| 疗养是什么意思| 百福骈臻是什么意思| 绿本是什么| 红艳桃花是什么意思| 什么是室性早搏| arrior是什么牌子轮胎| 氯仿是什么| 疣是一种什么病| 俊俏是什么意思| 喝隔夜茶有什么好处和坏处| 入殓师是做什么的| 双身什么意思| 肌肉酸痛挂什么科| 血稠吃什么食物好得快| 膀胱炎是什么症状表现| 知性是什么类型的女人| 肋软骨炎吃什么药最好| 混子是什么意思| 浩瀚是什么意思| 归脾丸和健脾丸有什么区别| 桃子不能和什么食物一起吃| 你从什么时候不再爱我| 虹膜是什么意思| 右眼皮跳是什么预兆男| 脚气用什么洗脚| 71年什么时候退休| 惶恐是什么意思| 出气臭是什么原因| 胎盘位于后壁是什么意思| 人流后吃什么水果好| 西边五行属什么| 咳嗽吃什么食物好得最快最有效| 阴囊潮湿什么原因| 家里出现蜈蚣是什么预兆| 做b超挂什么科| 不声不响是什么意思| 谷维素是什么| tu是什么意思| 手掌麻是什么原因引起的| vip是什么意思| 放屁多是什么病的征兆| 喝酒前喝什么不容易醉又不伤胃| pB什么意思| 健身后应该吃什么| 五脏六腑是什么意思| 脸上出汗多是什么原因| ori是什么意思| 什么是顶香人| 什么花有毒| 秒后面是什么单位| 冰箱灯不亮是什么原因| 手脚发热什么原因| 忧郁什么意思| 女人眉心有痣代表什么| 生死有命富贵在天什么意思| 左肾窦分离是什么意思| 伏什么意思| 植物油是什么| 龙和什么属相最配| 头伏二伏三伏吃什么| 似是而非是什么意思| 什么样的乌云| 无住生心是什么意思| 面包属于什么类食品| 珍珠纱是什么面料| 水肿是什么原因| 为什么眨眼睛| 新疆有什么特产| 尿少尿黄是什么原因引起的| 1208是什么星座| 胃热吃什么食物好| 尿道口下裂是什么样子| 一九八四年属什么生肖| 年柱亡神是什么意思| 看是什么意思| 孤独症有什么表现| 屁多什么原因| 紫菜和海苔有什么区别| 膝盖不舒服挂什么科| 肾上腺是什么意思| plt医学上是什么意思| 汉防己甲素片治什么病| 经常梳头有什么好处| 身体动不动就出汗是什么原因| 什么是达人| 什么病不能吃秋葵| 门静脉增宽是什么意思| 什么什么一惊| 糖尿病人晚餐吃什么最好| 6.26什么星座| 冯巩什么军衔| 什么叫多动症| 没有生抽可以用什么代替| 挂靠是什么意思| 什么奶粉最好| 番茄酱和番茄沙司有什么区别| 什么是基因突变| 左肾钙乳症是什么病| 下巴下面长痘痘是什么原因| 百度
Skip to content

[Proposal] Allow seeking through seekTo before the HTMLMediaElement is ready #1607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

peaBerberian
Copy link
Collaborator

@peaBerberian peaBerberian commented Dec 19, 2024

As #1600 signalled, there's currently no practical way to update the initial position (configured through the startAt loadVideo option) until startAt has actually been applied.

More generally, it's not possible to perform a seekTo call until the initial seek has been performed on the content (the seekTo call will just be ignored).

This PR proposes the following code updates to improve on that situation:

  1. Tangentially related, we now schedule a JavaScript micro-task right at ContentTimeBoundariesObserver's instantiation so the caller can catch events that were previously synchronously sent (I'm thinking here of the warnings for the MEDIA_TIME_BEFORE_MANIFEST and the MEDIA_TIME_AFTER_MANIFEST codes).

    Without this, we would wait for the next playback observation, which could happen a whole second later.

  2. I noticed that the position indicated through the startAt loadVideo option was bounded so it's inside the [minimumPosition, maximumPosition] range (as obtained from the Manifest). As stated here I personally think this is suboptimal.

    In my opinion, we should let the initial position go outside the range of the Manifest and let the application do its thing based on MEDIA_TIME_BEFORE_MANIFEST / MEDIA_TIME_AFTER_MANIFEST events.

    As to not totally change the behavior, I've only done so for dynamic contents (contents for which segments are added or removed, like live and contents that are being downloaded locally).

    VoD contents continue to have the previous behavior for now.

  3. I added a "seek-blocking" mechanism to the MediaElementPlaybackObserver and made all seek operations, including the one from seekTo go through it.

    The idea is that when it is blocked (as it is initially), we'll delay any seek operation (by marking it as a "pending seek") and only seek to the last one of those once the unblockSeeking method is called (when the RxPlayer considers that the initial seek should be done).

    I also had to add getPendingSeekInformation method, sadly. I feel that we could do without it if we're smarter about things, but I wanted to avoid changing too much code here.

    I also thought about reworking the initial seek so it is completely handled by the MediaElementPlaybackObserver - as it could make everything simpler - but I chose for now to implement that less disruptive "seek-blocking" mechanism.

    Note that technically, we could still have an application directly updating the HTMLMediaElement.prototype.currentTime property, or even a web feature such as picture-in-picture doing that. I ensured that this eventuality did not break anything. Still, there will be a preference for pending seeks performed through the MediaElementPlaybackObserver over such "HTML5 seeks" performed during that time (if there is a "pending seek", we will apply it regardless of if an "HTML5 seek" happened since then).

I'm now unsure if the getPosition or getCurrentBufferGap API should now return that planned position. I did nothing for those yet.

@peaBerberian peaBerberian force-pushed the misc/seek-to-before-initial branch 2 times, most recently from 1a7a15d to f477269 Compare December 19, 2024 17:19
@peaBerberian peaBerberian added API Relative to the RxPlayer's API proposal This Pull Request or Issue is only a proposal for a change with the expectation of a debate on it skip-performance-checks Performance tests are not run on this PR labels Dec 19, 2024
@peaBerberian peaBerberian force-pushed the misc/seek-to-before-initial branch 2 times, most recently from 8bb2583 to 6862827 Compare December 19, 2024 18:48
@peaBerberian peaBerberian added skip-performance-checks Performance tests are not run on this PR and removed skip-performance-checks Performance tests are not run on this PR labels Dec 19, 2024
@peaBerberian peaBerberian force-pushed the misc/seek-to-before-initial branch from 6862827 to 0988a00 Compare December 20, 2024 09:35
peaBerberian added a commit that referenced this pull request Dec 20, 2024
We have "performance" tests which allow to ensure that we're not having
what we could call "performance regressions", such as a higher delay to
have a content loaded from a `loadVideo` call.

I wanted to run them yesterday for #1607, but they hanged indefinitely.

Turns out that our static server script, that we use here just to host
and serve our testing scripts returned a promise that was never resolved.

_(Note: we don't rely on external test runners nor on test frameworks
for our performance tests, we manually detect and launch local
chrome + firefox binaries on a local server serving our bundled
scripts (themselves importing the RxPlayer), and at runtime those
scripts send results to another "result" server when they're done)_

It was never resolved because we never properly handled the case in that
script were we wanted to launch an HTTP server but not an HTTPS one for
the same resource(s). This is now fixed.

Hopeful that performance tests now work correctly, it's been a long time
since I last ran them.
peaBerberian added a commit that referenced this pull request Dec 20, 2024
This commit builds on #1607 to allow users of the demo to seek in the
content even as it is still loading.

In real use cases, a final user might rely on e.g. seeking thumbnails to
already know where to seek to without having to wait for initial
segments to be loaded.
This is a functionality we do see with other media players, YouTube also
does this for example.

To make the seeking bar more visible, I lightly changed its CSS rules.

Also, I conditioned the appearance of the "ProgressBar" based on if the
minimum and maximum seekable positions are known, as else, seeking in
that bar is not going to lead to a precize seek. This makes the content
not seekable until the Manifest has been loaded.
peaBerberian added a commit that referenced this pull request Dec 20, 2024
This commit builds on #1607 to allow users of the demo to seek in the
content even as it is still loading.

In real use cases, a final user might rely on e.g. seeking thumbnails to
already know where to seek to without having to wait for initial
segments to be loaded.
This is a functionality we do see with other media players, YouTube also
does this for example.

To make the seeking bar more visible, I lightly changed its CSS rules.

Also, I conditioned the appearance of the "ProgressBar" based on if the
minimum and maximum seekable positions are known, as else, seeking in
that bar is not going to lead to a precize seek. This makes the content
not seekable until the Manifest has been loaded.
peaBerberian added a commit that referenced this pull request Dec 23, 2024
This commit builds on #1607 to allow users of the demo to seek in the
content even as it is still loading.

In real use cases, a final user might rely on e.g. seeking thumbnails to
already know where to seek to without having to wait for initial
segments to be loaded.
This is a functionality we do see with other media players, YouTube also
does this for example.

To make the seeking bar more visible, I lightly changed its CSS rules.

Also, I conditioned the appearance of the "ProgressBar" based on if the
minimum and maximum seekable positions are known, as else, seeking in
that bar is not going to lead to a precize seek. This makes the content
not seekable until the Manifest has been loaded.
@peaBerberian peaBerberian force-pushed the misc/seek-to-before-initial branch from 5e0767c to 6c6d7c0 Compare December 23, 2024 10:20
@peaBerberian peaBerberian added skip-performance-checks Performance tests are not run on this PR and removed skip-performance-checks Performance tests are not run on this PR labels Dec 23, 2024
@peaBerberian peaBerberian added this to the 4.3.0 milestone Dec 23, 2024
@peaBerberian peaBerberian added the Priority: 2 (Medium) This issue or PR has a medium priority. label Dec 26, 2024
peaBerberian added a commit that referenced this pull request Dec 27, 2024
This commit builds on #1607 to allow users of the demo to seek in the
content even as it is still loading.

In real use cases, a final user might rely on e.g. seeking thumbnails to
already know where to seek to without having to wait for initial
segments to be loaded.
This is a functionality we do see with other media players, YouTube also
does this for example.

To make the seeking bar more visible, I lightly changed its CSS rules.

Also, I conditioned the appearance of the "ProgressBar" based on if the
minimum and maximum seekable positions are known, as else, seeking in
that bar is not going to lead to a precize seek. This makes the content
not seekable until the Manifest has been loaded.
@peaBerberian peaBerberian force-pushed the misc/seek-to-before-initial branch from 6c6d7c0 to 9350f96 Compare December 27, 2024 09:57
peaBerberian added a commit that referenced this pull request Dec 27, 2024
This commit builds on #1607 to allow users of the demo to seek in the
content even as it is still loading.

In real use cases, a final user might rely on e.g. seeking thumbnails to
already know where to seek to without having to wait for initial
segments to be loaded.
This is a functionality we do see with other media players, YouTube also
does this for example.

To make the seeking bar more visible, I lightly changed its CSS rules.

Also, I conditioned the appearance of the "ProgressBar" based on if the
minimum and maximum seekable positions are known, as else, seeking in
that bar is not going to lead to a precize seek. This makes the content
not seekable until the Manifest has been loaded.
@peaBerberian peaBerberian force-pushed the misc/seek-to-before-initial branch from 9350f96 to 170500b Compare December 27, 2024 09:59
peaBerberian added a commit that referenced this pull request Dec 27, 2024
This commit builds on #1607 to allow users of the demo to seek in the
content even as it is still loading.

In real use cases, a final user might rely on e.g. seeking thumbnails to
already know where to seek to without having to wait for initial
segments to be loaded.
This is a functionality we do see with other media players, YouTube also
does this for example.

To make the seeking bar more visible, I lightly changed its CSS rules.

Also, I conditioned the appearance of the "ProgressBar" based on if the
minimum and maximum seekable positions are known, as else, seeking in
that bar is not going to lead to a precize seek. This makes the content
not seekable until the Manifest has been loaded.
@peaBerberian peaBerberian force-pushed the misc/seek-to-before-initial branch from 170500b to 50a5f66 Compare December 27, 2024 10:04
peaBerberian added a commit that referenced this pull request Dec 27, 2024
This commit builds on #1607 to allow users of the demo to seek in the
content even as it is still loading.

In real use cases, a final user might rely on e.g. seeking thumbnails to
already know where to seek to without having to wait for initial
segments to be loaded.
This is a functionality we do see with other media players, YouTube also
does this for example.

To make the seeking bar more visible, I lightly changed its CSS rules.

Also, I conditioned the appearance of the "ProgressBar" based on if the
minimum and maximum seekable positions are known, as else, seeking in
that bar is not going to lead to a precize seek. This makes the content
not seekable until the Manifest has been loaded.
@peaBerberian peaBerberian force-pushed the misc/seek-to-before-initial branch from 50a5f66 to 4120844 Compare December 27, 2024 10:13
peaBerberian added a commit that referenced this pull request Dec 27, 2024
This commit builds on #1607 to allow users of the demo to seek in the
content even as it is still loading.

In real use cases, a final user might rely on e.g. seeking thumbnails to
already know where to seek to without having to wait for initial
segments to be loaded.
This is a functionality we do see with other media players, YouTube also
does this for example.

To make the seeking bar more visible, I lightly changed its CSS rules.

Also, I conditioned the appearance of the "ProgressBar" based on if the
minimum and maximum seekable positions are known, as else, seeking in
that bar is not going to lead to a precize seek. This makes the content
not seekable until the Manifest has been loaded.
peaBerberian added a commit that referenced this pull request Dec 27, 2024
This commit builds on #1607 to allow users of the demo to seek in the
content even as it is still loading.

In real use cases, a final user might rely on e.g. seeking thumbnails to
already know where to seek to without having to wait for initial
segments to be loaded.
This is a functionality we do see with other media players, YouTube also
does this for example.

To make the seeking bar more visible, I lightly changed its CSS rules.

Also, I conditioned the appearance of the "ProgressBar" based on if the
minimum and maximum seekable positions are known, as else, seeking in
that bar is not going to lead to a precize seek. This makes the content
not seekable until the Manifest has been loaded.
@peaBerberian peaBerberian force-pushed the misc/seek-to-before-initial branch from 7d6d727 to fa77883 Compare December 27, 2024 10:17
peaBerberian added a commit that referenced this pull request Dec 30, 2024
We have "performance" tests which allow to ensure that we're not having
what we could call "performance regressions", such as a higher delay to
have a content loaded from a `loadVideo` call.

I wanted to run them yesterday for #1607, but they hanged indefinitely.

Turns out that our static server script, that we use here just to host
and serve our testing scripts returned a promise that was never resolved.

_(Note: we don't rely on external test runners nor on test frameworks
for our performance tests, we manually detect and launch local
chrome + firefox binaries on a local server serving our bundled
scripts (themselves importing the RxPlayer), and at runtime those
scripts send results to another "result" server when they're done)_

It was never resolved because we never properly handled the case in that
script were we wanted to launch an HTTP server but not an HTTPS one for
the same resource(s). This is now fixed.

Hopeful that performance tests now work correctly, it's been a long time
since I last ran them.
peaBerberian added a commit that referenced this pull request Jan 9, 2025
We have "performance" tests which allow to ensure that we're not having
what we could call "performance regressions", such as a higher delay to
have a content loaded from a `loadVideo` call.

I wanted to run them yesterday for #1607, but they hanged indefinitely.

Turns out that our static server script, that we use here just to host
and serve our testing scripts returned a promise that was never resolved.

_(Note: we don't rely on external test runners nor on test frameworks
for our performance tests, we manually detect and launch local
chrome + firefox binaries on a local server serving our bundled
scripts (themselves importing the RxPlayer), and at runtime those
scripts send results to another "result" server when they're done)_

It was never resolved because we never properly handled the case in that
script were we wanted to launch an HTTP server but not an HTTPS one for
the same resource(s). This is now fixed.

Hopeful that performance tests now work correctly, it's been a long time
since I last ran them.
@peaBerberian peaBerberian removed the skip-performance-checks Performance tests are not run on this PR label Jan 22, 2025
peaBerberian added a commit that referenced this pull request Jan 28, 2025
This commit builds on #1607 to allow users of the demo to seek in the
content even as it is still loading.

In real use cases, a final user might rely on e.g. seeking thumbnails to
already know where to seek to without having to wait for initial
segments to be loaded.
This is a functionality we do see with other media players, YouTube also
does this for example.

To make the seeking bar more visible, I lightly changed its CSS rules.

Also, I conditioned the appearance of the "ProgressBar" based on if the
minimum and maximum seekable positions are known, as else, seeking in
that bar is not going to lead to a precize seek. This makes the content
not seekable until the Manifest has been loaded.
@peaBerberian peaBerberian force-pushed the misc/seek-to-before-initial branch from fa77883 to bcdc354 Compare January 28, 2025 14:04
peaBerberian added a commit that referenced this pull request Mar 27, 2025
This commit builds on #1607 to allow users of the demo to seek in the
content even as it is still loading.

In real use cases, a final user might rely on e.g. seeking thumbnails to
already know where to seek to without having to wait for initial
segments to be loaded.
This is a functionality we do see with other media players, YouTube also
does this for example.

To make the seeking bar more visible, I lightly changed its CSS rules.

Also, I conditioned the appearance of the "ProgressBar" based on if the
minimum and maximum seekable positions are known, as else, seeking in
that bar is not going to lead to a precize seek. This makes the content
not seekable until the Manifest has been loaded.
@peaBerberian peaBerberian modified the milestones: 4.3.0, 4.4.0 Apr 7, 2025
@peaBerberian peaBerberian force-pushed the dev branch 2 times, most recently from 00fc806 to b7216b4 Compare April 15, 2025 18:14
peaBerberian added a commit that referenced this pull request Apr 22, 2025
This commit builds on #1607 to allow users of the demo to seek in the
content even as it is still loading.

In real use cases, a final user might rely on e.g. seeking thumbnails to
already know where to seek to without having to wait for initial
segments to be loaded.
This is a functionality we do see with other media players, YouTube also
does this for example.

To make the seeking bar more visible, I lightly changed its CSS rules.

Also, I conditioned the appearance of the "ProgressBar" based on if the
minimum and maximum seekable positions are known, as else, seeking in
that bar is not going to lead to a precize seek. This makes the content
not seekable until the Manifest has been loaded.
@peaBerberian peaBerberian force-pushed the misc/seek-to-before-initial branch 2 times, most recently from b087c76 to 8711b01 Compare April 22, 2025 18:27
peaBerberian added a commit that referenced this pull request Apr 22, 2025
This commit builds on #1607 to allow users of the demo to seek in the
content even as it is still loading.

In real use cases, a final user might rely on e.g. seeking thumbnails to
already know where to seek to without having to wait for initial
segments to be loaded.
This is a functionality we do see with other media players, YouTube also
does this for example.

To make the seeking bar more visible, I lightly changed its CSS rules.

Also, I conditioned the appearance of the "ProgressBar" based on if the
minimum and maximum seekable positions are known, as else, seeking in
that bar is not going to lead to a precize seek. This makes the content
not seekable until the Manifest has been loaded.
Comment on lines +1841 to 1889
this._priv_contentInfos.playbackObserver.setCurrentTime(positionWanted, false);
return positionWanted;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The public documentation does not mention the return value seekTo().
Wouldn't it be worth noticing that it returns the "calculated" time to seek to ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if that's something that would be truly needed by an application, so I'm comfortable letting this that way.

The idea of keeping it that way now is to not potentially-break some legacy code but without having to make it the actual documented API which would force us to maintain that aspect of the code in our v4.

What do you think?

Copy link
Collaborator

@Florent-Bouisset Florent-Bouisset Jul 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense in terms of not locking it into the public API for now.
But I feel like once we get the opportunity to make breaking changes (in v5), we should either make it explicit and document it properly as part of the API, or remove the return entirely if it’s not meant to be used.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For seekTo in a v5, I don't think returning currentTime is that useful, so I would probably remove it.

peaBerberian added a commit that referenced this pull request Jun 30, 2025
This commit builds on #1607 to allow users of the demo to seek in the
content even as it is still loading.

In real use cases, a final user might rely on e.g. seeking thumbnails to
already know where to seek to without having to wait for initial
segments to be loaded.
This is a functionality we do see with other media players, YouTube also
does this for example.

To make the seeking bar more visible, I lightly changed its CSS rules.

Also, I conditioned the appearance of the "ProgressBar" based on if the
minimum and maximum seekable positions are known, as else, seeking in
that bar is not going to lead to a precize seek. This makes the content
not seekable until the Manifest has been loaded.
@peaBerberian peaBerberian force-pushed the misc/seek-to-before-initial branch from 8711b01 to a106239 Compare June 30, 2025 12:40
@canalplus canalplus deleted a comment from github-actions bot Jun 30, 2025
peaBerberian added a commit that referenced this pull request Jul 8, 2025
This commit builds on #1607 to allow users of the demo to seek in the
content even as it is still loading.

In real use cases, a final user might rely on e.g. seeking thumbnails to
already know where to seek to without having to wait for initial
segments to be loaded.
This is a functionality we do see with other media players, YouTube also
does this for example.

To make the seeking bar more visible, I lightly changed its CSS rules.

Also, I conditioned the appearance of the "ProgressBar" based on if the
minimum and maximum seekable positions are known, as else, seeking in
that bar is not going to lead to a precize seek. This makes the content
not seekable until the Manifest has been loaded.
@peaBerberian peaBerberian force-pushed the misc/seek-to-before-initial branch from a106239 to 84742e6 Compare July 8, 2025 10:44
As #1600 signalled, there's currently no practical way to update the
initial position (configured through the `startAt` `loadVideo` option)
until `startAt` has actually been applied.

More generally, it's not possible to perform a `seekTo` call until the
initial seek has been performed on the content (the `seekTo` call
will just be ignored).

This commit proposes the following code updates to improve on that
situation:

  1. Tangentially related, we now schedule a JavaScript micro-task right
     at `ContentTimeBoundariesObserver`'s instantiation so the caller
     can catch `events` that were previously synchronously sent (I'm
     thinking here of the warnings for the `MEDIA_TIME_BEFORE_MANIFEST`
     and the `MEDIA_TIME_AFTER_MANIFEST` codes).

     Without this, we would wait for the next playback observation,
     which could happen a whole second later.

  2. I noticed that the position indicated through the `startAt`
     `loadVideo` option was bounded so it's inside the
     `[minimumPosition, maximumPosition]` range (as obtained from the
     Manifest). As [stated
     here](#1600 (comment))
     I personally think this is suboptimal.

     In my opinion, we should let the initial position go outside the
     range of the Manifest and let the application do its thing based on
     `MEDIA_TIME_BEFORE_MANIFEST` / `MEDIA_TIME_AFTER_MANIFEST` events.

     As to not totally change the behavior, I've only done so for
     dynamic contents (contents for which segments are added or removed,
     like live and contents that are being downloaded locally).

     VoD contents continue to have the previous behavior for now.

  3. I added a "seek-blocking" mechanism to the
     `MediaElementPlaybackObserver` and made all seek operations,
     including the one from `seekTo` go through it.

     The idea is that when it is blocked (as it is initially), we'll delay
     any seek operation (by marking it as a "pending seek") and only seek
     to the last one of those once the `unblockSeeking` method is called
     (when the RxPlayer considers that the initial seek should be done).

     I also had to add `getPendingSeekInformation` method, sadly. I feel
     that we could do without it if we're smarter about things, but I
     wanted to avoid changing too much code here.

     I also thought about reworking the initial seek so it is completely
     handled by the `MediaElementPlaybackObserver` - as it could make
     everything simpler - but I chose for now to implement that less
     disruptive "seek-blocking" mechanism for now.

     Note that technically, we could still have an application directly
     updating the `HTMLMediaElement.property.currentTime` property, or
     even a web feature such as picture-in-picture doing that.
     I ensured that this eventuality did not break anything. Still, there
     will be a preference for pending seeks performed through the
     `MediaElementPlaybackObserver` over such "HTML5 seeks" performed
     during that time (if there is a "pending seek", we will apply it
     regardless of if an "HTML5 seek" happened since then).

I'm now unsure if the `getPosition` or `getCurrentBufferGap` API should
now return that planned position. I did nothing for those yet.
This commit builds on #1607 to allow users of the demo to seek in the
content even as it is still loading.

In real use cases, a final user might rely on e.g. seeking thumbnails to
already know where to seek to without having to wait for initial
segments to be loaded.
This is a functionality we do see with other media players, YouTube also
does this for example.

To make the seeking bar more visible, I lightly changed its CSS rules.

Also, I conditioned the appearance of the "ProgressBar" based on if the
minimum and maximum seekable positions are known, as else, seeking in
that bar is not going to lead to a precize seek. This makes the content
not seekable until the Manifest has been loaded.
@peaBerberian peaBerberian force-pushed the misc/seek-to-before-initial branch from 84742e6 to d8c24aa Compare August 1, 2025 13:26
Copy link

github-actions bot commented Aug 1, 2025

? Automated performance checks have passed on commit 329a2f46ed32399e108c072800534341123b4f4a with the base branch dev.

Details

Performance tests 1st run output

No significative change in performance for tests:

Name Mean Median
loading 19.57ms -> 19.43ms (0.135ms, z: 4.47232) 27.00ms -> 26.70ms
seeking 19.05ms -> 18.37ms (0.677ms, z: 1.45708) 10.80ms -> 10.95ms
audio-track-reload 25.96ms -> 25.93ms (0.033ms, z: 0.38873) 37.80ms -> 37.95ms
cold loading multithread 46.69ms -> 45.41ms (1.277ms, z: 11.45987) 67.95ms -> 66.90ms
seeking multithread 34.34ms -> 31.71ms (2.627ms, z: 2.47217) 9.90ms -> 10.20ms
audio-track-reload multithread 25.64ms -> 25.49ms (0.152ms, z: 2.96551) 37.80ms -> 37.50ms
hot loading multithread 15.01ms -> 14.78ms (0.232ms, z: 5.25399) 21.75ms -> 21.45ms

@canalplus canalplus deleted a comment from github-actions bot Aug 1, 2025
@canalplus canalplus deleted a comment from github-actions bot Aug 1, 2025
@canalplus canalplus deleted a comment from github-actions bot Aug 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Relative to the RxPlayer's API Priority: 2 (Medium) This issue or PR has a medium priority. proposal This Pull Request or Issue is only a proposal for a change with the expectation of a debate on it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
腰椎退行性变是什么病 转氨酶高是什么病 锁水是什么意思 预防脑梗用什么药效果好 梦见小孩是什么意思
末法时代是什么意思 高血脂是什么意思 在岸人民币和离岸人民币什么意思 来龙去脉指什么生肖 酚妥拉明是什么药
7月18日是什么日子 丝光棉是什么面料 s925是什么 97年的牛是什么命 81是什么意思
独活主治什么病 白带发绿是什么原因 女人大腿粗代表什么 声音的高低叫什么 免疫力差吃什么可以增强抵抗力
闷骚什么意思jiuxinfghf.com 什么水果助消化hcv8jop2ns1r.cn 寄居蟹吃什么食物hcv9jop0ns5r.cn 藏红花什么人不能喝tiangongnft.com n2是什么hcv8jop1ns4r.cn
七月初七是什么星座kuyehao.com 长史相当于现在什么官hcv8jop2ns8r.cn 7月16是什么星座hcv8jop2ns7r.cn 玉米属于什么类cj623037.com 左侧小腹疼是什么原因hcv8jop7ns9r.cn
桔梗是什么shenchushe.com 荔枝肉是什么菜系hcv8jop3ns1r.cn 什么的水花hcv9jop2ns2r.cn 功能性消化不良是什么意思hcv9jop7ns4r.cn 胃切除手术后吃什么好hcv7jop9ns7r.cn
漂发是什么意思hcv7jop4ns8r.cn 什么是西米hcv9jop4ns5r.cn pcr检测是什么hcv7jop9ns6r.cn 什么大什么功hcv8jop0ns6r.cn 脸上涂什么可以美白hcv8jop0ns2r.cn
百度