Skip to content

Commit

Permalink
Implement: FallbackToEdge #305
Browse files Browse the repository at this point in the history
  • Loading branch information
dasgarner committed Jul 11, 2023
1 parent 3e6ee70 commit 80c6093
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
8 changes: 4 additions & 4 deletions Rendering/Media.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -661,12 +661,12 @@ public static Media Create(MediaOptions options)
case "datasetview":
case "ticker":
case "text":
media = new WebCef(options);
media = WebMedia.GetConfiguredWebMedia(options, true);
break;

case "webpage":
options.IsPinchToZoomEnabled = true;
media = WebMedia.GetConfiguredWebMedia(options);
media = WebMedia.GetConfiguredWebMedia(options, false);
break;

case "flash":
Expand All @@ -680,7 +680,7 @@ public static Media Create(MediaOptions options)

case "htmlpackage":
options.IsPinchToZoomEnabled = true;
media = WebMedia.GetConfiguredWebMedia(options);
media = WebMedia.GetConfiguredWebMedia(options, false);
((WebMedia)media).ConfigureForHtmlPackage();
break;

Expand All @@ -695,7 +695,7 @@ public static Media Create(MediaOptions options)
default:
if (options.render == "html")
{
media = WebMedia.GetConfiguredWebMedia(options);
media = WebMedia.GetConfiguredWebMedia(options, true);
}
else
{
Expand Down
12 changes: 10 additions & 2 deletions Rendering/WebIe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,16 @@ private void _webBrowser_Navigated(object sender, System.Windows.Navigation.Navi
activeX.Silent = true;

// Initialise Interactive Control
_webBrowser.InvokeScript("xiboIC.config({hostname:\"localhost\", port: "
+ ApplicationSettings.Default.EmbeddedServerPort + "})");
try
{
_webBrowser.InvokeScript("xiboIC.config({hostname:\"localhost\", port: "
+ ApplicationSettings.Default.EmbeddedServerPort + "})");
}
catch
{
// Likely xiboIC doesn't exist.
LogMessage.Audit("WebIe", "_webBrowser_Navigated", "Cannot invoke script");
}
}

private void IeWebMedia_HtmlUpdatedEvent(string url)
Expand Down
20 changes: 17 additions & 3 deletions Rendering/WebMedia.cs
Original file line number Diff line number Diff line change
Expand Up @@ -469,14 +469,28 @@ public static string ReadBrowserType(string template)
/// Get the configured web media engine
/// </summary>
/// <param name="options"></param>
/// <param name="isHtmlWidget">Is this for a html widget?</param>
/// <returns></returns>
public static WebMedia GetConfiguredWebMedia(MediaOptions options)
public static WebMedia GetConfiguredWebMedia(MediaOptions options, bool isHtmlWidget)
{
// IE fallback for legacy players where overlapping regions are not supported
if (ApplicationSettings.Default.FallbackToInternetExplorer)
{
return new WebIe(options);
}
else if (!string.IsNullOrEmpty(options.uri) && !string.IsNullOrEmpty(ApplicationSettings.Default.EdgeBrowserWhitelist))

// If this is a HTML widget, then always return with CEF
if (isHtmlWidget)
{
return new WebCef(options);
}

// If we have an edge fallback, use it, otherwise see if the URL provided is in the white list.
if (ApplicationSettings.Default.FallbackToEdge)
{
return new WebEdge(options);
}
else if (!string.IsNullOrEmpty(options.uri) && !string.IsNullOrEmpty(ApplicationSettings.Default.EdgeBrowserWhitelist))
{
// Decode the URL
string url = Uri.UnescapeDataString(options.uri);
Expand Down Expand Up @@ -518,7 +532,7 @@ public static WebMedia GetConfiguredWebMedia(MediaOptions options, string type)
}
else
{
media = GetConfiguredWebMedia(options);
media = GetConfiguredWebMedia(options, false);
}
return media;
}
Expand Down
1 change: 1 addition & 0 deletions default.config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<EmbeddedServerPort>9696</EmbeddedServerPort>
<EmbeddedServerAllowWan>false</EmbeddedServerAllowWan>
<ScreenShotSize>0</ScreenShotSize>
<FallbackToEdge>false</FallbackToEdge>
<FallbackToInternetExplorer>false</FallbackToInternetExplorer>
<AggregationLevel>individual</AggregationLevel>
<IsRecordGeoLocationOnProofOfPlay>false</IsRecordGeoLocationOnProofOfPlay>
Expand Down

0 comments on commit 80c6093

Please sign in to comment.