Skip to main content

StreamerNode

caution

Mobile only.

The StreamerNode is an AudioScheduledSourceNode which represents a node that can decode and play Http Live Streaming data. Similar to all of AudioScheduledSourceNodes, it can be started only once. If you want to play the same sound again you have to create a new one.

AudioNode properties

Number of inputs0
Number of outputs1
Channel countdefined by underlying buffer
Channel count modemax
Channel interpretationspeakers

Constructor

BaseAudioContext.createStreamer()

Example

import React, { useRef } from 'react';
import {
AudioContext,
StreamerNode,
} from 'react-native-audio-api';

function App() {
const audioContextRef = useRef<AudioContext | null>(null);
if (!audioContextRef.current) {
audioContextRef.current = new AudioContext();
}
const streamer = audioContextRef.current.createStreamer();
streamer.initialize('link/to/your/hls/source');
streamer.connect(audioContextRef.current.destination);
streamer.start(audioContextRef.current.currentTime);
}

Methods

initialize

The above allows user to set any periodic wave.

ParametersTypeDescription
streamPathstringLink pointing to an external HLS source

Returns boolean indicating if setup of streaming has worked.