diff --git a/web/app/assets/javascripts/fakeJamClient.js b/web/app/assets/javascripts/fakeJamClient.js index d64b43ee4..c70d18e3b 100644 --- a/web/app/assets/javascripts/fakeJamClient.js +++ b/web/app/assets/javascripts/fakeJamClient.js @@ -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; diff --git a/web/app/assets/javascripts/webcam_viewer.js.coffee b/web/app/assets/javascripts/webcam_viewer.js.coffee index 4cb997590..9224ce2cc 100644 --- a/web/app/assets/javascripts/webcam_viewer.js.coffee +++ b/web/app/assets/javascripts/webcam_viewer.js.coffee @@ -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 = $('