mirror of
https://github.com/pion/mediadevices.git
synced 2025-09-26 20:41:46 +08:00
Expose device list update func (#463)
This commit is contained in:
@@ -17,6 +17,11 @@ type camera struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
Initialize()
|
||||
}
|
||||
|
||||
// Initialize finds and registers camera devices. This is part of an experimental API.
|
||||
func Initialize() {
|
||||
devices, err := avfoundation.Devices(avfoundation.Video)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@@ -73,6 +73,11 @@ type camera struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
Initialize()
|
||||
}
|
||||
|
||||
// Initialize finds and registers camera devices. This is part of an experimental API.
|
||||
func Initialize() {
|
||||
discovered := make(map[string]struct{})
|
||||
discover(discovered, "/dev/v4l/by-path/*")
|
||||
discover(discovered, "/dev/video*")
|
||||
|
@@ -32,6 +32,11 @@ type camera struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
Initialize()
|
||||
}
|
||||
|
||||
// Initialize finds and registers camera devices. This is part of an experimental API.
|
||||
func Initialize() {
|
||||
C.CoInitializeEx(nil, C.COINIT_MULTITHREADED)
|
||||
|
||||
var list C.cameraList
|
||||
|
@@ -39,6 +39,11 @@ type microphone struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
Initialize()
|
||||
}
|
||||
|
||||
// Initialize finds and registers active playback or capture devices. This is part of an experimental API.
|
||||
func Initialize() {
|
||||
var err error
|
||||
ctx, err = malgo.InitContext(nil, malgo.ContextConfig{}, func(message string) {
|
||||
logger.Debugf("%v\n", message)
|
||||
|
@@ -20,6 +20,11 @@ type screen struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
Initialize()
|
||||
}
|
||||
|
||||
// Initialize finds and registers active displays. This is part of an experimental API.
|
||||
func Initialize() {
|
||||
activeDisplays := screenshot.NumActiveDisplays()
|
||||
for i := 0; i < activeDisplays; i++ {
|
||||
priority := driver.PriorityNormal
|
||||
|
@@ -22,6 +22,11 @@ func deviceID(num int) string {
|
||||
}
|
||||
|
||||
func init() {
|
||||
Initialize()
|
||||
}
|
||||
|
||||
// Initialize finds and registers active displays. This is part of an experimental API.
|
||||
func Initialize() {
|
||||
dp, err := openDisplay()
|
||||
if err != nil {
|
||||
// No x11 display available.
|
||||
|
Reference in New Issue
Block a user