正在显示
2 个修改的文件
包含
38 行增加
和
14 行删除
| @@ -148,17 +148,29 @@ function srs_initialize_codec_page( | @@ -148,17 +148,29 @@ function srs_initialize_codec_page( | ||
| 148 | for (var i = 0; i < cameras.length; i++) { | 148 | for (var i = 0; i < cameras.length; i++) { |
| 149 | $(sl_cameras).append("<option value='" + i + "'>" + cameras[i] + "</option"); | 149 | $(sl_cameras).append("<option value='" + i + "'>" + cameras[i] + "</option"); |
| 150 | } | 150 | } |
| 151 | - // optional: select the first no "virtual" signed. | 151 | + // optional: select the except matches |
| 152 | + matchs = ["virtual"]; | ||
| 152 | for (var i = 0; i < cameras.length; i++) { | 153 | for (var i = 0; i < cameras.length; i++) { |
| 153 | - if (cameras[i].toLowerCase().indexOf("virtual") == -1) { | ||
| 154 | - $(sl_cameras + " option[value='" + i + "']").attr("selected", true); | 154 | + for (var j = 0; j < matchs.length; j++) { |
| 155 | + if (cameras[i].toLowerCase().indexOf(matchs[j]) == -1) { | ||
| 156 | + $(sl_cameras + " option[value='" + i + "']").attr("selected", true); | ||
| 157 | + break; | ||
| 158 | + } | ||
| 159 | + } | ||
| 160 | + if (j < matchs.length) { | ||
| 155 | break; | 161 | break; |
| 156 | } | 162 | } |
| 157 | } | 163 | } |
| 158 | - // optional: select the first "integrated" signed. | 164 | + // optional: select the first matched. |
| 165 | + matchs = ["turevision", "integrated"]; | ||
| 159 | for (var i = 0; i < cameras.length; i++) { | 166 | for (var i = 0; i < cameras.length; i++) { |
| 160 | - if (cameras[i].toLowerCase().indexOf("integrated") >= 0) { | ||
| 161 | - $(sl_cameras + " option[value='" + i + "']").attr("selected", true); | 167 | + for (var j = 0; j < matchs.length; j++) { |
| 168 | + if (cameras[i].toLowerCase().indexOf(matchs[j]) >= 0) { | ||
| 169 | + $(sl_cameras + " option[value='" + i + "']").attr("selected", true); | ||
| 170 | + break; | ||
| 171 | + } | ||
| 172 | + } | ||
| 173 | + if (j < matchs.length) { | ||
| 162 | break; | 174 | break; |
| 163 | } | 175 | } |
| 164 | } | 176 | } |
| @@ -167,17 +179,29 @@ function srs_initialize_codec_page( | @@ -167,17 +179,29 @@ function srs_initialize_codec_page( | ||
| 167 | for (var i = 0; i < microphones.length; i++) { | 179 | for (var i = 0; i < microphones.length; i++) { |
| 168 | $(sl_microphones).append("<option value='" + i + "'>" + microphones[i] + "</option"); | 180 | $(sl_microphones).append("<option value='" + i + "'>" + microphones[i] + "</option"); |
| 169 | } | 181 | } |
| 170 | - // optional: select the first no "default" signed. | 182 | + // optional: select the except matches |
| 183 | + matchs = ["default"]; | ||
| 171 | for (var i = 0; i < microphones.length; i++) { | 184 | for (var i = 0; i < microphones.length; i++) { |
| 172 | - if (microphones[i].toLowerCase().indexOf("default") == -1) { | ||
| 173 | - $(sl_microphones + " option[value='" + i + "']").attr("selected", true); | 185 | + for (var j = 0; j < matchs.length; j++) { |
| 186 | + if (microphones[i].toLowerCase().indexOf(matchs[j]) == -1) { | ||
| 187 | + $(sl_microphones + " option[value='" + i + "']").attr("selected", true); | ||
| 188 | + break; | ||
| 189 | + } | ||
| 190 | + } | ||
| 191 | + if (j < matchs.length) { | ||
| 174 | break; | 192 | break; |
| 175 | } | 193 | } |
| 176 | } | 194 | } |
| 177 | - // optional: select the first "realtek" signed. | 195 | + // optional: select the first matched. |
| 196 | + matchs = ["realtek", "内置式麦克风"]; | ||
| 178 | for (var i = 0; i < microphones.length; i++) { | 197 | for (var i = 0; i < microphones.length; i++) { |
| 179 | - if (microphones[i].toLowerCase().indexOf("realtek") >= 0) { | ||
| 180 | - $(sl_microphones + " option[value='" + i + "']").attr("selected", true); | 198 | + for (var j = 0; j < matchs.length; j++) { |
| 199 | + if (microphones[i].toLowerCase().indexOf(matchs[j]) >= 0) { | ||
| 200 | + $(sl_microphones + " option[value='" + i + "']").attr("selected", true); | ||
| 201 | + break; | ||
| 202 | + } | ||
| 203 | + } | ||
| 204 | + if (j < matchs.length) { | ||
| 181 | break; | 205 | break; |
| 182 | } | 206 | } |
| 183 | } | 207 | } |
| @@ -373,7 +373,7 @@ | @@ -373,7 +373,7 @@ | ||
| 373 | } | 373 | } |
| 374 | 374 | ||
| 375 | function on_user_publish() { | 375 | function on_user_publish() { |
| 376 | - if ($("#txt_name").val().trim() == "") { | 376 | + if ($("#txt_name").val() == "") { |
| 377 | $("#txt_name").focus().parent().parent().addClass("error"); | 377 | $("#txt_name").focus().parent().parent().addClass("error"); |
| 378 | warn(100, "请输入您的名字"); | 378 | warn(100, "请输入您的名字"); |
| 379 | return; | 379 | return; |
| @@ -460,7 +460,7 @@ | @@ -460,7 +460,7 @@ | ||
| 460 | 460 | ||
| 461 | var chat = {}; | 461 | var chat = {}; |
| 462 | chat.id = -1; | 462 | chat.id = -1; |
| 463 | - chat.username = $("#txt_name").val().trim(); | 463 | + chat.username = $("#txt_name").val(); |
| 464 | chat.agent = navigator.userAgent; | 464 | chat.agent = navigator.userAgent; |
| 465 | chat.url = url; | 465 | chat.url = url; |
| 466 | chat.vcodec = vcodec; | 466 | chat.vcodec = vcodec; |
-
请 注册 或 登录 后发表评论