-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New audio player - Review of iss127 #135
Conversation
… with the same freesound id
…s loaded w/out ajax
There is a problem when building players that share the same Freesound ID. <div class="player_container">
<div class="soundplayer" id="s{{ freesound_id }}">
...
</div>
</div> var playerOptions = {
...
freesound_id: "{{ freesound_id }}",
...
};
var player = new Player(playerOptions) Wavseurfer.js wants the element where the player will be built in ( If I want to generate dynamic and unique IDs on the server-side without using global Python variables, I need to know either:
Solutions that have been proposed are:
Otherwise we should find a way to pass directly the element to the Player constructor in the player template. @alastair @xavierfav any other ideas/opinions? |
In the case of the player in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
datasets/models.py
Outdated
img_types = ['spectrogram', 'waveform'] | ||
sizes = ['M', 'L'] | ||
if img_type not in img_types: | ||
return '#' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raising an exception here would make more sense.
<!--script src="{% static "audio-annotator/js/colormap/colormap.min.js" %}" type="text/javascript"></script--> | ||
<!--script src="{% static "audio-annotator/js/src/annotation_stages.js" %}" type="text/javascript"></script--> | ||
<!--script src="{% static "audio-annotator/js/src/hidden_image.js" %}" type="text/javascript"></script--> | ||
<!--script src="{% static "audio-annotator/js/src/components.js" %}" type="text/javascript"></script--> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clear commented script here
@@ -0,0 +1,26 @@ | |||
{% load general_templatetags %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think loading the general template tags here is not needed
@@ -30,7 +31,10 @@ <h2>Audio samples with candidate annotations for <div class="ui huge label">{{ n | |||
<tbody> | |||
{% for sound in sounds %} | |||
<tr> | |||
<td>{{ sound.freesound_id | fs_embed | safe }}</td> | |||
<td> | |||
{# {{ sound.freesound_id | fs_embed | safe }}#} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clear commented code
@@ -12,7 +18,8 @@ | |||
var popup = this | |||
var ajax_url = el.getAttribute('ajax_url') | |||
$.ajax({ | |||
url: ajax_url | |||
url: ajax_url, | |||
cache: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this "cache: true" really needed in the end?
There are other part of the code where there are this sort of AJAX requests for pop-ups.
I never saw problems with not caching some code, and since we finally send the lib files in the HTML template that includes the player, it is I guess not a problem anymore?
Anyway, I don't say to remove it. Just want to understand if this would be needed in other cases.
@@ -91,7 +98,8 @@ | |||
<tr><td>Examples</td> | |||
<td> | |||
{% for fsid in node.freesound_examples %} | |||
{{ fsid| fs_embed | safe }} | |||
{# {{ fsid| fs_embed | safe }}#} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clear
@@ -67,7 +70,8 @@ | |||
<tr><td>Examples</td> | |||
<td> | |||
{% for fsid in node.freesound_examples %} | |||
{{ fsid| fs_embed | safe }} | |||
{% sound_player dataset fsid "small" %} | |||
{# {{ fsid| fs_embed | safe }}#} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clear
Here I added a new player to replace the default Freesound one (see #127).
For that, we are using a slightly modified version of wavesurfer.js, which will also allow us to bind it to Crowdcurio when we will need to add timestamps to the annotations (se #123). The main difference here is that the waveform is not drawn by wavesurfer.js. The Freesound images (waveform and spectrogram) are used instead.
Other problems solved are the fact that the play button was too small on the Freesound player (#14), and that playing an audio clip wouldn't stop other clips eventually playing at the same time (#96).