* VRFS-3756 - webcam audio

This commit is contained in:
Seth Call 2015-12-04 11:16:40 -06:00
parent 223988f421
commit 949ce8a513
5 changed files with 46 additions and 128 deletions

View File

@ -4,8 +4,7 @@ context = window
refresh: {}
stopVideo: {}
startVideo: {}
setVideoEncodeResolution: {}
setSendFrameRate: {}
setCaptureResolution: {}
selectDevice: {}
videoWindowOpened : {}
videoWindowClosed : {}

View File

@ -6,15 +6,6 @@ NAMED_MESSAGES = context.JK.NAMED_MESSAGES
VideoActions = @VideoActions
BackendToFrontend = {
1 : "CIF (352x288)",
2 : "VGA (640x480)",
3 : "4CIF (704x576)",
4 : "1/2 720p HD (640x360)",
5 : "720p HD (1280x720)",
6 : "1080p HD (1920x1080)"
}
BackendToFrontendFPS = {
0: 30,
1: 24,
@ -53,39 +44,17 @@ BackendToFrontendFPS = {
currentDevice = context.jamClient.FTUECurrentSelectedVideoDevice()
deviceNames = context.jamClient.FTUEGetVideoCaptureDeviceNames()
#deviceCaps = context.jamClient.FTUEGetVideoCaptureDeviceCapabilities()
currentResolution = context.jamClient.GetCurrentVideoResolution()
currentFrameRate = context.jamClient.GetCurrentVideoFrameRate()
encodeResolutions = context.jamClient.FTUEGetAvailableEncodeVideoResolutions()
frameRates = context.jamClient.FTUEGetSendFrameRates()
captureResolutions = context.jamClient.FTUEGetCaptureResolution()
currentCaptureResolution = context.jamClient.FTUEGetCurrentCaptureResolution()
autoSelect = false
if currentResolution == 0
@logger.warn("current resolution not specified; defaulting to VGA")
autoSelect = true
currentResolution = 2
if currentFrameRate == 0
autoSelect = true
@logger.warn("current frame rate not specified; defaulting to 30")
currentFrameRate = 30
else
# backend accepts 10,20,30 etc for FPS, but returns an indexed value (1, 2, 3).
convertedFrameRate = BackendToFrontendFPS[currentFrameRate]
@logger.debug("translating FPS: backend numeric #{currentFrameRate} to #{convertedFrameRate}")
currentFrameRate = convertedFrameRate
# backend needs to be same as frontend
if autoSelect
context.jamClient.FTUESetVideoEncodeResolution(currentResolution)
context.jamClient.FTUESetSendFrameRates(currentFrameRate)
logger.debug("captureResolutions, currentCaptureResolution", captureResolutions, currentCaptureResolution)
else
@everDisabled = true
# don't talk to the backend when video is disabled; avoiding crashes
currentDevice = null
deviceNames = {}
currentResolution: 0
currentFrameRate: 0
encodeResolutions: {}
captureResolutions: {}
currentCaptureResolution: null
frameRates: {}
@ -94,10 +63,8 @@ BackendToFrontendFPS = {
@state = {
currentDevice: currentDevice,
deviceNames: deviceNames,
currentResolution: currentResolution,
currentFrameRate: currentFrameRate,
encodeResolutions: encodeResolutions,
frameRates: frameRates,
captureResolutions: captureResolutions,
currentCaptureResolution: currentCaptureResolution,
videoShared: @videoShared
videoOpen: @videoOpen,
videoEnabled: videoEnabled,
@ -158,10 +125,10 @@ BackendToFrontendFPS = {
else
@onStartVideo()
onSetVideoEncodeResolution: (resolution) ->
onSetCaptureResolution: (resolution) ->
@logger.debug("set capture resolution: #{resolution}")
context.jamClient.FTUESetVideoEncodeResolution(resolution)
@state.currentResolution = resolution
context.jamClient.FTUESetCaptureResolution(resolution)
@state.currentCaptureResolution = resolution
this.trigger(@state)
onSetSendFrameRate: (frameRates) ->

View File

@ -21,15 +21,6 @@ PlatformStore = reactContext.PlatformStore
ALERT_NAMES = context.JK.ALERT_NAMES;
BackendToFrontend = {
1 : "CIF (352x288)",
2 : "VGA (640x480)",
3 : "4CIF (704x576)",
4 : "1/2 720p HD (640x360)",
5 : "720p HD (1280x720)",
6 : "1080p HD (1920x1080)"
}
BackendNumericToBackendString = {
1 : "CIF (352X288)",
2 : "VGA (640X480)",
@ -47,9 +38,6 @@ BackendToFrontendFPS = {
4: 15,
5: 10
}
FrontendToBackend = {}
for key, value of BackendToFrontend
FrontendToBackend[value] = key
mixins = []
mixins.push(Reflux.listenTo(VideoStore, 'onVideoStateChanged'))
@ -65,9 +53,8 @@ mixins.push(Reflux.listenTo(VideoStore, 'onVideoStateChanged'))
currentDevice: null
deviceNames: {}
deviceCaps: null
currentResolution: 0
currentFrameRate: 0
encodeResolutions: {}
currentCaptureResolution: 0
captureResolutions: {}
frameRates: {}
rescanning: false
}
@ -101,27 +88,17 @@ mixins.push(Reflux.listenTo(VideoStore, 'onVideoStateChanged'))
captureResolutions = []
# load current settings from backend
currentResolution = @state.currentResolution
currentFrameRate = @state.currentFrameRate
captureResolution = @state.currentCaptureResolution
# protect against non-video clients pointed at video-enabled server from getting into a session
resolutions = @state.encodeResolutions
frames = @state.frameRates
resolutions = @state.captureResolutions
context._.each resolutions, (resolution, resolutionKey, obj) =>
#{1: "CIF (352X288)", 2: "VGA (640X480)", 3: "4CIF (704X576)", 4: "1/2WHD (640X360)", 5: "WHD (1280X720)", 6: "FHD (1920x1080)"}
context._.each frames, (frame, key, obj) =>
value = resolutionKey
text = resolution
frontendResolution = BackendToFrontend[resolutionKey]
selected = captureResolution.toString() == value.toString()
@logger.error("unknown resolution! #{resolution}", BackendToFrontend) unless frontendResolution
value = "#{resolutionKey}|#{frame}"
text = "#{frontendResolution} at #{frame} fps"
selected = currentResolution + '|' + currentFrameRate == value
captureResolutions.push `<option key={value} value={value} selected={selected}>{text}</option>`
captureResolutions.push `<option key={value} value={value} selected={selected}>{text}</option>`
testBtnClassNames = {'button-orange' : true, 'webcam-test-btn' : true}
@ -193,7 +170,7 @@ mixins.push(Reflux.listenTo(VideoStore, 'onVideoStateChanged'))
{webcams}
</select>
</div>
<h2 className="sub-header select-resolution">select video capture resolution & frame rate:</h2>
<h2 className="sub-header select-resolution">select video capture resolution:</h2>
<div className="webcam-resolution-select-container wizard_control">
<select onChange={this.selectResolution} disabled={noWebcams || !this.state.videoEnabled}>
{captureResolutions}
@ -313,12 +290,10 @@ mixins.push(Reflux.listenTo(VideoStore, 'onVideoStateChanged'))
VideoActions.setVideoEnabled(true)
updateBackend: (selectedResolution, selectedFps) ->
@logger.debug 'Selecting webcam resolution: ', selectedResolution
@logger.debug 'Selecting webcam fps: ', selectedFps
updateBackend: (captureResolution) ->
@logger.debug 'Selecting capture resolution: ', captureResolution
VideoActions.setVideoEncodeResolution(selectedResolution)
VideoActions.setSendFrameRate(selectedFps)
VideoActions.setCaptureResolution(captureResolution)
selectResolution:(e) ->
e.preventDefault()
@ -327,11 +302,7 @@ mixins.push(Reflux.listenTo(VideoStore, 'onVideoStateChanged'))
@logger.debug 'new capture resolution selected: ' + resolution
if resolution?
bits = resolution.split('|')
selectedResolution = bits[0]
selectedFps = bits[1]
@updateBackend(selectedResolution, selectedFps)
@updateBackend(resolution)
setVideoOff:() ->
VideoActions.stopVideo()
@ -362,7 +333,11 @@ mixins.push(Reflux.listenTo(VideoStore, 'onVideoStateChanged'))
else
device = $select.val()
#VideoActions.selectDevice(device, {})
VideoActions.toggleVideo()
if VideoStore.videoShared
VideoActions.stopVideo()
else
VideoActions.toggleVideo()
#if this.isVideoShared()
# $toggleBtn.removeClass("selected")

View File

@ -32,9 +32,6 @@ BackendToFrontendFPS = {
4: 15,
5: 10
}
FrontendToBackend = {}
for key, value of BackendToFrontend
FrontendToBackend[value] = key
context.JK.WebcamViewer = class WebcamViewer
constructor: (@root) ->
@ -123,21 +120,17 @@ context.JK.WebcamViewer = class WebcamViewer
result = @client.FTUESelectVideoCaptureDevice(device, caps)
@logger.debug("FTUESelectVideoCaptureDevice result: ", result)
updateBackend: (selectedResolution, selectedFps) =>
@logger.debug 'Selecting webcam resolution: ', selectedResolution
@logger.debug 'Selecting webcam fps: ', selectedFps
updateBackend: (captureResolution) =>
@logger.debug 'Selecting capture resolution: ', captureResolution
@client.FTUESetVideoEncodeResolution(captureResolution)
@client.FTUESetVideoEncodeResolution selectedResolution
@client.FTUESetSendFrameRates selectedFps
selectResolution:() =>
@logger.debug 'Selecting from res control: ', @resolutionSelect
@resolution = @resolutionSelect.val()
if @resolution?
bits = @resolution.split('|')
selectedResolution = bits[0]
selectedFps = bits[1]
@updateBackend(selectedResolution, selectedFps)
@updateBackend(@resolution)
# if @isVideoShared
# this.setVideoOff()
@ -239,45 +232,29 @@ context.JK.WebcamViewer = class WebcamViewer
loadResolutions:() =>
# protect against non-video clients pointed at video-enabled server from getting into a session
resolutions = if @client.FTUEGetAvailableEncodeVideoResolutions? then @client.FTUEGetAvailableEncodeVideoResolutions() else {}
frames = if @client.FTUEGetSendFrameRates? then @client.FTUEGetSendFrameRates() else {}
resolutions = if @client.FTUEGetCaptureResolution? then @client.FTUEGetCaptureResolution() else {}
selectControl = @resolutionSelect
@logger.debug 'FOUND THESE RESOLUTIONS', resolutions
@logger.debug 'FOUND THESE FPS', frames
context._.each resolutions, (resolution, resolutionKey, obj) ->
#{1: "CIF (352X288)", 2: "VGA (640X480)", 3: "4CIF (704X576)", 4: "1/2WHD (640X360)", 5: "WHD (1280X720)", 6: "FHD (1920x1080)"}
context._.each frames, (frame, key, obj) ->
frontendResolution = BackendToFrontend[resolutionKey]
@logger.error("unknown resolution! #{resolution}") unless frontendResolution
frontendResolution = BackendToFrontend[resolutionKey]
value = "#{resolutionKey}|#{frame}"
text = "#{frontendResolution} at #{frame} fps"
@logger.error("unknown resolution! #{resolution}") unless frontendResolution
option = $('<option/>',
value: value
text: text)
selectControl.append option
value = "#{resolutionKey}"
text = "#{frontendResolution}"
option = $('<option/>',
value: value
text: text)
selectControl.append option
# load current settings from backend
currentResolution = @client.GetCurrentVideoResolution()
currentFrameRate = @client.GetCurrentVideoFrameRate()
currentResolution = @client.FTUEGetCaptureResolution()
autoSelect = false
if currentResolution == 0
@logger.warn("current resolution not specified; defaulting to VGA")
autoSelect = true
currentResolution = 2
if currentFrameRate == 0
autoSelect = true
@logger.warn("current frame rate not specified; defaulting to 30")
currentFrameRate = 30
else
convertedFrameRate = BackendToFrontendFPS[currentFrameRate]
@logger.debug("translating FPS: backend numeric #{currentFrameRate} to #{convertedFrameRate}")
currentFrameRate = convertedFrameRate
selected = currentResolution + '|' + currentFrameRate

View File

@ -228,7 +228,7 @@ namespace :jam_tracks do
end
end
task generate_master_listing: :environment do |task, arg|
task gen_jamtrack_files: :environment do |task, arg|
instruments = Instrument.all
jam_tracks = JamTrack.where(status: 'Production').order('original_artist, name')