HTML | DOM Audio controller Property

The controller property returns the present media controller of the audio. By default, the audio element does not have a media controller. The media controller property will return a MediaController object.

Syntax:

audioObject.controller

Return Value:



  • MediaController:It represents the media controller of the audio.
    Object: MediaController Object properties/methods:

    • buffered – get the buffered ranges of the audio
    • seekable – get the seekable ranges of the audio
    • duration – get the duration of the audio
    • currentTime – get or set the playback position of the audio
    • paused – check if the audio is paused
    • play() – play the audio
    • pause() – pause the audio
    • played – check if the audio has been played
    • defaultPlaybackRate – get or set the default playback rate of the audio
    • playbackRate – get or set the current playback rate of the audio
    • volume – get or set the volume of the audio
    • muted – get or set if the audio is muted

Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <title>
        DOM Audio Controller Property
    </title>
</head>
  
<body style="text-align:center">
  
    <h1 style="color:green"
        GeeksforGeeks 
    </h1>
      
    <h2
        DOM Audio Controller Property
    </h2>
    <br>
  
    <audio id="audioid" controls>
        <source src=
                    type="audio/ogg">
          
        <source src=
                    type="audio/mpeg"
    </audio>
    <br>
      
    <button onclick="GFGaudio()">Click</button>
  
    <p id="demo"></p>
  
    <script>
        function GFGaudio() {
            var gfg = document.getElementById("audioid").controller;
            document.getElementById("demo").innerHTML = gfg;
        }
    </script>
</body>
  
</html>

chevron_right


Output:

  • Before Clicking the Button:
  • After Clicking the Button:

Supported Browsers: The browsers supported by HTML DOM Audio controller property are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera

full-stack-img




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.