Changeset 36861


Ignore:
Timestamp:
2022-10-22T17:45:58+13:00 (18 months ago)
Author:
davidb
Message:

Now auto-seeks to matching point (offsetFrame)

Location:
gs3-installations/mars/trunk/sites/mars/collect/amc-essentia
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • gs3-installations/mars/trunk/sites/mars/collect/amc-essentia/etc/collectionConfig.xml

    r36860 r36861  
    119119      <xsl:choose>
    120120        <xsl:when test="/page/pageResponse/service/@name = 'AudioQuery'">
     121          <gsf:variable name="frameOffset">
     122        <xsl:value-of select="@frameOffset"/>
     123          </gsf:variable>
     124          <gsf:variable name="rank">
     125        <xsl:value-of select="@rank"/>
     126          </gsf:variable>
     127         
    121128          <a>
    122129        <xsl:choose>
     
    130137        <gsf:metadata name="amc.title"/>
    131138        by <gsf:metadata name="amc.artist"/>
    132           </a>     
     139          </a>
     140   
     141          <span style="font-style: italics; font-size: 100%" >
     142        (Matching offset @ <xsl:value-of select="@frameOffset"/> secs)
     143          </span>
     144
     145         
    133146        </xsl:when>
    134147        <xsl:otherwise>
     
    474487            <gsf:template name="documentHeading">
    475488              <!-- title will be dsiplayed in playbar at top of page, so supress showing title here -->
     489              <!--
    476490              <gsf:script src="interfaces/{$interface_name}/js/direct-edit-source.js"/>
    477491              <xsl:call-template name="init-direct-edit"/>
     492              -->
    478493            </gsf:template>
    479494           
     
    512527              -->
    513528             
     529              <gsf:script src="{$httpCollection}/js/av_document.js"/>
     530
    514531              <div class="documenttext" style="padding-bottom: 20px; width:100%;">
    515532                <style>
     
    548565             
    549566              <div class="documenttext">
    550 
    551 
     567               
     568                <style>
     569                  #wave-timeline {
     570                    background-color: #fff;
     571                }
     572                </style>
     573               
    552574        <div id="demo">
    553575            <div id="waveform">
     
    578600        <div>
    579601       
    580           <div class="controls">
     602          <div class="controls">
     603        <button class="btn btn-primary" onclick="AVSeekTo(0)">
     604          Return to Start
     605        </button>
     606
     607        <!--
    581608        <button class="btn btn-primary" data-action="play">
    582609                  <i class="glyphicon glyphicon-play"></i>
     
    585612                  Pause
    586613        </button>
     614        -->
     615       
     616        <button class="btn btn-primary" onclick="AVPlayPause()">
     617                  Play
     618        </button>
     619       
    587620              </div>
    588621        </div>
     
    594627      <xsl:text>  </xsl:text>
    595628    </script>
     629
    596630    <gsf:script>
     631      //var currentPosIsZero = true;
     632
     633
     634     
    597635      document.addEventListener('DOMContentLoaded', function() {
     636        postInitWavesurfer(wavesurfer);
     637/*   
    598638        // Load audio from URL
    599639        wavesurfer.load(gs.variables.mp3url);
     
    604644          var current_time_rounded = current_time.toFixed(1);
    605645          $('#audioCurrentPos').html(current_time_rounded + " secs");
    606         });     
     646
     647          if (current_time == 0) {
     648            recommendFromStart();
     649            //currentPosIsZero = true;
     650            //$('#makeRecommendationFrom').html("Based on the start of this musical/sound art work: ");
     651          }
     652          else if ((currentPosIsZero) &amp;&amp; (current_time > 0)) {
     653            recommendFromPos();
     654            //currentPosIsZero = false;
     655           // $('#makeRecommendationFrom').html("Based on the current timeline position of this musical/sound art work: ");
     656          }
     657          });
     658*/       
    607659      });
    608660    </gsf:script>
     661
    609662              </div>
    610663
     
    663716                <input name="s1.arousal" type="hidden" value="0"/>
    664717                <input name="s1.valence" type="hidden" value="0"/>
     718
     719                <div style="font-style: italics;">
     720                  <span id="makeRecommendationFrom">
     721                Based on the start of this musical/sound art work:
     722                  </span>
     723                  <input onclick="preSubmit(this.form);" type="submit" value="Make Arousal-Valence Recommendations"/>
     724                </div>
    665725               
    666                 <div style="font-style: italics;">Make arousal-valence music recommendation based on content  @ <span id="audioCurrentPos">0 secs</span>:
     726                <div style="font-style: italics; display: none;">
     727                  Make arousal-valence music recommendation based on content  @ <span id="audioCurrentPos">0 secs
     728                  </span>:
    667729                <!--,
    668730                with excerpt lasting <span class="editable-offset" id="audioWindowDuration" style="cursor: pointer; border: 1px solid black; padding: 3px; width: 200px; min-width: 200px;">3.0</span> secs
    669731                -->
    670                 <input onclick="preSubmit(this.form);" type="submit" value="Recommend"/></div>
     732                </div>
    671733              </form>
    672734              <hr/>
     735              <!--
    673736              <script>
    674737                <xsl:text disable-output-escaping="yes">
    675 
    676 /*               
    677     function playFromOffset(id,frameOffset)
    678     {
    679       var msecOffset = 250 * frameOffset;
    680       idElem = document.getElementById(id);
    681       pagePlayer.handleClick({target:idElem}); // fake a click
    682       soundManager.stopAll();
    683       // soundManager.setPosition(id,5000);
    684       soundManager.play(id,{position: msecOffset});
    685     }
    686     */
    687    
    688     function preSubmit(form)
    689     {
    690       // Note, the Arousal and Valence feature window values used is:
    691       //   6 secs + 50% overlap
    692       // So the Weka computed AV values are spaced out:
    693       //   6s, 9s, 12s, ...
    694 
    695       // clamp to ensure >= 6.0 secs
    696       var current_time = Math.max(6.0,wavesurfer.getCurrentTime());
    697 
    698       wavesurfer.pause();
    699 
    700       weka_segment = Math.round(current_time/3) * 3;
    701       form.elements["s1.offset"].value = weka_segment;
    702      
    703       var arousal_val = parseFloat($('#arousal-val').text());
    704       var valence_val = parseFloat($('#valence-val').text());
    705 
    706       //console.log("arousal val = " + arousal_val);
    707       //console.log("valence val = " + valence_val);
    708 
    709       form.elements["s1.arousal"].value = arousal_val;
    710       form.elements["s1.valence"].value = valence_val;
    711      
    712 
    713     /*
    714       var currentPosElem = document.getElementById("audioCurrentPos");
    715       var offsetInMSecs = currentPosElem.getAttribute("offsetInMSecs");
    716       var frameOffset = Math.round(offsetInMSecs/250.0);
    717       form.elements["s1.offset"].value = frameOffset;
    718 
    719       var lengthInSecs = document.getElementById("audioWindowDuration").innerHTML;
    720 
    721       var frameLength = Math.round(lengthInSecs*1000/250.0);
    722       form.elements["s1.length"].value = frameLength;
    723       */
    724       return true;
    725     }
    726738                </xsl:text>
    727739              </script>             
    728 
     740              -->
    729741             
    730742            </xsl:template>
Note: See TracChangeset for help on using the changeset viewer.