mirror of
https://github.com/pion/mediadevices.git
synced 2025-09-27 12:52:20 +08:00
Enhance failed to find driver error message
This commit is contained in:
@@ -3,6 +3,7 @@ package mediadevices
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/pion/mediadevices/pkg/driver"
|
"github.com/pion/mediadevices/pkg/driver"
|
||||||
"github.com/pion/mediadevices/pkg/prop"
|
"github.com/pion/mediadevices/pkg/prop"
|
||||||
@@ -214,7 +215,23 @@ func selectBestDriver(filter driver.FilterFn, constraints MediaTrackConstraints)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if bestDriver == nil {
|
if bestDriver == nil {
|
||||||
return nil, MediaTrackConstraints{}, errNotFound
|
var foundProperties []string
|
||||||
|
for _, props := range driverProperties {
|
||||||
|
for _, p := range props {
|
||||||
|
foundProperties = append(foundProperties, fmt.Sprint(&p))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
err := fmt.Errorf(`%w:
|
||||||
|
============ Found Properties ============
|
||||||
|
|
||||||
|
%s
|
||||||
|
|
||||||
|
=============== Constraints ==============
|
||||||
|
|
||||||
|
%s
|
||||||
|
`, errNotFound, strings.Join(foundProperties, "\n\n"), &constraints)
|
||||||
|
return nil, MediaTrackConstraints{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
constraints.selectedMedia = prop.Media{}
|
constraints.selectedMedia = prop.Media{}
|
||||||
|
Reference in New Issue
Block a user