#250 seeking couplet recitations

This commit is contained in:
Hamid Reza Mohammadi 2021-12-01 21:43:42 +03:30
parent c9ba4cdd62
commit da12fdc8e2
3 changed files with 21 additions and 11 deletions

View File

@ -110,6 +110,17 @@
}
};
</script>
<script>
var narrators = [];
@foreach (var recitation in Model.GanjoorPage.Poem.Recitations)
{
<text>
narrators.push('@Html.Raw(recitation.AudioArtist)');
audioxmlfiles.push('@($"{GanjooRazor.APIRoot.InternetUrl}/api/audio/file/{recitation.Id}.xml")');
</text>
}
</script>
}
}

View File

@ -33,8 +33,6 @@
_trackTimeChanged(document.getElementById('audio-@(nRecitationIndex + 1)'));
});
</script>
</div>
@if (nRecitationIndex == 4 && Model.Recitations.Length > 5)

View File

@ -415,12 +415,11 @@ function getVerseIndexFromCoupleIndex(coupletIndex) {
function playCouplet(coupletIndex) {
var vIndex = getVerseIndexFromCoupleIndex(coupletIndex);
if (jlist.isPlaying) {
jlist.pause();
}
var comboId = '#narrators-' + coupletIndex;
var recitationIndex = $(comboId).find(":selected").val()
jlist.select(recitationIndex);
var recitationIndex = parseInt($(comboId).find(":selected").val());
var recitationOrder = recitationIndex + 1;
if (audioxmlfiles.length > 0) {
$.ajax({
@ -439,13 +438,15 @@ function playCouplet(coupletIndex) {
var v = parseInt($(this).find('VerseOrder').text())
if (v == vIndex) {
var verseStart = parseInt($(this).find('AudioMiliseconds').text()) / nOneSecondBugFix;
$(jlist.cssSelector.jPlayer).jPlayer("play");
var audioControl = document.getElementById('audio-' + String(recitationOrder));
audioControl.play();
var buttonList = '#listen-' + coupletIndex;
$(buttonList).text('در حال دریافت خوانش ...');
setTimeout(function () {
$(jlist.cssSelector.jPlayer).jPlayer("play", verseStart);
audioControl.currentTime = verseStart;
$(buttonList).text('در حال خواندن');
}, 100);
foundCouplet = true;
var buttonList = '#listen-' + coupletIndex;
$(buttonList).text('در حال خواندن');
return false;
}
});