Skip to content

Latest commit

 

History

History

subscribeAudioOnly

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Subscribing with Audio Only

This example demonstrates playback of a stream with audio only.

Please refer to the Basic Subscriber Documentation to learn more about the basic setup.

Example Code

Audio Element

The audio element is used for the assignment of the media stream blob:

<audio id="red5pro-subscriber" controls autoplay class="red5pro-media"></audio>

Subscribing & Playback

Initialization and playback of a Red5 Pro stream in an audio element is similar to one in a video element:

var subscriber = new WHEPClient()
subscriber
  .init(config)
  .then(function () {
    return subscriber.subscribe()
  })
  .then(function () {
    console.log('Successfully started a subscription session!')
  })
  .catch(function (error) {
    console.error('Could not start a subscription session: ' + error)
  })