UWP live sound streaming project

0

I am trying to create a live communication project between two machines only with sound based on the windows sample. https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/SimpleCommunication . I am doing it in VB. What happens in the sample is that there is a mainpage and the user calls the scenario he wants to execute but in the main page (in a class called SampleConfiguration) is declared the MediaExtensionManager (line22) after that there is a void called EnsureMediaExtensionManager that registers scheme with the custom "stsp:" format. This is what I cannot do. So far I ve translated the sample succesfully and I can stream sound from my raspberry (I can hear it using the original sample written in C modified it only for sound) but I cannot register the StspSchemeHandler to work with my MediaElement and i always get a debug error MF_MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED : HRESULT - 0xC00D36C3 on the MediaFailed event of my MediaElement. If someone looks at the code of the sample lets say on Scenario2_VideoChat in line 42 EnsureMediaExtensionManager() is called.

public void EnsureMediaExtensionManager()
{
     if (mediaExtensionMgr == null)
     {
         mediaExtensionMgr = new Windows.Media.MediaExtensionManager();
         mediaExtensionMgr.RegisterSchemeHandler("Microsoft.Samples.SimpleCommunication.StspSchemeHandler", "stsp:");
     }
 }

But As far as I can understant this is called before everything else .. how can i call the same but using only one page ... MainPage thanks a lot

audio
uwp
live
asked on Stack Overflow Apr 15, 2018 by KoZe • edited Apr 15, 2018 by Brandon Minnick

2 Answers

0

how can i call the same but using only one page ... MainPage

I'm not sure why you say cannot do, but for this question, instead of calling the method in another page, you could just put the method implementation inside the MainPage. To ensure it is called before others, it should be put inside constructor method may be like follows:

Public NotInheritable Class MainPage
    Inherits Page
    Private mediaExtensionMgr As Windows.Media.MediaExtensionManager
    Public Sub New()
        Me.InitializeComponent()
        If (mediaExtensionMgr Is Nothing) Then
            mediaExtensionMgr = New Windows.Media.MediaExtensionManager()
            mediaExtensionMgr.RegisterSchemeHandler("Microsoft.Samples.SimpleCommunication.StspSchemeHandler", "stsp:")
        End If
    End Sub
End Class
answered on Stack Overflow Apr 16, 2018 by Sunteen Wu
0

Found it... After a painfull searching afternoon! 1) right click Package.appxmanifest -> view code 2)add this lines

    <Extensions>
    <Extension Category="windows.activatableClass.inProcessServer">
      <InProcessServer>
        <Path>Microsoft.Samples.SimpleCommunication.dll</Path>
        <ActivatableClass ActivatableClassId="Microsoft.Samples.SimpleCommunication.StspSchemeHandler" ThreadingModel="both"/>
      </InProcessServer>
    </Extension>
  </Extensions>

And then it works no matter where you call it...

answered on Stack Overflow Apr 16, 2018 by KoZe

User contributions licensed under CC BY-SA 3.0