master
wanggang 4 years ago
parent 436d8a5d7c
commit ab0ca7af82

@ -40,6 +40,17 @@
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Remove="wwwroot\favicon.ico" />
</ItemGroup>
<ItemGroup>
<Content Update="wwwroot\favicon.ico">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
<ItemGroup> <ItemGroup>
<None Update="license.dat"> <None Update="license.dat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

@ -6,6 +6,7 @@ using Serilog;
using Serilog.Core; using Serilog.Core;
using Serilog.Events; using Serilog.Events;
using System.Diagnostics; using System.Diagnostics;
using System.Net;
namespace PhotoCollector; namespace PhotoCollector;
@ -81,9 +82,35 @@ internal static class Program
webBuilder.UseSetting(WebHostDefaults.DetailedErrorsKey, "true"); webBuilder.UseSetting(WebHostDefaults.DetailedErrorsKey, "true");
webBuilder.UseContentRoot(AppContext.BaseDirectory); webBuilder.UseContentRoot(AppContext.BaseDirectory);
webBuilder.UseStartup<Startup>(); webBuilder.UseStartup<Startup>();
webBuilder.UseUrls("http://localhost:8440"); webBuilder.UseUrls($"http://localhost:{GetDynamicFreePort()}");
//webBuilder.UseUrls("http://localhost:48440");
}) })
.Build(); .Build();
await WebHost.StartAsync(); await WebHost.StartAsync();
} }
}
public static int GetDynamicFreePort()
{
var port = 49152;
while (port < 65535)
{
var listener = new HttpListener();
listener.Prefixes.Add($"http://localhost:{port}/");
try
{
listener.Start();
break;
}
catch
{
port++;
}
finally
{
listener.Stop();
listener.Close();
}
}
return port;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

@ -245,10 +245,11 @@
select.innerHTML = ""; select.innerHTML = "";
devices.forEach(function (device) { devices.forEach(function (device) {
console.log(device); console.log(device);
if (device.kind === 'videoinput' && device.label) { if (device.kind === 'videoinput' && device.groupId) {
select.insertAdjacentHTML('beforeend', `<option value="${device.deviceId}">${device.label}</option>`); select.insertAdjacentHTML('beforeend', `<option value="${device.deviceId}">${device.label ?? device.groupId}</option>`);
} }
}); });
console.dir(select);
if (select.children.length) { if (select.children.length) {
select.children[0].setAttribute("selected", "selected"); select.children[0].setAttribute("selected", "selected");
select.dispatchEvent(new Event('change')); select.dispatchEvent(new Event('change'));
@ -258,8 +259,8 @@
console.log(err.name + ": " + err.message); console.log(err.name + ": " + err.message);
}); });
} }
//setInterval(init, 5000); setInterval(init,2000);
init(); //init();
</script> </script>
</body> </body>
</html> </html>
Loading…
Cancel
Save