Example #1
0
        public async Task Invoke(HttpContext httpContext, IStreamingService streamingService)
        {
            PathString startPath = $"{_options.Path}/push";
            PathString remainingPath;

            if (httpContext.Request.Path.StartsWithSegments(startPath, out remainingPath))
            {
                CancellationToken cancellationToken = httpContext.RequestAborted;
                var segments = remainingPath.Value.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);

                if (segments == null || !segments.Any() || string.IsNullOrWhiteSpace(segments[0]))
                {
                    var innerEx = new Exception($"The expected path must start with '{startPath}/{{channel}}', where {{channel}} represents the streaming channel name");
                    throw new ArgumentNullException("channel", innerEx);
                }

                var channelName      = segments[0];
                var streamingRequest = new HttpStreamingRequest
                {
                    Name              = channelName,
                    HttpContext       = httpContext,
                    CancellationToken = cancellationToken
                };

                await streamingService.Process(streamingRequest);
            }
            else
            {
                await _next.Invoke(httpContext);
            }
        }
Example #2
0
 public MainViewModel(IStreamingService streamingService, IMvxNavigationService navigationService, IMvxTrace trace) : base(navigationService, trace)
 {
     _streamingService  = streamingService;
     _navigationService = navigationService;
     _status            = "God's Way Radio - 104.7";
     _streamingService.LoadStream();
 }
Example #3
0
        public MainViewModel(CognitiveClient cognitiveClient, IStreamingService streamingService, ISpeechService speechService)
        {
            this.cognitiveClient  = cognitiveClient;
            this.streamingService = streamingService;
            this.speechService    = speechService;

            this.CreateCommands();
        }
        public OAuthWindowView(IStreamingService streamingService, IConfigHandler configHandler)
        {
            InitializeComponent();
            this.streamingService = streamingService ?? throw new ArgumentNullException(nameof(streamingService));
            this.configHandler    = configHandler ?? throw new ArgumentNullException(nameof(configHandler));

            OAuthWebBrowser.Source              = new Uri(streamingService.OAuthUrl);
            OAuthWebBrowser.NavigationStarting += OAuthWebBrowser_NavigationStarting;
        }
Example #5
0
 public TaleSourcesController(
     ILogger <TaleSourcesController> logger,
     IStreamingService streamingService,
     ITalesRepository talesRepository)
 {
     _logger           = logger;
     _streamingService = streamingService;
     _talesRepository  = talesRepository;
 }
 public DomainCustomersService(
     ICustomersRepository customersRepository,
     IPaymentService paymentService,
     IStreamingService streamingService)
 {
     this.customersRepository = customersRepository;
     this.paymentService      = paymentService;
     this.streamingService    = streamingService;
 }
Example #7
0
        public MainViewModel(IStreamingService streamingService, VisionServiceClient visionServiceClient, ITranslatorService translatorService,
                             ISpeechService speechService)
        {
            this.streamingService    = streamingService;
            this.visionServiceClient = visionServiceClient;
            this.translatorService   = translatorService;
            this.speechService       = speechService;

            this.CreateCommands();
        }
Example #8
0
        public MainViewModel(IStreamingService streamingService, ISpeechService speechService)
        {
            this.streamingService = streamingService;
            this.speechService    = speechService;

            this.CreateCommands();

            // Initializes vision extensions.
            var visionInitializeTask = VisionExtensions.InitializeAsync();
        }
 public MovieAcquisitionService(
     ICustomersRepository customersRepository,
     IPaymentService paymentService,
     IStreamingService streamingService
     )
 {
     this.customersRepository = customersRepository;
     this.paymentService      = paymentService;
     this.streamingService    = streamingService;
 }
Example #10
0
        public void RunAllScenarios(IStreamingService channel)
        {
            var requestedStreamSize = (Interlocked.Increment(ref _curStreamSize) * 3 + 1) % MaxStreamSize;
            // Are variations of the buffer size important?
            // Maybe, since just like the stream size they contribute to timing variations...
            var bufSize = Interlocked.Increment(ref _curBufferSize) % MaxBufferSize + 2;

            // Just run all 3 streaming scenarios here
            TestGetStreamFromInt(channel, requestedStreamSize, bufSize);
            TestGetIntFromStream(channel, requestedStreamSize, bufSize);
            TestEchoStream(channel, requestedStreamSize, bufSize);
        }
Example #11
0
 private void TestGetIntFromStream(IStreamingService channel, int requestedStreamSize, int bufSize)
 {
     using (var stream = new VerifiableStream(requestedStreamSize))
     {
         int receivedSize = channel.GetIntFromStream(stream);
         if (receivedSize != requestedStreamSize)
         {
             Console.WriteLine("We didn't receive the correct stream size. Stream size: " + requestedStreamSize + "received: " + receivedSize);
             System.Diagnostics.Debugger.Break();
         }
     }
 }
Example #12
0
 private void TestGetStreamFromInt(IStreamingService channel, int requestedStreamSize, int bufSize)
 {
     using (var stream = channel.GetStreamFromInt(requestedStreamSize))
     {
         var receivedStreamSize = VerifyStream(stream, requestedStreamSize, bufSize);
         if (receivedStreamSize != requestedStreamSize)
         {
             Console.WriteLine("Received stream is different size from the requested one. Expected size: " + requestedStreamSize + " received: " + receivedStreamSize);
             //if (requestedStreamSize % 384 != 0)
             System.Diagnostics.Debugger.Break();
         }
     }
 }
Example #13
0
 private void TestEchoStream(IStreamingService channel, int requestedStreamSize, int bufSize)
 {
     using (var stream = new VerifiableStream(requestedStreamSize))
     {
         using (var receivedStream = channel.EchoStream(stream))
         {
             var receivedSize = VerifyStream(receivedStream, requestedStreamSize, bufSize);
             if (receivedSize != requestedStreamSize)
             {
                 Console.WriteLine("Unexpected stream size: " + receivedSize);
                 //if (requestedStreamSize % 384 != 0)
                 System.Diagnostics.Debugger.Break();
             }
         }
     }
 }
Example #14
0
        private void cmdConnect_Click(object sender, EventArgs e)
        {
            if (CURRENT_IP == "127.0.0.1" || CURRENT_IP == "localhost")
            {
                mWebStreamClient = ChannelFactory <IWebStreamingService> .CreateChannel(new NetNamedPipeBinding()
                {
                    MaxReceivedMessageSize = 10000000
                }, new EndpointAddress("net.pipe://localhost/MPExtended/StreamingService"));

                mStreamClient = ChannelFactory <IStreamingService> .CreateChannel(new NetNamedPipeBinding()
                {
                    MaxReceivedMessageSize = 10000000
                }, new EndpointAddress("net.pipe://localhost/MPExtended/StreamingService"));

                mServiceClient = ChannelFactory <IMediaAccessService> .CreateChannel(new NetNamedPipeBinding()
                {
                    MaxReceivedMessageSize = 10000000
                }, new EndpointAddress("net.pipe://localhost/MPExtended/MediaAccessService"));

                mTvClient = ChannelFactory <ITVAccessService> .CreateChannel(new NetNamedPipeBinding()
                {
                    MaxReceivedMessageSize = 10000000
                }, new EndpointAddress("net.pipe://localhost/MPExtended/TVAccessService"));
            }
            else
            {
#pragma warning disable 0162
                mWebStreamClient = ChannelFactory <IWebStreamingService> .CreateChannel(new BasicHttpBinding(), new EndpointAddress("http://" + CURRENT_IP + ":4321/MPExtended/StreamingService"));

                mStreamClient = ChannelFactory <IStreamingService> .CreateChannel(new BasicHttpBinding(), new EndpointAddress("http://" + CURRENT_IP + ":4321/MPExtended/StreamingService"));

                mServiceClient = ChannelFactory <IMediaAccessService> .CreateChannel(new BasicHttpBinding(), new EndpointAddress("http://" + CURRENT_IP + ":4321/MPExtended/MediaAccessService"));

                mTvClient = ChannelFactory <ITVAccessService> .CreateChannel(new BasicHttpBinding(), new EndpointAddress("http://" + CURRENT_IP + ":4321/MPExtended/TVAccessService"));

#pragma warning restore 0162
            }

            Log("Initialized");

            // providers
            var config = mServiceClient.GetServiceDescription();
            movieProvider = config.AvailableMovieLibraries.First().Id;
            fileProvider  = config.AvailableFileSystemLibraries.First().Id;

            // load movies
            try
            {
                cbMovies.Items.Clear();
                mMovies = mServiceClient.GetMoviesDetailed(movieProvider, null, null);
                foreach (WebMovieDetailed movie in mMovies)
                {
                    cbMovies.Items.Add(movie.Title);
                }

                Log("Loaded movies");
            }
            catch (Exception)
            {
                Log("Failed to connect to MAS");
            }

            // load chanels
            try
            {
                cbChannels.Items.Clear();
                mChannels = new List <WebChannelBasic>();
                foreach (WebChannelGroup group in mTvClient.GetGroups())
                {
                    WebChannelBasic[] channels = mTvClient.GetChannelsBasic(group.Id).ToArray();
                    foreach (WebChannelBasic ch in channels)
                    {
                        cbChannels.Items.Add(ch.Title);
                        mChannels.Add(ch);
                    }
                }
                Log("Loaded channels");
            }
            catch (Exception)
            {
                Log("Failed to connect to TV4Home");
            }

            // load profiles
            try
            {
                cbProfiles.Items.Clear();
                mProfiles = mWebStreamClient.GetTranscoderProfiles();
                foreach (WebTranscoderProfile profile in mProfiles)
                {
                    cbProfiles.Items.Add(profile.Name);
                }
                cbProfiles.SelectedIndex = 0;
            }
            catch (Exception)
            {
                Log("Failed to load profiles");
            }
        }
Example #15
0
 public CameraController(ILogger <CameraController> logger, IStreamingService streamingService)
 {
     this.logger           = logger;
     this.streamingService = streamingService;
 }
Example #16
0
 public RemoveAndArchiveTracksCommandHandler(IStreamingService spotifyService)
 {
     _SpotifyService = spotifyService;
 }
Example #17
0
 public NowPlayingViewModel(IStreamingService streamingService, IMvxNavigationService navigationService, IDeviceTimer deviceTimer, IMvxTrace trace) : base(navigationService, trace)
 {
     _navigationService = navigationService;
     _deviceTimer       = deviceTimer;
 }
 public ResolveUserThroughTokenCommandHandler(IStreamingService streamingService)
 {
     _StreamingService = streamingService;
 }
Example #19
0
 public StartStreamCommand(IStreamingService streamingService)
 {
     this.streamingService = streamingService;
 }
Example #20
0
 public StreamingEndpoint(ILogger logger, IStreamingService streamingService, IMessageBus messageBus)
 {
     _logger           = logger;
     _streamingService = streamingService;
     _messageBus       = messageBus;
 }
Example #21
0
        private void cmdConnect_Click(object sender, EventArgs e)
        {
            if (CURRENT_IP == "127.0.0.1" || CURRENT_IP == "localhost")
            {

                mWebStreamClient = ChannelFactory<IWebStreamingService>.CreateChannel(new NetNamedPipeBinding() { MaxReceivedMessageSize = 10000000 }, new EndpointAddress("net.pipe://localhost/MPExtended/StreamingService"));
                mStreamClient = ChannelFactory<IStreamingService>.CreateChannel(new NetNamedPipeBinding() { MaxReceivedMessageSize = 10000000 }, new EndpointAddress("net.pipe://localhost/MPExtended/StreamingService"));
                mServiceClient = ChannelFactory<IMediaAccessService>.CreateChannel(new NetNamedPipeBinding() { MaxReceivedMessageSize = 10000000 }, new EndpointAddress("net.pipe://localhost/MPExtended/MediaAccessService"));
                mTvClient = ChannelFactory<ITVAccessService>.CreateChannel(new NetNamedPipeBinding() { MaxReceivedMessageSize = 10000000 }, new EndpointAddress("net.pipe://localhost/MPExtended/TVAccessService"));
            }
            else
            {
            #pragma warning disable 0162
                mWebStreamClient = ChannelFactory<IWebStreamingService>.CreateChannel(new BasicHttpBinding(), new EndpointAddress("http://" + CURRENT_IP + ":4321/MPExtended/StreamingService"));
                mStreamClient = ChannelFactory<IStreamingService>.CreateChannel(new BasicHttpBinding(), new EndpointAddress("http://" + CURRENT_IP + ":4321/MPExtended/StreamingService"));
                mServiceClient = ChannelFactory<IMediaAccessService>.CreateChannel(new BasicHttpBinding(), new EndpointAddress("http://" + CURRENT_IP + ":4321/MPExtended/MediaAccessService"));
                mTvClient = ChannelFactory<ITVAccessService>.CreateChannel(new BasicHttpBinding(), new EndpointAddress("http://" + CURRENT_IP + ":4321/MPExtended/TVAccessService"));
            #pragma warning restore 0162
            }

            Log("Initialized");

            // providers
            var config = mServiceClient.GetServiceDescription();
            movieProvider = config.AvailableMovieLibraries.First().Id;
            fileProvider = config.AvailableFileSystemLibraries.First().Id;

            // load movies
            try
            {
                cbMovies.Items.Clear();
                mMovies = mServiceClient.GetAllMoviesDetailed(movieProvider, null, null);
                foreach (WebMovieDetailed movie in mMovies)
                {
                    cbMovies.Items.Add(movie.Title);
                }

                Log("Loaded movies");
            }
            catch (Exception)
            {
                Log("Failed to connect to MAS");
            }

            // load chanels
            try
            {
                cbChannels.Items.Clear();
                mChannels = new List<WebChannelBasic>();
                foreach (WebChannelGroup group in mTvClient.GetGroups())
                {
                    WebChannelBasic[] channels = mTvClient.GetChannelsBasic(group.Id).ToArray();
                    foreach (WebChannelBasic ch in channels)
                    {
                        cbChannels.Items.Add(ch.DisplayName);
                        mChannels.Add(ch);
                    }
                }
                Log("Loaded channels");
            }
            catch (Exception)
            {
                Log("Failed to connect to TV4Home");
            }

            // load profiles
            try
            {
                cbProfiles.Items.Clear();
                mProfiles = mWebStreamClient.GetTranscoderProfiles();
                foreach (WebTranscoderProfile profile in mProfiles)
                {
                    cbProfiles.Items.Add(profile.Name);
                }
                cbProfiles.SelectedIndex = 0;
            }
            catch (Exception)
            {
                Log("Failed to load profiles");
            }
        }
Example #22
0
 public CreateOrUpdateUserCommandHandler(IStreamingService streamingService, IMediator mediator)
 {
     _StreamingService = streamingService;
     _Mediator         = mediator;
 }
 public VideosController(IStreamingService streamingService)
 {
     _streamingService = streamingService;
 }
Example #24
0
 public SortPlaylistCommandHandler(IStreamingService spotifyService)
 {
     _SpotifyService = spotifyService;
 }