VideoCore 使用变量问题
VideoCore use of Variables Issue
我正尝试在我的 VCSimpleSession 中使用变量。我目前设置了宽度和高度,它们工作正常,但我无法让帧率和比特率起作用。
看一下:
var session: VCSimpleSession!
var streamWidth:Int = Int(NSUserDefaults.standardUserDefaults().stringForKey("settingsWidth")!)!
var streamHeight:Int = Int(NSUserDefaults.standardUserDefaults().stringForKey("settingsHeight")!)!
var streamFramerate:Int = Int(NSUserDefaults.standardUserDefaults().stringForKey("settingsFramerate")!)!
var streamBitrate:Int = Int(NSUserDefaults.standardUserDefaults().stringForKey("settingsBitrate")!)!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
session = VCSimpleSession(videoSize: CGSize(width: streamWidth, height: streamHeight), frameRate: streamFramerate, bitrate: streamBitrate, useInterfaceOrientation: false)
previewView.addSubview(session.previewView)
session.previewView.frame = previewView.bounds
session.delegate = self
}
我在 frameRate 和 bitrate 上收到一个错误,即 Cannot invoke initializer for type 'VCSimpleSession' with an argument list of type '(videoSize: CGSize, frameRate: Int, bitrate: Int, useInterfaceOrientation: Bool )'
我查看了 VCSimpleSession.h 文件,发现 frameRate 和 bitrate 都是 int 值,所以我很困惑为什么会收到此错误。 (顺便说一下语言是Swift)
link GitHub 上的 VideoCore:https://github.com/jgh-/VideoCore
谢谢!
我快要解决我的问题了。问题在于帧率和比特率需要 Int32()
而不是 Int()
.
最终产品应该是这样的:
session = VCSimpleSession(videoSize: CGSize(width: streamWidth, height: streamHeight), frameRate: Int32(streamFramerate), bitrate: Int32(streamBitrate), useInterfaceOrientation: false)
我正尝试在我的 VCSimpleSession 中使用变量。我目前设置了宽度和高度,它们工作正常,但我无法让帧率和比特率起作用。
看一下:
var session: VCSimpleSession!
var streamWidth:Int = Int(NSUserDefaults.standardUserDefaults().stringForKey("settingsWidth")!)!
var streamHeight:Int = Int(NSUserDefaults.standardUserDefaults().stringForKey("settingsHeight")!)!
var streamFramerate:Int = Int(NSUserDefaults.standardUserDefaults().stringForKey("settingsFramerate")!)!
var streamBitrate:Int = Int(NSUserDefaults.standardUserDefaults().stringForKey("settingsBitrate")!)!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
session = VCSimpleSession(videoSize: CGSize(width: streamWidth, height: streamHeight), frameRate: streamFramerate, bitrate: streamBitrate, useInterfaceOrientation: false)
previewView.addSubview(session.previewView)
session.previewView.frame = previewView.bounds
session.delegate = self
}
我在 frameRate 和 bitrate 上收到一个错误,即 Cannot invoke initializer for type 'VCSimpleSession' with an argument list of type '(videoSize: CGSize, frameRate: Int, bitrate: Int, useInterfaceOrientation: Bool )'
我查看了 VCSimpleSession.h 文件,发现 frameRate 和 bitrate 都是 int 值,所以我很困惑为什么会收到此错误。 (顺便说一下语言是Swift)
link GitHub 上的 VideoCore:https://github.com/jgh-/VideoCore
谢谢!
我快要解决我的问题了。问题在于帧率和比特率需要 Int32()
而不是 Int()
.
最终产品应该是这样的:
session = VCSimpleSession(videoSize: CGSize(width: streamWidth, height: streamHeight), frameRate: Int32(streamFramerate), bitrate: Int32(streamBitrate), useInterfaceOrientation: false)