aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/audiotrack/label/index.html
blob: e3666d9b553b2bd998b257896f2d5e47d4a390e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
title: AudioTrack.label
slug: Web/API/AudioTrack/label
tags:
  - API
  - Audio
  - Audio Track
  - AudioTrack
  - HTML DOM
  - Media
  - Property
  - Read-only
  - Reference
  - label
  - metadata
  - track
translation_of: Web/API/AudioTrack/label
---
<div>{{APIRef("HTML DOM")}}</div>

<p><span class="seoSummary">読み取り専用の <strong>{{domxref("AudioTrack")}}</strong><strong><code>label</code></strong> プロパティは、音声トラックの判読可能なラベルがあればそれを指定する文字列を返します。 それ以外の場合は、空の文字列を返します。</span></p>

<h2 id="Syntax" name="Syntax">構文</h2>

<pre class="syntaxbox">var <em>audioTrackLabel</em> = <em>AudioTrack</em>.label;</pre>

<h3 id="Value" name="Value"></h3>

<p>トラックのメタデータで利用可能な場合は、トラックの判読可能なラベルを指定する {{domxref("DOMString")}}。 それ以外の場合は、空の文字列(<code>""</code>)が返されます。</p>

<p>例えば、{{domxref("AudioTrack.kind", "kind")}}<code>"commentary"</code> のトラックには、<code>"監督 Mark Markmarkimark とスター Donna Donnalidon の解説"</code> のような <code>label</code> が付けられます。</p>

<h2 id="Example" name="Example"></h2>

<p>この例では、指定されたメディア要素の音声トラックを選択するためにユーザーインターフェイスで使用される可能性のあるトラックの kind とラベルの配列を返します。 リストは特定の kind のトラックのみを通過させるようにフィルタされます。</p>

<pre class="brush: js">function getTrackList(el) {
  var trackList = [];
  const wantedKinds = [
    "main", "alternative", "main-desc", "translation", "commentary"
  ];

  el.audioTracks.forEach(function(track) {
    if (wantedKinds.includes(track.kind)) {
      trackList.push({
        id: track.id,
        kind: track.kind,
        label: track.label
      });
    }
  });
  return trackList;
}</pre>

<p>結果の <code>trackList</code> には、<code>wantKinds</code> 配列のいずれかの <code>kind</code> の音声トラックの配列が含まれ、各エントリにはトラックの {{domxref("AudioTrack.id", "id")}}{{domxref("AudioTrack.kind", "kind")}}{{domxref("AudioTrack.label", "label")}} が含まれます。</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', 'media.html#dom-audiotrack-label', 'AudioTrack.label')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5 W3C', 'embedded-content-0.html#dom-audiotrack-label', 'AudioTrack.label')}}</td>
   <td>{{Spec2('HTML5 W3C')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>



<p>{{Compat("api.AudioTrack.label")}}</p>