Play two audio sources during a live video stream - azure-media-services

I'm working with the Azure Media Player( https://ampdemo.azureedge.net/ ). I need a second audio source (which will be music) to be overlaid on top of the video with presenter talking. I see there's the ability to select multiple audio streams if the video is stored on Azure. (English/spanish/etc...) However, in my case it will be video and presenter(talking) on the video live stream and I'd like to be able to select a music stream of the viewers choice during the live stream which will be stored music in Azure.
Is this possible?
Then take it to the next step, does the player provide the capability of setting the volume on each stream? If not, is the player extendable?

Azure Media Player(AMP) doesn't allow playing multiple audio streams at the same time. You could achieve your desired behavior by including a hidden HTML5 video player and use that to play your additional audio. You'll probably want to use javascript to "synchronize" the hidden video player with Azure Media Player, i.e. When AMP plays, you play the hidden video player. When AMP pauses, you pause the hidden video player.

Related

AVPlayer Add Delay to Audio but Not Video (Swift)

I have an HLS live stream (from an external source, not one I created or can edit) with video and several audio options. I can successfully change the audio to one of the alternatives, but the alternative audio the stream provides doesn't match up perfectly with with video (it's about 1.5 seconds ahead of the video).
Is there a way to have the AVPlayer delay the audio portion of the stream by some specified amount to correct for this? Or is that not possible?

How to mute local audio playback while still receiving raw audio data with Agora API?

I'm trying to play back raw audio data from an Agora remote stream through an AudioSource in Unity. For this, I have to first disable the default playback method used by the Agora SDK. I have tried MuteAllRemoteAudioStreams but this stops the API from receiving remote audio data altogether.
I have also tried AdjustPlaybackSignalVolume and AdjustAudioMixingVolume, which successfully mute the audio playback but this also makes the OnPlaybackAudioFrameHandler callback receive empty audio frames, stopping me from accessing raw audio data.
SetAudioPlaybackDeviceMute simply mutes the playback device, which is not what I am looking for.
Is there a way to only mute the playback of remote streams while also being able to access raw audio data?
Try mRtcEngine.AdjustPlaybackSignalVolume(0);
This will turn the playback volume from the channel, but your AudioSource volume is not affected.
If you have other issues, please come chat with us and search for answers in our slack group:
https://agoraiodev.slack.com/messages/unity-help-me

How to play video while it is downloading using AVPro video in unity3D?

I want to play the video simultaneously while it is downloading via unitywebrequest. Will AVPro video support this? If so please provide me some guidance, as i am new to unity and avpro video. I can able to play the video which is downloaded fully through FullscreenVideo.prefab in AVPro demo. Any help will be much appreciated.
There are two main options you could use for displaying the video while it is still downloading.
Through livestream
You can stream a video to AVPro video using the "absolute path or URL" option on the media player component, then linking this to a stream in rtsp, MPEG-DASH, HLS, or HTTP progressive streaming format. Depending on what platforms you will be targeting some of these options will work better than others
A table of which file format supports what platform can be found in the AVProVideo Usermanual that is included with AVProVideo from page 12 and onwards.
If you want to use streaming you also need to set the "internet access" option to "required" in the player settings, as a video cannot stream without internet access.
A video that is being streamed will automatically start/resume playing when enough video is buffered.
This does however require a constant internet connection which may not be ideal if you're targeting mobile devices, or unnecessary if you're planning to play videos in a loop.
HLS m3u8
HTTP Live Streaming (HLS) works by cutting the overall stream into shorter, manageable hunks of data. These chunks will then get downloaded in sequence regardless of how long the stream is. m3u8 is a file format that works with playlists that keeps information on the location of multiple media files instead of an entire video, this can then be fed into a HLS player that will play the small media files in sequence as dictated in the m3u8 file.
using this method is usefull if you're planning to play smaller videos on repeat as the user will only have to download each chunk of the video once, which you can then store for later use.
You can also make these chunks of video as long or short as you want, and set a buffer of how many chunks you want to have pre-loaded. if for example you set the chunk size to 5 seconds, with a buffer of 5 videos the only loading time you'll have is when loading the first 25 seconds of the video. once these first 5 chunks are loaded it will start playing the video and load the rest of the chunks in the background, without interrupting the video (given your internet speed can handle it)
a con to this would be that you have to convert all your videos to m3u8 yourself. a tool such as FFMPEG can help with this though.
references
HLS
m3u8
AVPro documentation

Record HTTP Live Streaming Video To File While Watching?

I am trying to create a streaming video DVR like functionality in an app I am developing. I have an HTTP Live Stream that I have successfully gotten to play on the iPad. I want the user to be able to push the "Record" button, and begin recording the video that is currently playing from that point. This video file will be accessible from the app or from the camera roll. Currently, I am using the MPMoviePlayerController object to play the video stream. I do not see any methods of accessing the data from the object in Apple's documentation. Here are some thoughts I had on ways of going about this.
1) Somehow access the video data from MPMoviePlayerController, and write this to a file. Or use another type of player object that will allow me to play the video and access the currently playing data.
2) Implement some sort of screen capture recording that gets a video capture of the iPad's screen. This would allow me to record the video in a "screenshot" sort of way.
3) Locate the HTTP Live Streaming video segments where they are stored by MPMoviePlayerController. Presumably they need to be stored somewhere on the iPad for playback. Is there a way of accessing these files?
4) Manually download the stream video segments over http while streaming the file. This seems like its not ideal since the stream would have to be downloaded twice.
5) This could work. Periodically download the video segments to the iPhone. Set up a local http server on the iPhone and server the videos to the MPMoviePlayerController. This way the video segments could be marked for recording and assembled into a video.
6) I do have control of the streaming server. I could write some server side code to record the video on the server end, then send the video to the iPad after the fact. I would rather not do this.
Has anyone done any of these things? Ideally the iPhone would just be able to access the video data somehow and easily record it. I would rather not get into options 4, 5, or 6 (above) if I don't have to.
Thanks in advance.
DVR on the device is somewhat not encouraged, due to the limited space available and other factors like battery life, processing power, cleanup procedures after the user stops the dvr, etc.
If you want to achieve DVR playback on iOS devices (or other devices using HLS), I suggest you keep the video server side. The live stream is already captured and segmented server side, all you would have to do is keep the segments a bit longer, instead of deleting them. By using the EXT-X-PLAYLIST-TYPE and EXT-X-MEDIA-SEQUENCE tags, you can suggest to the player that he's opening a live stream which has DVR (earlier) video available.
Alternatively, you can use a server that does that out of the box, for example Wowza. Here's an article on how to achieve this with Wowza

How do I jump to specific time with duration of an IIS streamed video in iOS?

If I have a video streaming server (e.g. IIS Media Services) with a live video streaming, I want the user to select from a list of interesting parts of that video and then play just that bit.
For example, if I'm interested in a 25s clip 20m into the full length I want to jump to that bit and then close the video player at the end.
(Answering my own question until someone betters it.)
There is an AVPlayer in the AVFoundation framework that can be used when you're after more sophisticated playback functionality.
On the IIS side, there is something called a PlayList that can be used to chunk up content that may work as an alternative.