aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/videotracklist/onchange/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/ja/web/api/videotracklist/onchange/index.html')
-rw-r--r--files/ja/web/api/videotracklist/onchange/index.html76
1 files changed, 76 insertions, 0 deletions
diff --git a/files/ja/web/api/videotracklist/onchange/index.html b/files/ja/web/api/videotracklist/onchange/index.html
new file mode 100644
index 0000000000..bdcdf85f01
--- /dev/null
+++ b/files/ja/web/api/videotracklist/onchange/index.html
@@ -0,0 +1,76 @@
+---
+title: VideoTrackList.onchange
+slug: Web/API/VideoTrackList/onchange
+tags:
+ - API
+ - Adding Tracks
+ - Adding Video Tracks
+ - Event Handler
+ - HTML DOM
+ - Media
+ - Property
+ - Reference
+ - Video
+ - VideoTrackList
+ - addTrack
+ - onchange
+ - track
+translation_of: Web/API/VideoTrackList/onchange
+---
+<div>{{APIRef("HTML DOM")}}</div>
+
+<p><span class="seoSummary"><strong>{{domxref("VideoTrackList")}}</strong> の <strong><code>onchange</code></strong> プロパティは、{{event("change")}} イベントが発生したときに呼び出されるイベントハンドラで、<code>VideoTrackList</code> 内の {{domxref("VideoTrack")}} がアクティブになったことを示します。</span></p>
+
+<p>イベントは {{domxref("Event")}} オブジェクトの形式でイベントハンドラに渡されます。 イベントは追加情報を提供しません。 メディアのトラックの新しい状態を判断するには、それらの {{domxref("VideoTrack.selected")}} フラグを確認する必要があります。</p>
+
+<div class="note">
+<p><strong>注</strong>: {{domxref("EventTarget.addEventListener", "addEventListener()")}} を使用して、<code>change</code> イベントのハンドラを追加することもできます。</p>
+</div>
+
+<h2 id="Syntax" name="Syntax">構文</h2>
+
+<pre class="syntaxbox"><em>VideoTrackList</em>.onchange = <em>eventHandler</em>;</pre>
+
+<h3 id="Value" name="Value">値</h3>
+
+<p><code>onchange</code> は、トラックがアクティブになるたびに呼び出されるべき関数を設定します。</p>
+
+<h2 id="Example" name="Example">例</h2>
+
+<p>このスニペットは、リスト内の各トラックを調べる {{event("change")}} イベントのハンドラを確立し、トラックの現在の状態を示すユーザーインターフェイスコントロールの状態を更新する関数を呼び出します。</p>
+
+<pre class="brush: js">var trackList = document.querySelector("video").videoTracks;
+
+trackList.onchange = function(event) {
+ trackList.forEach(function(track) {
+ updateTrackSelectedButton(track.id, track.selected);
+ });
+};
+</pre>
+
+<p>この例の <code>updateTrackSelectedButton()</code> は、トラックの {{domxref("VideoTrack.id", "id")}}(おそらくアプリはトラック ID をコントロール要素の ID として使用します)でユーザーインターフェイスコントロールを見つけて、トラックの {{domxref("VideoTrack.selected", "selected")}} フラグを使用してコントロールが現在どの状態にあるべきかを決定する関数です。</p>
+
+<h2 id="Specifications" name="Specifications">仕様</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">仕様</th>
+ <th scope="col">状態</th>
+ <th scope="col">コメント</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('HTML WHATWG', '#handler-tracklist-onchange', 'VideoTrackList: onchange')}}</td>
+ <td>{{Spec2('HTML WHATWG')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>
+
+
+
+<p>{{Compat("api.VideoTrackList.onchange")}}</p>