aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/htmlmediaelement/error/index.html
blob: 5bd61758089c823eafe1987a7c9aa8e244b37bde (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
---
title: HTMLMediaElement.error
slug: Web/API/HTMLMediaElement/error
tags:
  - API
  - Audio
  - HTML DOM
  - HTMLMediaElement
  - Media
  - Property
  - Read-only
  - Reference
  - Video
  - Web
translation_of: Web/API/HTMLMediaElement/error
---
<div>{{APIRef("HTML DOM")}}</div>

<p><span class="seoSummary"><strong><code>HTMLMediaElement.error</code></strong> は最新のエラーの {{domxref("MediaError")}} オブジェクトです。 エラーが発生していない場合は <code>null</code> です。 要素が {{event("error")}} イベントを受け取ったら、このオブジェクトを調べることによって何が起こったのかについての詳細を決定することができます。</span></p>

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

<pre class="syntaxbox">var <em>myError</em> = <em>HTMLMediaElement</em>.error;</pre>

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

<p>メディア要素で発生した最新のエラーを説明する {{domxref("MediaError")}} オブジェクト。 エラーが発生していない場合は <code>null</code></p>

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

<p>この例では動画要素を設けて、それにエラーハンドラを追加しています。 エラーハンドラは単に詳細をコンソールに記録します。</p>

<pre class="brush: js">var videoElement = document.createElement('video');
videoElement.onerror = function() {
  console.log("Error " + videoElement.error.code + "; details: " + videoElement.error.message);
}
videoElement.src = "https://example.com/bogusvideo.mp4";
</pre>

<h2 id="Specifications" name="Specifications">仕様</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">仕様</th>
   <th scope="col">状態</th>
   <th scope="col">コメント</th>
  </tr>
  <tr>
   <td>{{SpecName('HTML WHATWG', "#dom-media-error", "HTMLMediaElement.error")}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5 W3C', "embedded-content-0.html#htmlmediaelement", "HTMLMediaElement.error")}}</td>
   <td>{{Spec2('HTML5 W3C')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

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



<p>{{Compat("api.HTMLMediaElement.error")}}</p>

<h2 id="See_Also" name="See_Also">関連情報</h2>

<ul>
 <li>これを定義するインターフェース、{{domxref("HTMLMediaElement")}}</li>
 <li>{{HTMLElement("audio")}}{{HTMLElement("video")}}</li>
</ul>