Skip to content

Commit 21d216c

Browse files
committed
refactor: 重构 IMediaVideo 接口
1 parent 560379a commit 21d216c

File tree

2 files changed

+42
-11
lines changed

2 files changed

+42
-11
lines changed

src/BootstrapBlazor/Services/MediaDevices/DefaultMediaVideo.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,28 @@ public Task Open(MediaTrackConstraints constraints)
2727
return deviceService.Open(constraints);
2828
}
2929

30-
public Task Close(string selector)
30+
public Task Close()
3131
{
3232
return deviceService.Close(selector);
3333
}
3434

35-
public Task Capture(string selector)
35+
public Task Capture()
3636
{
3737
return deviceService.Capture(selector);
3838
}
39+
40+
public Task Preview()
41+
{
42+
throw new NotImplementedException();
43+
}
44+
45+
public Task<Stream?> GetPreviewImage()
46+
{
47+
throw new NotImplementedException();
48+
}
49+
50+
public Task<string?> GetPreviewUrl()
51+
{
52+
throw new NotImplementedException();
53+
}
3954
}

src/BootstrapBlazor/Services/MediaDevices/IMediaVideo.cs

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,50 @@
66
namespace BootstrapBlazor.Components;
77

88
/// <summary>
9-
///
9+
/// Video Media Device Interface
1010
/// </summary>
1111
public interface IMediaVideo
1212
{
1313
/// <summary>
14-
///
14+
/// Gets the list of video devices.
1515
/// </summary>
1616
/// <returns></returns>
1717
Task<List<IMediaDeviceInfo>?> GetDevices();
1818

1919
/// <summary>
20-
///
20+
/// Opens the video device with the specified constraints.
2121
/// </summary>
2222
/// <param name="constraints"></param>
2323
/// <returns></returns>
2424
Task Open(MediaTrackConstraints constraints);
2525

2626
/// <summary>
27-
///
27+
/// Close the video device with the specified selector.
2828
/// </summary>
29-
/// <param name="selector"></param>
3029
/// <returns></returns>
31-
Task Close(string selector);
30+
Task Close();
3231

3332
/// <summary>
34-
///
33+
/// Capture a still image from the video stream.
3534
/// </summary>
36-
/// <param name="selector"></param>
3735
/// <returns></returns>
38-
Task Capture(string selector);
36+
Task Capture();
37+
38+
/// <summary>
39+
/// Preview a still image from the video stream.
40+
/// </summary>
41+
/// <returns></returns>
42+
Task Preview();
43+
44+
/// <summary>
45+
/// Gets the stream of the captured image.
46+
/// </summary>
47+
/// <returns></returns>
48+
Task<Stream?> GetPreviewImage();
49+
50+
/// <summary>
51+
/// Gets the preview URL of the captured image.
52+
/// </summary>
53+
/// <returns></returns>
54+
Task<string?> GetPreviewUrl();
3955
}

0 commit comments

Comments
 (0)