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() public PlayerConfiguration GetPlayerConfig()
{ {
// TODO: decide sensibly IPlayerConfigurationProvider cfgProvider;
var cfgProvider = new HttpConfigurationProvider(playerConfigUrl); 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. return cfgProvider.GetConfigurationAsync().Result; // Bad code, but hopefully we dont hang.
} }

Loading…
Cancel
Save