HLS is not playing on samsung TV but play on emulator - http-live-streaming

I'm trying to play Apple HLS stream on samsung TV:
https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8
Model code:UE40F5500
Version : 5.2481
Any idea why?

Playlist contains audio-only track. Usually SmartTV's not support this and refuse to play such playlist or throw error during track switching.
If you look at playlist:
$curl https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8
You will see last track without video:
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=232370,CODECS="mp4a.40.2, avc1.4d4015"
gear1/prog_index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=649879,CODECS="mp4a.40.2, avc1.4d401e"
gear2/prog_index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=991714,CODECS="mp4a.40.2, avc1.4d401e"
gear3/prog_index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1927833,CODECS="mp4a.40.2, avc1.4d401f"
gear4/prog_index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=41457,CODECS="mp4a.40.2"
gear0/prog_index.m3u8
Such track is required by Apple to allow playback of audio over mobile internet, so you can't use playlists from iOS on SmartTV.

Related

DiscordJS audio playback with multiple streams

I'm trying to create a discord bot using discord.js that is able to both play music and sound effects.
The bot correctly plays music, but when trying to play a sound effect during music playback, the sound effect never starts/ends.
I have the following code for playing sound effects.
function play(guildID, serverQueue, resource){
const newAudioPlayer = createAudioPlayer();
const oldAudioPlayer = serverQueue.audioPlayer;
const connection = getVoiceConnection(guildID)
oldAudioPlayer.pause();
connection.subscribe(newAudioPlayer);
newAudioPlayer.on(AudioPlayerStatus.Idle, () => {
console.log("Done playing");
connection.subscribe(oldAudioPlayer);
oldAudioPlayer.unpause();
newAudioPlayer.stop();
}).on('error', err => {
console.log("Something went wrong when trying to play sound effect");
console.log(err);
connection.subscribe(oldAudioPlayer);
oldAudioPlayer.unpause();
newAudioPlayer.stop();
})
newAudioPlayer.play(resource);
console.log("Trying to play");
}
I realize that a voice connection can only subscribe to one audioplayer at a time and that an audioplayer can only play one resource at a time. This is why, I create a new temporary audio player called "newAudioPlayer" that will play the short sound effect. I then pause the old audio player and subscribe the connection to the new audio player.
The sound effect is correctly played as long as the oldAudioPlayer has not been used to play a resource before. As soon as the oldAudioPlayer has been used to play a resource, the newAudioPlayer never starts playing the resource. I have checked all the different AudioPlayerStates for the newAudioPlayer, but none of them get triggered.
serverQueue.audioPlayer is initialized when a voice channel is joined, and is always set.
The program does print "Trying to play" but no audio can be heard.
Apparently this is a known issue with discord.js:
https://github.com/discordjs/discord.js/issues/7232
The workaround is to play the local file as a stream if the file for the other audioPlayer is also reading a stream.

Screen Recording with both headphone & system audio

I am trying to build a web-application with the functionality of screen-recording with system audio + headphone-mic audio being captured in the saved video.
I have been thoroughly googling on a solution for this, however my findings show multiple browser solutions where the above works so long as headphones are NOT connected, meaning the microphone input is coming from the system rather than headset.
In the case that you connect headphones, all of these solutions capture the screen without video-audio, and the microphone audio from my headset. So to re-clarify on this, it should have recorded video-audio from the video being played whilst recording, and the headset-mic audio also.
This is thoroughly available in native applications, however I am searching for a way to do this on a browser.
If there are no solutions for this currently that anybody knows of, some insight on the limitations around developing this would also really help, thank you.
Your browser manages the media input being received in the selected tab/window
To receive media input, you need to ensure you have the checkbox Share Audio in the image below checked. However this will only record media-audio being played in your headphones, when it comes to receiving microphone audio, the opposite must be done i.e the checkbox should be unchecked, or merge the microphone audio separately on saving the recorded video
https://slack-files.com/T1JA07M6W-F0297CM7F32-89e7407216
create two const, one retrieving on-screen video, other retrieving audio media:
const DISPLAY_STREAM = await navigator.mediaDevices.getDisplayMedia({video: {cursor: "motion"}, audio: {'echoCancellation': true}}); // retrieving screen-media
const VOICE_STREAM = await navigator.mediaDevices.getUserMedia({ audio: {'echoCancellation': true}, video: false }); // retrieving microphone-media
Use AudioContext to retrieve audio sources from getUserMedia() and getDisplayMedia() separately:
const AUDIO_CONTEXT = new AudioContext();
const MEDIA_AUDIO = AUDIO_CONTEXT.createMediaStreamSource(DISPLAY_STREAM); // passing source of on-screen audio
const MIC_AUDIO = AUDIO_CONTEXT.createMediaStreamSource(VOICE_STREAM); // passing source of microphone audio
Use the method below to create a new audio source which will be used as as the merger or merged version of audio, then passing audios into the merger:
const AUDIO_MERGER = AUDIO_CONTEXT.createMediaStreamDestination(); // audio merger
MEDIA_AUDIO.connect(AUDIO_MERGER); // passing media-audio to merger
MIC_AUDIO.connect(AUDIO_MERGER); // passing microphone-audio to merger
Finally, connect the merged-audio and video together into one array to form a track, and pass it to the MediaStreamer:
const TRACKS = [...DISPLAY_STREAM.getVideoTracks(), ...AUDIO_MERGER.stream.getTracks()] // connecting on-screen video with merged-audio
stream = new MediaStream(TRACKS);

Web Audio API merging audio in single channel doesn't fully work

I have a video and a WebRTC audio stream and want to use Web Audio API to send the audio from the video to the Left channel, while the WebRTC to the right channel. So basically I'm doing:
video = document.getElementsByTagName("video")[0]
video.src = "http://link/to/my/video"
video.load()
audioContext = new AudioContext()
videoSourceL = audioContext.createMediaElementSource(video)
#create merger with 2 inputs, left (0) and right (1)
merger = audioContext.createChannelMerger(2)
merger.connect(audioContext.destination)
#now strange work around for WebRTC
audio = new Audio();
audio.muted = true
audio.srcObject = remoteStream
audioStreamR = audioContext.createMediaStreamSource(remoteStream)
# connect remote audio stream channel 0 to input 1 (right)
audioStreamR.connect(merger, 0, 1)
#connect video source channel 0 to input 0 (left)
videoSourceL.connect(merger, 0, 0)
The problem I have is that although the remote audio does go to the right channel (And is not audible in the Left), the audio from the video is also still slightly present in the right channel. So basically I have audio bleeding. The weird thing is that if I redirect both the remote stream and the video to the same channel, then the other channel has absolute silence.
Whereas if I had used an oscillator in place of the video audio, I would have a perfect separation. Any idea what I'm doing wrong?
EDIT: I also tried from the OS audio settings to turn off the left channel, and the audio bleeding to the right channel stopped (also tried this on a colleagues machine), so is this maybe a hardware/configuration
issue?
Was a hardware issue after all, effect is not there with good headphones.

Samsung Smart TV App (not Tizen) audio plays only once

In a Samsung Smart TV App up to 2014 (not Tizen) I have tried two ways to play a short (about a second) audio file and tested it in the 2014 emulator 5.1:
index.html:
<!-- HTML5 audio tag -->
<audio id="audio" src="http://luniks.net/other/0-99A-Z/1.ogg"></audio>
<!-- Player plugin -->
<object id="pluginPlayer" classid="clsid:SAMSUNG-INFOLINK-PLAYER"></object>
Main.js:
Main.keyDown = function() {
var keyCode = event.keyCode;
// arrow left on remote control, just for testing
if (keyCode == 4) {
// HTML5 audio tag
document.getElementById("audio").play();
}
// arrow right on remote control, just for testing
if (keyCode == 5) {
// Player plugin
var playerObj = document.getElementById('pluginPlayer');
playerObj.Play("http://luniks.net/other/0-99A-Z/1.ogg");
}
};
Each way, the audio file is played only once during the app's lifecycle and only plays again when restarting the app.
I am not sure if the sound is muted or if audio doesn't play at all after it played once.
The same with a <video> tag works fine, the video can be repeatedly played without problems.
When a <video> tag is present (defined after the <audio> tag), the <audio> tag does nothing.
When playing audio with the Player plugin while the video is playing, the video continues to play but is muted.
My final goal is to play a series of short audio files while a video that possibly has (low volume) sound is playing. From my experience so far, I can forget about that. Am I right?
Just add loop="true" in the audio tag and test. It works fine for me.

How to play audio in background with firefox os?

In my manifest file I've add the audio-channel-content in permissions:
"permissions": {
"audio-channel-content":{"description":"Use the audio channel for the music player"}
}
In my index.html I've got an audio tag like:
<audio mozaudiochannel="content" preload="none" src="http://my-stream-url"></audio>
I can play my audio stream during 2mn:
The first one when the phone is unlock.
After 1mn my phone auto-lock the screen and it continue playing for another minute.
Does it possible to play this audio stream more than 1mn after the lock?
Thanks in advance.
The code and permission block you have are correct and I can confirm it is working in Firefox OS 1.1. You can also do the whole thing in Javascript:
audio = new Audio();
audio.preload = 'none';
audio.mozAudioChannelType = 'content';
It's because the wifi is closed after screen shutdown (auto-lock)?
Are you using the dev version of gaia? Wifi is set to always connect in product version.

Resources