Allow both HTTP and local URLs for playerConfig

develop
LEdoian 3 years ago
parent 8d1dffc743
commit f7dea469f8

@ -75,8 +75,19 @@ namespace QuickPlay
};
public PlayerConfiguration GetPlayerConfig()
{
// TODO: decide sensibly
var cfgProvider = new HttpConfigurationProvider(playerConfigUrl);
IPlayerConfigurationProvider cfgProvider;
if (playerConfigUrl.StartsWith("http:") || playerConfigUrl.StartsWith("https:"))
{
cfgProvider = new HttpConfigurationProvider(playerConfigUrl);
} else if (playerConfigUrl.StartsWith("file://"))
{
string filename = playerConfigUrl.Substring("file://".Length);
var reader = new StreamReader(filename);
cfgProvider = new FileConfigurationProvider(reader);
} else
{
throw new InvalidOperationException("Schema of player config URL not supported");
}
return cfgProvider.GetConfigurationAsync().Result; // Bad code, but hopefully we dont hang.
}

Loading…
Cancel
Save