// This constructor is for when using my cheap IoC public ConversationManager() { this.signaller = CheapContainer.Resolve <ISignallingService>(); this.peerManager = CheapContainer.Resolve <IPeerManager>(); this.peerManager.OnIceCandidate += this.OnLocalIceCandidateDeterminedAsync; this.mediaManager = CheapContainer.Resolve <IMediaManager>(); this.dispatcherProvider = CheapContainer.Resolve <IDispatcherProvider>(); }
async void Start() { CheapContainer.Register <ISignallingService, Signaller>(); CheapContainer.Register <IDispatcherProvider, DispatcherProvider>(); CheapContainer.Register <ITextureDetailsProvider, TextureDetailsProvider>(); var provider = CheapContainer.Resolve <ITextureDetailsProvider>(); provider.Details = this.TextureDetails; CheapContainer.Register <IMediaManager, MediaManager>(); CheapContainer.Register <IPeerManager, PeerManager>(); CheapContainer.Register <IConversationManager, ConversationManager>(); var conversationManager = CheapContainer.Resolve <IConversationManager>(); conversationManager.IsInitiator = this.IsInitiator; // TODO: not really found a good way of abstracting this but I think it has to be called. // Does it need moving into the Media Manager and linking to the widths/heights in there? // I think I ramped it down to 856? 896? some such. WebRTC.SetPreferredVideoCaptureFormat(896, 504, 30); // TODO: This is here right now as it feels like a bunch of work gets marshalled // back (via Sync Context?) to this thread which then gums up the UI but we'd // like to understand better what that work is. Task.Run( async() => { await conversationManager.InitialiseAsync(this.HostName, this.remotePeerName); if (await conversationManager.ConnectToSignallingAsync(this.ServerIP, this.PortNumber, "H264", 90000)) { // We're good! } } ); }
// Intention is that this constructor is used when using our cheap IoC. public PeerManager() { this.mediaManager = CheapContainer.Resolve <IMediaManager>(); }
// This constructor will be used by the cheap IoC container public MediaManager() { this.textureDetails = CheapContainer.Resolve <ITextureDetailsProvider>(); }