句子录音打分代码参考

1、页面名称:sentenceReadRecordDialogAnyone.jsp

2、页面效果



3、页面源码

<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%><script language="javascript" type="text/javascript" src="<c:url value='/scripts/course/sentenceReadRecordDialog.js'/>"></script><script type="text/javascript" charset="UTF-8">var RANK_PRIMARY = 1;//初级的
var RANK_MIDDLE = 2;//中级的
var RANK_ADVANCED = 3;//高级的var _wordReadRecordVoArray = JSON.parse('${wordReadRecordVoListJson }');
var wordRecordDialog = null;
var _rank = parseInt("${rank}");
var _starCount = parseInt("${starCount}");$(document).ready(function() {if (_starCount > 0) {$("#scoreStarPlus").show();setTimeout(function(){$("#scoreStarPlus").fadeOut(1500);}, 1000);}//加载录音代码if ($("#aVoiceRecordFlash").length <= 0) {$.ajax({url: "<c:url value='/course/loadRecordCode.action'/>",type: "GET",success: function(response) {$("body").append(response);}});}//收藏按钮状态初始化var collected = "${sentenceVo.collected }";if(collected && collected == "true") {$("#sentence_collected").show();$("#sentence_uncollected").hide();}//句子状态行为初始化$.initSentenceContent = function(){$("#sentence_content").find("span[type='word']").each(function(){var score = $(this).attr("score");var word = $(this).text().trim();var wordId = $(this).attr("id");if (_rank == RANK_ADVANCED) {if (score >= 0) {$(this).attr("title", "得分:" + score);} else {$(this).attr("title", "未识别");}}$(this).css("cursor","pointer");//低分单词变色if(score && score < 0) {$(this).addClass("font-color-bad");}//添加单词点击事件 $(this).click(function(){$.showWordReadRecordDialog(wordId, word);});});};$.initSentenceContent();//单词打分结果对话框 index单词在句子中的索引,word单词内容$.showWordReadRecordDialog = function(wordId, wordContent){//根据wordId获取到对应的wordRecordJsonvar wordReadRecordVoJson = "{}";for (var i in _wordReadRecordVoArray) {if (wordId == _wordReadRecordVoArray[i].wordId) {wordReadRecordVoJson = JSON.stringify(_wordReadRecordVoArray[i]);break;}}// 初始化一个带有loading图标的空对话框if (!wordRecordDialog) {wordRecordDialog = art.dialog({id: "wordRecordDialog",fixed: true,close:function(){wordRecordDialog = null;return true;}});}var requestUrl = "<c:url value='/course/loadWordReadRecordDialog.action'/>";$.ajax({url: requestUrl,data: "wordReadRecordVoJson=" + encodeURIComponent(wordReadRecordVoJson) + "&wordContent=" + wordContent + "&sentenceReadVoiceId=${sentenceReadRecordVo.readVoiceId }&sentenceId=${sentenceId}",type: "GET",cache: false,success: function(response) {if(wordRecordDialog != null) {wordRecordDialog.content(response);var wordDialogTop = '${wordDialogTop == null ? "230" : wordDialogTop}';try {if(top.art.dialog.data("leftPos")){var leftPos = top.art.dialog.data("leftPos");	wordRecordDialog.position(leftPos, wordDialogTop + "px");}else{wordRecordDialog.position("50%", wordDialogTop + "px");}} catch (e) {wordRecordDialog.position("50%", wordDialogTop + "px");}}}});};//中文翻译按钮事件$("#translation_btn").click(function(){if ($(this).hasClass("eng")) {if ($("#sentence_content_karaoke").find("c:first").attr("class")) {$("#sentence_content").hide();$("#sentence_content_karaoke").show();} else {$("#sentence_content").show();$("#sentence_content_karaoke").hide();}$("#sentence_content_trans").hide();$(this).removeClass("eng");$(this).attr("title", "查看翻译");} else {$("#sentence_content").hide();$("#sentence_content_karaoke").hide();$("#sentence_content_trans").show();$(this).addClass("eng");$(this).attr("title", "查看原文");}});//收藏按钮事件$("#sentence_collected").click(function(){$.ajax({url: "<c:url value='/base/sentenceCollectOrNot.action?isCollected=true&sentenceId='/>${sentenceVo.id }",type: "POST",dataType: "json",success: function(response){if(response && response.message) {//成功$("#sentence_collected").hide();$("#sentence_uncollected").show();}}});});//未收藏按钮事件$("#sentence_uncollected").click(function(){$.ajax({url: "<c:url value='/base/sentenceCollectOrNot.action?isCollected=false&sentenceId='/>${sentenceVo.id }",type: "POST",dataType: "json",success: function(response){if(response && response.message) {//成功$("#sentence_collected").show();$("#sentence_uncollected").hide();}}});});//跟读练习$("#sentence_listen_and_record_btn").click(function(){//停止播放srrd.thisMovie("sentenceMp3Player").stopAudio();srrd.karaokePlayStop();if (wordRecordDialog != null) {wordRecordDialog.close();}$("#scoreResultImg").hide();$("#scoreResultDescription").hide();var content = $("#sentence_content").text().trim();$.aShowVoiceRecordDialog(content, function(voiceId,recordDuringTime){if (voiceId) {$.ajax({url: "<c:url value='/course/gradeVoiceRecordAnyone.action'/>",data: "sentenceId=${sentenceId }&voiceRecordId=" + voiceId+"&gradeReturnType=json&recordDuringTime="+recordDuringTime,type: "POST",dataType: "json",success: function(response){if (response.message.success) {//句子录音打分成功_wordReadRecordVoArray = response.message.sentenceReadRecordVo.wordReadRecordVoList;var score = response.message.sentenceReadRecordVo.score;var imgSrc = "<c:url value='/images/face-sad3.png'/>";var imgDes = "还要继续加油哦~";if (score > 0) {imgSrc = "<c:url value='/images/face-smile3.png'/>";imgDes = "嗯,很不错啦,加油";}$("#scoreResultImg").attr("src", imgSrc);$("#scoreResultDescription").text(imgDes);$("#play_sentence_record_btn").attr("voiceId", voiceId);$("#sentence_content").html(response.message.sentenceReadRecordVo.html);$.initSentenceContent();//如果是中文翻译状态,切换成英文if ($("#translation_btn").hasClass("eng")) {$("#translation_btn").trigger("click");}//显示增加智慧星if (response.message.starCount > 0) {$("#scoreStarPlus").children("span").text(response.message.starCount);$("#scoreStarPlus").show();//2014年5月6日修改bug817/*setTimeout(function(){$("#scoreStarPlus").fadeOut(1500);}, 1000);*/}}//关闭录音对话框closeVoiceRecordDialog();},error: function(){closeVoiceRecordDialog();}});} else {//关闭录音对话框closeVoiceRecordDialog();}}, function(){$("#scoreResultImg").show();$("#scoreResultDescription").show();});});//播放句子录音 $("#play_sentence_record_btn").click(function(){var voiceId = $(this).attr("voiceId");var sentenceRecordAudioUrl = "record/" + voiceId + ".flv";srrd.thisMovie("sentenceMp3Player").loadAndPlayAudio(sentenceRecordAudioUrl);});//播放句子标准音频$("#play_sentence_original_btn").click(function(){if(!$("#sentence_content_karaoke").text().trim()){var content = $("#sentence_content").text().trim();content = srrd.getSplitSentence(content);$("#sentence_content_karaoke").html(content);}//隐藏原始内容,显示卡拉ok效果内容$("#sentence_content").hide();$("#sentence_content_trans").hide();$("#sentence_content_karaoke").show();//音频开始和结束时间srrd.audioStartTime = "${sentenceVo.audioStartTime }".trim();srrd.audioEndTime = "${sentenceVo.audioEndTime }".trim();if (srrd.audioStartTime == "") {srrd.audioStartTime = 0;}if (srrd.audioEndTime == "") {srrd.audioEndTime = 0;}srrd.audioStartTime *= 1000;srrd.audioEndTime *= 1000;//卡拉ok持续时间,全局变量srrd.karaokeDuration = srrd.audioEndTime - srrd.audioStartTime;var sentenceAudioUrl = "audio/${sentenceVo.standardPronunciation }.mp3";//getSentencePlayerMovie("sentenceMp3Player").loadAndPlayAudio(sentenceAudioUrl, audioStartTime*1000, audioEndTime*1000);srrd.thisMovie("sentenceMp3Player").loadMp3Audio(sentenceAudioUrl, "srrd.onAudioPrepared");});});//音频缓冲完毕
srrd.onAudioPrepared = function(){//检测播放概率性一直持续LOG//top.//console.log("srrd.audioStartTime:" + srrd.audioStartTime + ", srrd.audioEndTime:" + srrd.audioEndTime);//top.//console.log("srrd.karaokeDuration:" + srrd.karaokeDuration);if (srrd.karaokeDuration <= 0) {srrd.karaokeDuration = srrd.thisMovie("sentenceMp3Player").getAudioLength();srrd.thisMovie("sentenceMp3Player").playAudio();} else {srrd.thisMovie("sentenceMp3Player").playAudio(srrd.audioStartTime, srrd.audioEndTime);}srrd.karaoke("#sentence_content_karaoke", srrd.karaokeDuration, function(){setTimeout(function(){//隐藏原始内容,显示卡拉ok效果内容$("#sentence_content_karaoke").hide();if ($("#translation_btn").hasClass("eng")) {$("#sentence_content_trans").show();} else {$("#sentence_content").show();}//清除卡拉ok变色效果$("#sentence_content_karaoke").find("c").removeAttr("class");}, 200);});
};function onSentencePlayerLoadCompleted(){var rtmpServerUrl = "${rtmpServerUrl}";srrd.thisMovie("sentenceMp3Player").setRtmpServerURL(rtmpServerUrl);
}</script><!-- 隐藏的ActionScript播放器类   -->
<object style="width: 1px; height: 1px;position:fixed; bottom:0px; left:0px;" type="application/x-shockwave-flash" data="<c:url value='/flash/NetStreamAudioPlayerAS.swf?onLoadCompleted=onSentencePlayerLoadCompleted'/>" name="sentenceMp3Player" id="sentenceMp3Player" ><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="<c:url value='/flash/NetStreamAudioPlayerAS.swf?onLoadCompleted=onSentencePlayerLoadCompleted'/>" /><param name="visible" value="false" />
</object><div style="width: 500px;">
<table style="height:45px; margin-bottom: 2px;margin-top: 0;position: relative;top: -10px;"><tr><td style="width: 90px;padding-left: 0;"><!-- ${sentenceReadRecordVo.score } --><span class="font-18 font-black">跟读反馈:</span></td><td style="width: 40px;"><img id="scoreResultImg" width="30px" height="30px" src="<c:url value='/images/'/>${sentenceReadRecordVo.faceImgName }"/></td><td align="right" style="text-align: left;"><span id="scoreResultDescription" class="font-12 font-orange">${sentenceReadRecordVo.description }</span><span id="scoreStarPlus" class="font-12 font-orange" style="display: none;">智慧星 +<span>${starCount}</span></span></td></tr>
</table>
<div class="hr-long-orange" style="position: relative;top: -15px;"></div><!-- 句子内容  -->
<div style="line-height: 1.4; margin-bottom: 30px;"><span id="sentence_content" class="font-18 font-black" style="display:block; width: 100%;">${sentenceReadRecordVo.html }</span><span id="sentence_content_karaoke" class="font-18 font-black" style="display: none;"></span><span id="sentence_content_trans" class="font-18 font-black" style="display: none;">${sentenceVo.translation }</span>
</div><div style="position: absolute; bottom: 15px; width: 500px;"><!-- 下角图标 --><div style="float: right;"><input id="play_sentence_original_btn" class="icon-button speaker" type="button" title="听原音" /><input id="play_sentence_record_btn" class="icon-button headset" type="button" voiceId="${sentenceReadRecordVo.readVoiceId }" title="听录音" /><input id="sentence_listen_and_record_btn" class="icon-button mic" type="button" title="跟读" /><input id="translation_btn" class="icon-button chn" type="button" title="查看翻译" /><input id="sentence_collected" class="icon-button favorited" type="button" title="取消收藏" style="display: none;"/><input id="sentence_uncollected" class="icon-button favorite" type="button" title="收藏" style="display: ${empty currentUserId?'none':''}"/></div>
</div>
</div>


本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/497652.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

工具用途_见微知著,小工具大用途!

为什么同一个饮品&#xff0c;店家做的尝起来如此美味。拿到配方后自己做的不是甜了就是酸了呢&#xff1f;相信很多朋友都有这种疑惑。但真相往往就会在不经意间被忽视&#xff0c;很多初学者并没有老师傅那样的熟练手感&#xff0c;可以做到信手拈来的程度。当没有那些量勺&a…

带暂停功能的音频播放代码参考

1、页面来源&#xff1a;sentenceExercise07.jsp 2、页面效果 3、源代码 <% page language"java" pageEncoding"UTF-8" contentType"text/html;charsetUTF-8"%> <% include file"/common/taglibs.jsp"%> <% include f…

Yann LeCun 怒喷 Sophia:这就是彻头彻尾的骗局

来源&#xff1a;雷锋网&#xff08;leiphone-sz&#xff09;作者&#xff1a;杨晓凡在各种机器学习方法火热、神经网络加速芯片和生成式模型火热、研究人员们常常为优秀论文拍案叫绝的 2017 年中&#xff0c;普通大众视野中的热门人工智能成果除了 AlphaGo&#xff0c;还有一件…

ad16自动布线设置规则_AD16快捷方式和常规设置

1.快捷方式:快速修改丝印位置。选中元件 按快捷键A然后按P。Ti &#xff1a;差分等长TR &#xff1a;蛇形走线MG &#xff1a;修改铜皮多根走线(选中要走的几根线 按快捷键TTM 几根可以同时走线。PM)调整元件坐标移动(选中元件 按一下M 选择通过X、Y移动选择。)shiftG&#xff…

麦肯锡报告:传统车企正面临出行的数字化颠覆

来源&#xff1a;车云未来的个人出行情景将迎来一个巨大转变&#xff0c;更加倾向于颠覆性科技和其创新商业模式。毫无疑问&#xff0c;汽车产业正在面临颠覆。消费者行为上的巨大变化正在改变汽车行业的现状&#xff0c;尤其是因为人们更加注重了所有的车内体验&#xff0c;而…

win10触屏输入法_触摸屏笔记本Win10电脑的校准技巧

Microsoft的Surface系列设备旨在优化Windows 10触摸和笔输入功能。 但是&#xff0c;经过一段时间后&#xff0c;输入精度会下降。 此外&#xff0c;还有许多其他触摸式二合一笔记本电脑和来自其他厂商的混合设备。 并不是所有这些都在出厂时具有最佳的触摸输入精度校准。 这导…

大牛预测2018年深度学习走向:大批AI硬件初创将失败

来源&#xff1a;智东西导语&#xff1a;本文作者Carlos E. Perez是Intuition Machine公司的创始人&#xff0c;曾经编写《人工直觉与深度学习手册》&#xff08; Artificial Intuition and the Deep Learning Playbook&#xff09;&#xff0c;他将会在2018年3月1日至2日在阿姆…

QueryPage使用示例

1、通过关联的表的某字段查询和排序 表的关系 代码 /*** * <p>Description&#xff1a;查找作业记录</p>* <p>Paramenter&#xff1a;</p>* <p>Return&#xff1a;</p>* <p>Exception&#xff1a;</p>* <p>Modified Hi…

alientek 3.5寸tftlcd模块资料_电冰箱触摸屏提高设备档次,深圳3.5寸人机界面厂家...

随着互联网的发展加上触摸屏显示器的贴合在一块&#xff0c;现在我们家电越来越智能化&#xff0c;比如现在比较流行的家电冰箱触摸屏&#xff0c;可以在手机上通过触摸屏来对冰箱进行选项设置。电脑冰箱控制系统包括金玺触摸屏、显示控制板、电磁阀、温度传感器以及导线。主控…

推荐|5种商业AI产品的技术架构设计!

来源&#xff1a; 达观数据概要&#xff1a;今天我们就特别推荐达观数据的几个商业产品设计技术架构&#xff0c;希望对于广大技术有帮助。做任何一个商业产品设计&#xff0c;技术架构都是首先要考虑的&#xff0c;特别是面对海量数据的AI商业项目更是如此。今天我们就特别推荐…

多个iframe同时加载并动态调整大小

动态调整iframe高度的函数 function dyniframesize(ifm) {var pTar null; if (document.getElementById){ pTar document.getElementById(ifm); }else{ eval(pTar ifm ;); }$(pTar).parent().css("visibility", "hidden");if (pTar && pTar.…

没有数据也能翻译?一文读懂「无监督」机器翻译

原文来源&#xff1a;buZZrobot作者&#xff1a;Harshvardhan Gupta「雷克世界」编译&#xff1a;KABUDA、嗯~阿童木呀深度学习正在被广泛地运用于各项日常任务当中&#xff0c;尤其是涉及到一定程度“ 人性化”的领域&#xff0c;例如&#xff0c;图像识别。与其他机器学习算法…

可输入过滤和直接选择的select控件

代码&#xff1a; <% page language"java" pageEncoding"UTF-8" contentType"text/html;charsetUTF-8"%> <% include file"/common/taglibs.jsp"%><script language"javascript" type"text/javascript&…

2017世界科技发展回顾(信息技术/先进制造)

来源&#xff1a;科技日报信息技术美国&#xff1a;量子计算机最耀眼&#xff0c;芯片研究成果再现2017年量子霸权的争夺趋热&#xff0c;谷歌和IBM展开“老大”地位之争。已推出9量子位计算机的谷歌4月宣布将在年底推出49量子位处理器&#xff1b;IBM则后发先至&#xff0c;继…

产生和防御对抗样本的新方法 | 分享总结

来源&#xff1a;AI研习社作者&#xff1a;杨文在线上公开课上&#xff0c;来自清华大学的在读博士生廖方舟分享了他们团队在 NIPS 2017 上一个对抗样本攻防大赛中提到的两个新方法&#xff0c;这两个方法在大赛中分别获得了攻击方和防守方的第一名。在此可看视频回放&#xff…

36小时,造一个亚马逊无人商店 | 实战教程+代码

夏乙 问耕 编译整理量子位 出品 | 公众号 QbitAIclass"video_iframe" data-vidtype"2" allowfullscreen"" frameborder"0" data-ratio"1.7666666666666666" data-w"848" scrolling"no" data-src"h…

穷查理宝典--人类误判心理学思维导图

穷查理宝典--人类误判心理学思维导图 分享地址&#xff1a;https://www.processon.com/view/link/5d6e0976e4b09176f3092aa6

深度学习将眼睛变成健康“指示器”

来源&#xff1a;科学网概要&#xff1a;科学家正利用该方法寻找基因组中的突变&#xff0c;并且预测单个细胞布局的变化。眼膜图象可使计算机预测一个人是否会马上心脏病发作。人们常说&#xff0c;眼睛是心灵的窗户。但谷歌公司的研究人员将其视为个人健康的“指示器”。这个…

AI智能手机会是什么样?至少有这十个功能

来源&#xff1a;腾讯科技&#xff0c;编译&#xff1a;云开概要&#xff1a;AI功能将成为智能手机厂商提升产品差异度&#xff0c;获得新客户&#xff0c;留住现有用户的一种手段。业界媒体digit近日发表文章称&#xff0c;据调研公司Gartner预测&#xff0c;到2022年&#xf…

Mockito教程--思维导图笔记

笔记来源&#xff1a;https://blog.csdn.net/xiang__liu/article/details/81147933 思维导图地址&#xff1a;https://www.processon.com/view/link/5da7bfbfe4b0ea86c2b3db94