From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../htmlmediaelement/timeupdate_event/index.html | 130 +++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 files/ja/web/api/htmlmediaelement/timeupdate_event/index.html (limited to 'files/ja/web/api/htmlmediaelement/timeupdate_event') diff --git a/files/ja/web/api/htmlmediaelement/timeupdate_event/index.html b/files/ja/web/api/htmlmediaelement/timeupdate_event/index.html new file mode 100644 index 0000000000..286113c0e1 --- /dev/null +++ b/files/ja/web/api/htmlmediaelement/timeupdate_event/index.html @@ -0,0 +1,130 @@ +--- +title: 'HTMLMediaElement: timeupdate イベント' +slug: Web/API/HTMLMediaElement/timeupdate_event +tags: + - Audio + - Event + - HTMLMediaElement + - Reference + - Video + - Web + - timeupdate +translation_of: Web/API/HTMLMediaElement/timeupdate_event +--- +
{{APIRef("HTMLMediaElement")}}
+ +

timeupdate イベントは、currentTime 属性で示される時刻が更新されたときに発生します。

+ +

イベントの頻度はシステムの負荷に依存しますが、およそ 4Hz と 66Hz との間でスローされます (イベントハンドラーが実行するのに 250 ms 以上かかることはないと仮定します)。ユーザーエージェントはシステム負荷とその都度イベントを処理する平均コストに基づいて、イベントの頻度を変えることが推奨されているため、ユーザーエージェントがビデオのデコード中に快適に処理できるよりも頻繁に UI 更新が行われることはありません。

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
バブリングなし
キャンセル可能不可
インターフェイス{{DOMxRef("Event")}}
対象Element
既定のアクションなし
イベントハンドラープロパティ{{domxref("GlobalEventHandlers.ontimeupdate")}}
仕様書HTML5 media
+ +

+ +

これらの例は、 HTMLMediaElement の timeupdate イベントのイベントリスナーを追加し、イベントが発生してイベントハンドラーが動作するときにメッセージを投稿します。なお、イベントの頻度はシステムの稼働状況に依存します。

+ +

addEventListener() の使用:

+ +
const video = document.querySelector('video');
+
+video.addEventListener('timeupdate', (event) => {
+  console.log('The currentTime attribute has been updated. Again.');
+});
+ +

ontimeupdate イベントハンドラープロパティの使用:

+ +
const video = document.querySelector('video');
+
+video.ontimeupdate = (event) => {
+  console.log('The currentTime attribute has been updated. Again.');
+};
+ +

仕様書

+ + + + + + + + + + + + + + + + + + +
仕様書状態
{{SpecName('HTML WHATWG', "media.html#event-media-timeupdate", "timeupdate media event")}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5 W3C', "embedded-content-0.html#event-media-timeupdate", "timeupdate media event")}}{{Spec2('HTML5 W3C')}}
+ +

ブラウザーの互換性

+ + + +

{{Compat("api.HTMLMediaElement.timeupdate_event")}}

+ + + + + +

関連情報

+ + -- cgit v1.2.3-54-g00ecf