From fdc9e00c544f2822bd5528fe11ad175c3d1ae660 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 1 May 2020 19:37:33 -0700 Subject: [PATCH] Add a friendly error message when no video traffic is received --- .../StreamFrameViewController.m | 33 +++++++++++++++---- moonlight-common/moonlight-common-c | 2 +- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/Limelight/ViewControllers/StreamFrameViewController.m b/Limelight/ViewControllers/StreamFrameViewController.m index 0744638..a85d8ab 100644 --- a/Limelight/ViewControllers/StreamFrameViewController.m +++ b/Limelight/ViewControllers/StreamFrameViewController.m @@ -236,15 +236,34 @@ dispatch_async(dispatch_get_main_queue(), ^{ // Allow the display to go to sleep now [UIApplication sharedApplication].idleTimerDisabled = NO; - if (errorCode == 0) { - [self returnToMainFrame]; - } else { - UIAlertController* conTermAlert = [UIAlertController alertControllerWithTitle:@"Connection Terminated" message:@"The connection was terminated" preferredStyle:UIAlertControllerStyleAlert]; - [conTermAlert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){ + + NSString* title; + NSString* message; + + switch (errorCode) { + case ML_ERROR_GRACEFUL_TERMINATION: [self returnToMainFrame]; - }]]; - [self presentViewController:conTermAlert animated:YES completion:nil]; + return; + + case ML_ERROR_NO_VIDEO_TRAFFIC: + title = @"Connection Error"; + message = @"No video received from host. Check the host PC's firewall and port forwarding rules."; + break; + + default: + title = @"Connection Terminated"; + message = @"The connection was terminated"; + break; } + + UIAlertController* conTermAlert = [UIAlertController alertControllerWithTitle:title + message:message + preferredStyle:UIAlertControllerStyleAlert]; + [Utils addHelpOptionToDialog:conTermAlert]; + [conTermAlert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){ + [self returnToMainFrame]; + }]]; + [self presentViewController:conTermAlert animated:YES completion:nil]; }); [_streamMan stopStream]; diff --git a/moonlight-common/moonlight-common-c b/moonlight-common/moonlight-common-c index 247b1fe..b46e06f 160000 --- a/moonlight-common/moonlight-common-c +++ b/moonlight-common/moonlight-common-c @@ -1 +1 @@ -Subproject commit 247b1fe0e32d80ce02ede4c2b4a835b9c085abe4 +Subproject commit b46e06fcf1b289bb6a3b2307c10e1a7274c5f3b5