Inject and go back
Inject a file into the stream live, and give the stream back to the publisher:
const api = 'https://media.example.com:8444/rest-api/v3';
const post = (method, body) =>
fetch(`${api}/inject3/${method}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
});
await post('startup', {
localStreamName: 'live',
resources: [
{
uri: 'file:///opt/media/break.mp4',
media: 'audio,video',
},
],
});
// back to the live stream
await post('terminate', { localStreamName: 'live' });
