* use new bridge calls to handle current FPS and resolution VRFS-3428

This commit is contained in:
Seth Call 2015-08-25 05:28:15 -05:00
parent 6918eaf095
commit 1252dbe178
4 changed files with 79 additions and 24 deletions

View File

@ -87,8 +87,13 @@
}
function FTUEGetAvailableEncodeVideoResolutions() {
return {
1: "VGA (640X480)",
2: "WHD (1280X720)"
1 : "QCIF (176X144)",
2 : "CIF (352X288)",
3 : "VGA (640X480)",
4 : "4CIF (704X576)",
5 : "1/2WHD (640X360)",
6: "WHD (1280X720)",
7 : "FHD (1920x1080)"
}
}
@ -104,6 +109,14 @@
return {20:20, 24:24, 30:30}
}
function GetCurrentVideoResolution() {
return 3;
}
function GetCurrentVideoFrameRate() {
return 30;
}
function isSessVideoShared() {
return videoShared;
}
@ -1247,7 +1260,8 @@
this.FTUEGetVideoCaptureDeviceCapabilities = FTUEGetVideoCaptureDeviceCapabilities;
this.FTUEGetSendFrameRates = FTUEGetSendFrameRates;
this.FTUESetSendFrameRates = FTUESetSendFrameRates;
this.GetCurrentVideoResolution = GetCurrentVideoResolution;
this.GetCurrentVideoFrameRate = GetCurrentVideoFrameRate;
this.isSessVideoShared = isSessVideoShared;
this.SessStopVideoSharing = SessStopVideoSharing;

View File

@ -3,16 +3,32 @@ context = window
context.JK ||= {};
BackendToFrontend = {
"QCIF (176X144)" : "QCIF (176X144)",
"CIF (352X288)" : "CIF (352X288)",
"VGA (640X480)" : "VGA (640X480)",
"4CIF (704X576)" : "4CIF (704X576)",
"1/2WHD (640X360)" : "1/2WHD (640X360)",
"WHD (1280X720)": "WHD (1280X720)",
"FHD (1920x1080)" : "FHD (1920x1080)"
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)",
3 : "4CIF (704X576)",
4 : "1/2WHD (640X360)",
5 : "WHD (1280X720)",
6 : "FHD (1920x1080)"
}
BackendToFrontendFPS = {
1: 30,
2: 24,
3: 20,
4: 15,
5: 10
}
FrontendToBackend = {}
for key, value of BackendToFrontend
FrontendToBackend[value] = key
@ -74,6 +90,13 @@ context.JK.WebcamViewer = class WebcamViewer
@logger.debug("Got capabilities from device", caps, device)
@client.FTUESelectVideoCaptureDevice(device, caps)
updateBackend: (selectedResolution, selectedFps) =>
@logger.debug 'Selecting webcam resolution: ', selectedResolution
@logger.debug 'Selecting webcam fps: ', selectedFps
@client.FTUESetVideoEncodeResolution selectedResolution
@client.FTUESetSendFrameRates selectedFps
selectResolution:() =>
@logger.debug 'Selecting from res control: ', @resolutionSelect
@resolution = @resolutionSelect.val()
@ -81,11 +104,7 @@ context.JK.WebcamViewer = class WebcamViewer
bits = @resolution.split('|')
selectedResolution = bits[0]
selectedFps = bits[1]
@logger.debug 'Selecting webcam resolution: ', selectedResolution
@logger.debug 'Selecting webcam fps: ', selectedFps
@client.FTUESetVideoEncodeResolution selectedResolution
@client.FTUESetSendFrameRates selectedFps
@updateBackend(selectedResolution, selectedFps)
# if @isVideoShared
# this.setVideoOff()
@ -153,16 +172,16 @@ context.JK.WebcamViewer = class WebcamViewer
selectControl = @resolutionSelect
@logger.debug 'FOUND THESE RESOLUTIONS', resolutions
@logger.debug 'FOUND THESE FPS', frames
context._.each resolutions, (resolution, key, obj) ->
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[resolution]
frontendResolution = BackendToFrontend[resolutionKey]
@logger.error("unknown resolution! #{resolution}") unless frontendResolution
value = "#{resolution}|#{frame}"
value = "#{resolutionKey}|#{frame}"
text = "#{frontendResolution} at #{frame} fps"
option = $('<option/>',
@ -170,7 +189,30 @@ context.JK.WebcamViewer = class WebcamViewer
text: text)
selectControl.append option
if @resolution != null and @resolution != ''
selectControl.val(@resolution)
# load current settings from backend
currentResolution = @client.GetCurrentVideoResolution()
currentFrameRate = @client.GetCurrentVideoFrameRate()
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
selectControl.val(BackendToFrontend["WHD (1280X720)"] + '|30')
convertedFrameRate = BackendToFrontendFPS[currentFrameRate]
@logger.debug("translating FPS: backend numeric #{currentFrameRate} to #{convertedFrameRate}")
currentFrameRate = convertedFrameRate
selected = currentResolution + '|' + currentFrameRate
# backend needs to be same as frontend
if autoSelect
@updateBackend(currentResolution, currentFrameRate)
@logger.debug("setting current value of video settings to: " + selected)
selectControl.val(selected)

View File

@ -9,7 +9,6 @@
div.subcaption {
font-size:14px;
width:500px;
}
.sub-header {

View File

@ -327,6 +327,6 @@ script type="text/template" id="template-help-ftue-video-settings"
.ftue-video-settings
p
ul
li If you have a quad core computer, we recommend selecting 720p resolution (1280x720) and 30 frames per second (fps).
li If you have a dual core computer, we recommend selecting one half 720p resolution (640x360) and 30 frames per second (fps).
li If you have a quad core computer, we recommend selecting 720p HD resolution (1280x720) and 30 frames per second (fps).
li If you have a dual core computer, we recommend selecting 1/2 720p HD resolution (640x360) and 30 frames per second (fps).
li If you're not sure what to choose, don't worry, you can change this later while in sessions to experiment with it.