DOM

HTMLMediaElement:volumechange イベント

 編集:2022.11.03 by T.A.

[Edge]。→

HTMLMediaElement の音量が更新されたときに発行されます。

mdn: ボリュームが変更されたときに発生します。

バブリング なし
キャンセル可能 いいえ¶
インターフェイス Event
イベント ハンドラー プロパティ onvolumechange

GlobalEventHandlers でイベント ハンドラーが定義されている。

HTML:

<VIDEO id=IdTest src="../../Sample/Eizou_M.mp4" controls></VIDEO><BR>
<SPAN id=IdLog></SPAN>

JavaScript:

function Job(eve){   //volumechange イベントの処理:
  D=eve;
//  eve.preventDefault();     //イベントの処理動作を行うべきではない…とブラウザーに伝える。
//  DA=eve.defaultPrevented;  //その結果。true
  IdLog.innerHTML=IdLog.innerHTML+"●";
}
IdTest.onvolumechange=Job;  //イベント割り当て。

IdTest.volume=0.5;

音量変更をキャンセルはできないようだ。

得られた内容:D

=[object]:[object Event]
isTrusted=[boolean]:true
type=[string]:volumechange
target=[object]:[object HTMLVideoElement]
currentTarget=[object]:null
eventPhase=[number]:0
bubbles=[boolean]:false
cancelable=[boolean]:true
defaultPrevented=[boolean]:false
composed=[boolean]:false

cancelable=[boolean]:true となっているが。


テスト