Factor out an API object

Relates to #333
This commit is contained in:
Woodrow Douglass
2019-01-02 12:44:43 -05:00
committed by Michiel De Backker
parent bd7c6ffc25
commit e906728df3
9 changed files with 103 additions and 67 deletions

19
apiobject.go Normal file
View File

@@ -0,0 +1,19 @@
package webrtc
// API is a repository for semi-global settings to WebRTC objects
// In the simplest case, the DefaultAPI object should be used
// rather then constructing a new API object.
type API struct {
settingEngine settingEngine
mediaEngine MediaEngine
}
var defaultAPI = NewAPI()
// NewAPI Creates a new API object for keeping semi-global settings to WebRTC objects
func NewAPI() *API {
a := new(API)
initSettingEngine(&a.settingEngine)
InitMediaEngine(&a.mediaEngine)
return a
}