I'm new in Django and JS. Trying to create HTML5 audioplayer with custom controls. When I start page nothing happens.
Tested this mp3 with default player and everything is ok. So I think static settings is correct.
Folder structure:
..stream (the app)
....static
......stream
........audio
..........test.mp3
........scripts
..........player.js
....templates
......index.html
This is my index.html. The base template is almost empty.
{% extends "base_generic.html" %}
{% block content %}
{% load static %}
<script src="{% static "stream/scripts/player.js" %}" type="text/javascript"></script>
<audio src="{% static "stream/audio/test.mp3" %}" type="audio/mpeg">
{% endblock %}
And this is my player.js
var aud = $('audio')[0];
aud.play();
I expect that when I open the page, the music would start playing.
document.getElementsByTagName('audio')[0].play();