diff --git a/.DS_Store b/.DS_Store
index b5395b1ec2b4f99c3940ff07a4d7a180b660b643..9c90ee4970293569d7efd12a52c6b1747bdbc6b2 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/Magenta/all_instruments/.DS_Store b/Magenta/all_instruments/.DS_Store
index 42f16ef7eac61b452e1220772826c77697884664..0a27533ca54907b9cd453c2ba87a3d611b7011f4 100644
Binary files a/Magenta/all_instruments/.DS_Store and b/Magenta/all_instruments/.DS_Store differ
diff --git a/fantasmixDjango/.DS_Store b/fantasmixDjango/.DS_Store
index 496dc06057f264a8e2b783b81095fae4c7dfca3a..13c87a670a53dfc6d53ebe5e58b22fd8f414f8b6 100644
Binary files a/fantasmixDjango/.DS_Store and b/fantasmixDjango/.DS_Store differ
diff --git a/fantasmixDjango/django_project/-i89 b/fantasmixDjango/django_project/-i89
new file mode 100644
index 0000000000000000000000000000000000000000..3f04c222b1fbd7043ebd30e93e34ddecd20d8616
Binary files /dev/null and b/fantasmixDjango/django_project/-i89 differ
diff --git a/fantasmixDjango/django_project/-in b/fantasmixDjango/django_project/-in
new file mode 100644
index 0000000000000000000000000000000000000000..ca0f3ed57a7901e6ab651647dc52aac26fcd2946
Binary files /dev/null and b/fantasmixDjango/django_project/-in differ
diff --git a/fantasmixDjango/django_project/-n89 b/fantasmixDjango/django_project/-n89
new file mode 100644
index 0000000000000000000000000000000000000000..65d592df0ab2898d12e5b5827225639cda3bf87b
Binary files /dev/null and b/fantasmixDjango/django_project/-n89 differ
diff --git a/fantasmixDjango/django_project/.DS_Store b/fantasmixDjango/django_project/.DS_Store
index c1007dd57019249fd4d84b9738805be9914524da..f8c5fe985127459d6792444fcce96233d6983fff 100644
Binary files a/fantasmixDjango/django_project/.DS_Store and b/fantasmixDjango/django_project/.DS_Store differ
diff --git a/fantasmixDjango/django_project/audiofield/__init__.py b/fantasmixDjango/django_project/audiofield/__init__.py
new file mode 100755
index 0000000000000000000000000000000000000000..1ea98159c0533b6ed0d3534df480475c9c8ff5f1
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/__init__.py
@@ -0,0 +1,17 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+"""
+Django-audiofield is a Django application which allows audio file upload
+and conversion to mp3, wav and ogg format.
+
+It also makes it easy to play the audio files into your django application.
+
+Project location : https://github.com/Star2Billing/django-audiofield
+"""
+
+__version__ = '0.10.0' # edit also docs/source/conf.py and update requirements.txt
+__author__ = "Areski Belaid"
+__contact__ = "areski@gmail.com"
+__homepage__ = "http://areskibelaid.com/"
+__docformat__ = "restructuredtext"
diff --git a/fantasmixDjango/django_project/audiofield/__pycache__/__init__.cpython-37.pyc b/fantasmixDjango/django_project/audiofield/__pycache__/__init__.cpython-37.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..baaa9617f4f246272be0a402b8499b859c24546d
Binary files /dev/null and b/fantasmixDjango/django_project/audiofield/__pycache__/__init__.cpython-37.pyc differ
diff --git a/fantasmixDjango/django_project/audiofield/__pycache__/fields.cpython-37.pyc b/fantasmixDjango/django_project/audiofield/__pycache__/fields.cpython-37.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..fbb5186d3e64f7198d3411a99d647b6b75806c5e
Binary files /dev/null and b/fantasmixDjango/django_project/audiofield/__pycache__/fields.cpython-37.pyc differ
diff --git a/fantasmixDjango/django_project/audiofield/__pycache__/models.cpython-37.pyc b/fantasmixDjango/django_project/audiofield/__pycache__/models.cpython-37.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0d15f35e75fe6b3e5e3a9ce3ddab69b425e0885b
Binary files /dev/null and b/fantasmixDjango/django_project/audiofield/__pycache__/models.cpython-37.pyc differ
diff --git a/fantasmixDjango/django_project/audiofield/admin.py b/fantasmixDjango/django_project/audiofield/admin.py
new file mode 100755
index 0000000000000000000000000000000000000000..f41a4b9d0915d34a967cb05e138c596c9bdf19a7
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/admin.py
@@ -0,0 +1,46 @@
+#
+# django-audiofield License
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# Copyright (C) 2011-2014 Star2Billing S.L.
+#
+# The Initial Developer of the Original Code is
+# Arezqui Belaid <info@star2billing.com>
+#
+
+from django.contrib import admin
+from audiofield.models import AudioFile
+from django.utils.translation import ugettext_lazy as _
+import os
+
+
+class AudioFileAdmin(admin.ModelAdmin):
+ """Allows the administrator to view and modify uploaded audio files"""
+
+ list_display = ('id', 'name', 'audio_file_player', 'created_date', 'user')
+ # list_display_links = ['id', 'name',]
+ ordering = ('id', )
+
+ actions = ['custom_delete_selected']
+
+ def custom_delete_selected(self, request, queryset):
+ # custom delete code
+ n = queryset.count()
+ for i in queryset:
+ if i.audio_file:
+ if os.path.exists(i.audio_file.path):
+ os.remove(i.audio_file.path)
+ i.delete()
+ self.message_user(request, _("Successfully deleted %d audio files.") % n)
+ custom_delete_selected.short_description = "Delete selected items"
+
+ def get_actions(self, request):
+ actions = super(AudioFileAdmin, self).get_actions(request)
+ del actions['delete_selected']
+ return actions
+
+
+admin.site.register(AudioFile, AudioFileAdmin)
diff --git a/fantasmixDjango/django_project/audiofield/fields.py b/fantasmixDjango/django_project/audiofield/fields.py
new file mode 100755
index 0000000000000000000000000000000000000000..bf140d818302397d656ffd05eade159fe45db175
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/fields.py
@@ -0,0 +1,298 @@
+#
+# django-audiofield License
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# Copyright (C) 2011-2014 Star2Billing S.L.
+#
+# The Initial Developer of the Original Code is
+# Arezqui Belaid <info@star2billing.com>
+#
+
+from django.db.models.fields.files import FileField
+from django.db.models import signals
+from django.conf import settings
+from django.core.files.storage import FileSystemStorage
+from django.utils.translation import ugettext_lazy as _
+from django import forms
+from celery.utils.log import get_task_logger
+from audiofield.middleware import threadlocals
+from audiofield.tasks import audio_convert_task
+import os
+import subprocess
+import shutil
+from random import choice, seed
+
+seed()
+logger = get_task_logger(__name__)
+CONVERT_TYPE_CHK = {0: 'org', 1: 'mp3', 2: 'wav', 3: 'ogg'}
+
+
+def random_string(char_length=5, digit_length=10):
+ chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ digit = "1234567890"
+ pass_str_char = ''.join([choice(chars) for i in range(char_length)])
+ pass_str_digit = ''.join([choice(digit) for i in range(digit_length)])
+ return pass_str_char + '-' + pass_str_digit
+
+
+class StdAudioField:
+ '''
+ Instances of this class will be used to access data of the converted
+ audio files
+ '''
+ def __init__(self, name):
+ self.name = name
+ self.storage = FileSystemStorage()
+
+ def path(self):
+ return self.storage.path(self.name)
+
+ def url(self):
+ return self.storage.url(self.name)
+
+ def size(self):
+ return self.storage.size(self.name)
+
+
+class AudioField(FileField):
+ '''
+ Django field that behaves as FileField, with some extra features like:
+ - Audio Player
+ - Delete specific file
+ - Convert to specific format
+ '''
+ size = None
+ uuid = None
+ filename_prefix = 'audio-file-'
+
+ def __init__(self, *args, **kwargs):
+ """Get allowed file extension type (ex. mp3, wav)"""
+ ext_whitelist = kwargs.pop("ext_whitelist", tuple())
+ self.ext_whitelist = [i.lower() for i in ext_whitelist]
+ super(AudioField, self).__init__(*args, **kwargs)
+
+ def clean(self, data, initial=None):
+ """Audio field validation for file extension"""
+ data = super(AudioField, self).clean(data, initial)
+
+ request = threadlocals.get_current_request()
+
+ filename = data.name
+ ext = os.path.splitext(filename)[1]
+ ext = ext.lower()
+ if ext not in self.ext_whitelist:
+ error_msg = _("not allowed filetype!")
+ logger.error(error_msg)
+ raise forms.ValidationError(error_msg)
+
+ convert_to = request and int(request.POST["convert_type"])
+ ext = ext.split('.')[1]
+ audio_type = CONVERT_TYPE_CHK[convert_to]
+ error_msg = _("not allowed : file format conversion is not allowed for same audio type (except Wav)")
+ if convert_to:
+ if ext == audio_type and ext != 'wav':
+ error_msg += ' %s format !!' % ext
+ logger.error(error_msg)
+ raise forms.ValidationError(error_msg)
+ else:
+ pass
+
+ return data
+
+ def _get_converted_filename(self, filename):
+ # Not used
+ '''Returns the audio converted name associated to the standard audio filename
+ * Example: /var/www/myproject/media/audio/picture_1.wav
+ will return /var/www/myproject/media/audio/picture_1.converted.wav
+ '''
+ splitted_filename = list(os.path.splitext(filename))
+ splitted_filename.insert(1, '.converted')
+ logger.debug('converted file name')
+ return ''.join(splitted_filename)
+
+ def _convert_audio(self, filename, instance=None, ext=None):
+ '''Convert uploaded audio file to selected format'''
+ request = threadlocals.get_current_request()
+
+ convert_type = 0
+ channel_no = 0
+ freq_value = 0
+ nbchannels = 1
+ remix = ''
+
+ if 'convert_type' in request.POST:
+ convert_type = int(request.POST["convert_type"])
+ if 'channel_type' in request.POST:
+ channel_no = int(request.POST["channel_type"])
+ if 'freq_type' in request.POST:
+ freq_value = int(request.POST["freq_type"])
+
+ logger.info("convert audio : %s->%s" % (str(ext), CONVERT_TYPE_CHK[convert_type]))
+ splitted_filename = list(os.path.splitext(filename))[0] # converted filename without ext
+ filename_temp = filename[:-4] + '_temp'
+
+ # Find the number of channels
+ if os.path.isfile(filename):
+ command = "soxi -c %s" % filename
+ response = subprocess.Popen(command.split(' '), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ (output, error) = response.communicate()
+ nbchannels = (int(output))
+
+ # prepare Sox parameters for Channels convertion
+ conv_channel = "-e signed-integer -c %s" % str(channel_no) if channel_no > 0 else ''
+ # prepare Sox parameters for Frequency convertion
+ conv_freq = "-r %s" % str(freq_value) if freq_value > 0 else ''
+
+ if nbchannels == 2:
+ # sox input.wav output.wav `remix -` performs a mix-down of all input channels to mono.
+ remix = 'remix -'
+
+ # 1) MP3 TO WAV
+ if ext == 'mp3' and CONVERT_TYPE_CHK[convert_type] == 'wav':
+ logger.debug("convert MP3 to WAV - channel %s freq: %s" % (str(channel_no), str(freq_value)))
+ conv = "sox %s %s %s %s.wav %s" % (filename, conv_freq, conv_channel, splitted_filename, remix)
+ conv = conv.replace(' ', ' ')
+ result = audio_convert_task.delay(conv)
+ logger.debug("Sox command :> %s" % conv)
+
+ # 2) MP3 TO OGG
+ if ext == 'mp3' and CONVERT_TYPE_CHK[convert_type] == 'ogg':
+ logger.debug('MP3 to OGG')
+ conv = "dir2ogg -q 4 %s" % (filename)
+ result = audio_convert_task.delay(conv)
+
+ # 3) WAV TO MP3
+ if ext == 'wav' and CONVERT_TYPE_CHK[convert_type] == 'mp3':
+ logger.debug('WAV to MP3')
+ conv = "sox %s %s.mp3 %s" % (filename, splitted_filename, remix)
+ result = audio_convert_task.delay(conv)
+ logger.debug("Sox command :> %s" % conv)
+
+ # 3) WAV TO WAV
+ if ext == 'wav' and CONVERT_TYPE_CHK[convert_type] == 'wav':
+ # if nbchannels == 2:
+ # remix = 'remix 1,2i'
+ filename_temp = filename_temp + '.wav'
+ conv = "sox %s %s %s %s.wav %s" % (filename_temp, conv_freq, conv_channel, splitted_filename, remix)
+ conv = conv.replace(' ', ' ')
+ # cmd = 'sox /usr/share/newfies/../newfies/usermedia/upload/audiofiles/audio-file-XFPQN-6216731785_temp.wav -r 8000 -e signed-integer -c 1 /usr/share/newfies/../newfies/usermedia/upload/audiofiles/audio-file-XFPQN-6216731785.wav'
+ # create a temp copy of the file
+ shutil.copy2(filename, filename_temp)
+ result = audio_convert_task.delay(conv)
+ logger.debug("result :> %s" % str(result))
+
+ # 4) WAV TO OGG
+ if ext == 'wav' and CONVERT_TYPE_CHK[convert_type] == 'ogg':
+ logger.debug('WAV to OGG')
+ conv = "sox %s %s.ogg %s" % (filename, splitted_filename, remix)
+ result = audio_convert_task.delay(conv)
+
+ # 5) OGG TO MP3
+ if ext == 'ogg' and CONVERT_TYPE_CHK[convert_type] == 'mp3':
+ logger.debug('OGG to MP3')
+ conv = "sox %s %s.mp3%s" % (filename, splitted_filename, remix)
+ result = audio_convert_task.delay(conv)
+
+ # 6) OGG TO WAV
+ if ext == 'ogg' and CONVERT_TYPE_CHK[convert_type] == 'wav':
+ logger.debug('OGG to WAV')
+ # conv = "sox %s %s.wav" % (filename, splitted_filename)
+ conv = "avconv -i %s -map_metadata 0:s:0 %s.wav" % (filename, splitted_filename)
+ result = audio_convert_task.delay(conv)
+
+ def _rename_audio(self, instance=None, **kwargs):
+ '''Rename uploaded audio file & calls methods to convert audio file format if
+ convert_to is selected'''
+ if getattr(instance, self.name):
+ filename = getattr(instance, self.name).path
+
+ # Get the extension and limit to 3 chars
+ ext = os.path.splitext(filename)[1].lower()[:4]
+ # Get new file name and make sure it's unique
+ dst = self.generate_filename(instance, '%s%s%s' % (self.filename_prefix, self.uuid, ext))
+ dst_fullpath = os.path.join(settings.MEDIA_ROOT, dst)
+
+ # Same file should not exits
+ if not os.path.isfile(dst_fullpath):
+
+ if os.path.abspath(filename) != os.path.abspath(dst_fullpath):
+ os.rename(filename, dst_fullpath)
+ self._convert_audio(dst_fullpath, instance, ext[1:4])
+
+ request = threadlocals.get_current_request()
+ convert_type = int(request.POST["convert_type"])
+
+ # 0 => Keep original
+ if convert_type > 0:
+ # Delete original audio file
+ if os.path.exists(dst_fullpath):
+ # Check for no .. and no *
+ # DISABLED Delete file
+ """
+ if dst_fullpath.find('../../') == -1 and dst_fullpath.find('*') == -1:
+ os.remove(dst_fullpath)
+ """
+ ext = '.' + CONVERT_TYPE_CHK[convert_type]
+ dst = self.generate_filename(instance, '%s%s%s' %
+ (self.filename_prefix, self.uuid, ext))
+ setattr(instance, self.attname, dst)
+ instance.save()
+ else:
+ error_msg = ("file already exists!")
+ logger.error(error_msg)
+
+ def _set_audio_converted(self, instance=None, **kwargs):
+ '''Creates a "audio_field" object as attribute of the FileField instance
+ audio_field attribute will be of the same class of original file, so
+ "path", "url", "name"... properties can be used'''
+ if getattr(instance, self.name):
+ filename = self.generate_filename(instance, os.path.basename(getattr(instance, self.name).path))
+ audio_field = StdAudioField(filename)
+ setattr(getattr(instance, self.name), 'audio_converted', audio_field)
+
+ def formfield(self, **kwargs):
+ '''Specify form field and widget to be used on the forms'''
+ from audiofield.widgets import AdminAudioFileWidget
+ from audiofield.forms import AudioFormField
+ kwargs['widget'] = AdminAudioFileWidget
+ kwargs['form_class'] = AudioFormField
+
+ return super(AudioField, self).formfield(**kwargs)
+
+ def save_form_data(self, instance, data):
+ '''Overwrite save_form_data to delete audio files if "delete" checkbox
+ is selected'''
+ if data == '__deleted__':
+ filename = getattr(instance, self.name).path
+ if os.path.exists(filename):
+ # Check for no .. and no *
+ if filename.find('../../') == -1 and filename.find('*') == -1:
+ os.remove(filename)
+ setattr(instance, self.name, None)
+ else:
+ self.uuid = random_string(5, 10)
+ super(AudioField, self).save_form_data(instance, data)
+
+ def contribute_to_class(self, cls, name):
+ '''Call methods for generating all operations on specified signals'''
+ super(AudioField, self).contribute_to_class(cls, name)
+ signals.post_save.connect(self._rename_audio, sender=cls)
+ signals.post_init.connect(self._set_audio_converted, sender=cls)
+
+
+try:
+ from south.modelsinspector import add_introspection_rules
+ add_introspection_rules([(
+ [AudioField],
+ [],
+ {
+ "ext_whitelist": ["ext_whitelist", {}],
+ },
+ ),
+ ], ["^audiofield\.fields\.AudioField"])
+except ImportError:
+ # South is not enabled
+ pass
diff --git a/fantasmixDjango/django_project/audiofield/forms.py b/fantasmixDjango/django_project/audiofield/forms.py
new file mode 100755
index 0000000000000000000000000000000000000000..94fe94a6575ce4eee8fcaf97962a4f30663a3174
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/forms.py
@@ -0,0 +1,51 @@
+#
+# django-audiofield License
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# Copyright (C) 2011-2014 Star2Billing S.L.
+#
+# The Initial Developer of the Original Code is
+# Arezqui Belaid <info@star2billing.com>
+#
+from django import forms
+from django.forms.fields import FileField
+from django.forms import ModelForm
+from audiofield.models import AudioFile
+from audiofield.widgets import CustomerAudioFileWidget
+
+
+class AudioFormField(FileField):
+ """
+ Field Class to upload audio file
+ """
+ def clean(self, data, initial=None):
+ if data != '__deleted__':
+ return super(AudioFormField, self).clean(data, initial)
+ else:
+ return '__deleted__'
+
+
+class AdminAudioFileForm(ModelForm):
+ """
+ This form aims to be used in the django admin, support
+ all the features for convertion per default
+ """
+ class Meta:
+ model = AudioFile
+ fields = ['name', 'audio_file']
+
+
+class CustomerAudioFileForm(ModelForm):
+ """
+ The following form aims to be used on frontend to power
+ simple upload of audio files without convertion
+ """
+ audio_file = forms.FileField(widget=CustomerAudioFileWidget)
+
+ class Meta:
+ model = AudioFile
+ fields = ['name', 'audio_file']
+ exclude = ('user',)
diff --git a/fantasmixDjango/django_project/audiofield/locale/en/LC_MESSAGES/django.mo b/fantasmixDjango/django_project/audiofield/locale/en/LC_MESSAGES/django.mo
new file mode 100755
index 0000000000000000000000000000000000000000..c82d973ed0e01b7dc451fb388d07ae12d7a5ec70
Binary files /dev/null and b/fantasmixDjango/django_project/audiofield/locale/en/LC_MESSAGES/django.mo differ
diff --git a/fantasmixDjango/django_project/audiofield/locale/en/LC_MESSAGES/django.po b/fantasmixDjango/django_project/audiofield/locale/en/LC_MESSAGES/django.po
new file mode 100755
index 0000000000000000000000000000000000000000..5df20c61d789fbecb451c54a3e84082169621ec1
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/locale/en/LC_MESSAGES/django.po
@@ -0,0 +1,149 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: Django-Audiofield\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2018-01-21 11:38+0300\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: Belaid Arezqui <areski@gmail.com>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: audiofield/admin.py:37
+#, python-format
+msgid "Successfully deleted %d audio files."
+msgstr ""
+
+#: audiofield/fields.py:87
+msgid "not allowed filetype!"
+msgstr ""
+
+#: audiofield/fields.py:94
+msgid ""
+"not allowed : file format conversion is not allowed for same audio type "
+"(except Wav)"
+msgstr ""
+
+#: audiofield/models.py:35
+msgid "audio name"
+msgstr ""
+
+#: audiofield/models.py:36
+msgid "audio file label"
+msgstr ""
+
+#: audiofield/models.py:39 audiofield/models.py:50
+msgid "audio file"
+msgstr ""
+
+#: audiofield/models.py:40
+msgid "user"
+msgstr ""
+
+#: audiofield/models.py:41
+msgid "select user"
+msgstr ""
+
+#: audiofield/models.py:47
+msgid "can see Audio Files"
+msgstr ""
+
+#: audiofield/models.py:51
+msgid "audio files"
+msgstr ""
+
+#: audiofield/models.py:69
+msgid "audio file player"
+msgstr ""
+
+#: audiofield/widgets.py:24 audiofield/widgets.py:30
+msgid "Keep original"
+msgstr ""
+
+#: audiofield/widgets.py:25
+msgid "Mono"
+msgstr ""
+
+#: audiofield/widgets.py:26
+msgid "Stereo"
+msgstr ""
+
+#: audiofield/widgets.py:31
+msgid "8000 Hz"
+msgstr ""
+
+#: audiofield/widgets.py:32
+msgid "16000 Hz"
+msgstr ""
+
+#: audiofield/widgets.py:33
+msgid "22050 Hz"
+msgstr ""
+
+#: audiofield/widgets.py:34
+msgid "44100 Hz"
+msgstr ""
+
+#: audiofield/widgets.py:35
+msgid "48000 Hz"
+msgstr ""
+
+#: audiofield/widgets.py:39
+msgid "Keep original audio file"
+msgstr ""
+
+#: audiofield/widgets.py:40
+msgid "Convert to MP3"
+msgstr ""
+
+#: audiofield/widgets.py:41
+msgid "Convert to WAV"
+msgstr ""
+
+#: audiofield/widgets.py:42
+msgid "Convert to OGG"
+msgstr ""
+
+#: audiofield/widgets.py:79
+msgid "Allowed format - mp3 wav and ogg"
+msgstr ""
+
+#: audiofield/widgets.py:83 audiofield/widgets.py:141
+msgid "Currently:"
+msgstr ""
+
+#: audiofield/widgets.py:85 audiofield/widgets.py:143
+msgid "Change:"
+msgstr ""
+
+#: audiofield/widgets.py:87
+msgid "Upload:"
+msgstr ""
+
+#: audiofield/widgets.py:89
+msgid "Convert to:"
+msgstr ""
+
+#: audiofield/widgets.py:90
+msgid "Channel:"
+msgstr ""
+
+#: audiofield/widgets.py:91
+msgid "Frequency:"
+msgstr ""
+
+#: audiofield/widgets.py:95
+msgid "Delete:"
+msgstr ""
+
+#: audiofield/widgets.py:133
+msgid "Allowed format - mp3, wav and ogg"
+msgstr ""
diff --git a/fantasmixDjango/django_project/audiofield/locale/es/LC_MESSAGES/django.mo b/fantasmixDjango/django_project/audiofield/locale/es/LC_MESSAGES/django.mo
new file mode 100755
index 0000000000000000000000000000000000000000..46339fd1147ba46f5ae3ff8182951d78ec68bb02
Binary files /dev/null and b/fantasmixDjango/django_project/audiofield/locale/es/LC_MESSAGES/django.mo differ
diff --git a/fantasmixDjango/django_project/audiofield/locale/es/LC_MESSAGES/django.po b/fantasmixDjango/django_project/audiofield/locale/es/LC_MESSAGES/django.po
new file mode 100755
index 0000000000000000000000000000000000000000..295a4709ca20ca5c24f0dddc656da005ddef1c1c
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/locale/es/LC_MESSAGES/django.po
@@ -0,0 +1,175 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2018-01-21 11:39+0300\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1)\n"
+
+#: audiofield/admin.py:37
+#, python-format
+msgid "Successfully deleted %d audio files."
+msgstr "Eliminado correctamente %d archivos de audio."
+
+#: audiofield/fields.py:87
+msgid "not allowed filetype!"
+msgstr ""
+
+#: audiofield/fields.py:94
+msgid ""
+"not allowed : file format conversion is not allowed for same audio type "
+"(except Wav)"
+msgstr ""
+
+#: audiofield/models.py:35
+#, fuzzy
+#| msgid "Audio Name"
+msgid "audio name"
+msgstr "Nombre de audio"
+
+#: audiofield/models.py:36
+#, fuzzy
+#| msgid "Audio file label"
+msgid "audio file label"
+msgstr "Etiqueta del audio"
+
+#: audiofield/models.py:39 audiofield/models.py:50
+#, fuzzy
+#| msgid "Audio file"
+msgid "audio file"
+msgstr "Archivo de audio"
+
+#: audiofield/models.py:40
+msgid "user"
+msgstr ""
+
+#: audiofield/models.py:41
+#, fuzzy
+#| msgid "Select User"
+msgid "select user"
+msgstr "Seleccione Usuario"
+
+#: audiofield/models.py:47
+#, fuzzy
+#| msgid "Audio files"
+msgid "can see Audio Files"
+msgstr "Los archivos de audio"
+
+#: audiofield/models.py:51
+#, fuzzy
+#| msgid "Audio files"
+msgid "audio files"
+msgstr "Los archivos de audio"
+
+#: audiofield/models.py:69
+#, fuzzy
+#| msgid "Audio file player"
+msgid "audio file player"
+msgstr "Reproductor de archivos de audio"
+
+#: audiofield/widgets.py:24 audiofield/widgets.py:30
+msgid "Keep original"
+msgstr "Conservar original"
+
+#: audiofield/widgets.py:25
+msgid "Mono"
+msgstr "Mono"
+
+#: audiofield/widgets.py:26
+msgid "Stereo"
+msgstr "Estéreo"
+
+#: audiofield/widgets.py:31
+msgid "8000 Hz"
+msgstr "8000 Hz"
+
+#: audiofield/widgets.py:32
+msgid "16000 Hz"
+msgstr "16.000 Hz"
+
+#: audiofield/widgets.py:33
+msgid "22050 Hz"
+msgstr "22050 Hz"
+
+#: audiofield/widgets.py:34
+msgid "44100 Hz"
+msgstr "44100 Hz"
+
+#: audiofield/widgets.py:35
+msgid "48000 Hz"
+msgstr "48000 Hz"
+
+#: audiofield/widgets.py:39
+msgid "Keep original audio file"
+msgstr "Mantener el archivo de audio original"
+
+#: audiofield/widgets.py:40
+msgid "Convert to MP3"
+msgstr "Convertir a MP3"
+
+#: audiofield/widgets.py:41
+msgid "Convert to WAV"
+msgstr "Convertir a WAV"
+
+#: audiofield/widgets.py:42
+msgid "Convert to OGG"
+msgstr "Convertir a OGG"
+
+#: audiofield/widgets.py:79
+msgid "Allowed format - mp3 wav and ogg"
+msgstr "Formato permite - mp3 wav y ogg"
+
+#: audiofield/widgets.py:83 audiofield/widgets.py:141
+msgid "Currently:"
+msgstr "En la actualidad:"
+
+#: audiofield/widgets.py:85 audiofield/widgets.py:143
+msgid "Change:"
+msgstr "Cambio:"
+
+#: audiofield/widgets.py:87
+msgid "Upload:"
+msgstr "Subir:"
+
+#: audiofield/widgets.py:89
+#, fuzzy
+#| msgid "Convert To:"
+msgid "Convert to:"
+msgstr "Convertir a:"
+
+#: audiofield/widgets.py:90
+msgid "Channel:"
+msgstr "Canal:"
+
+#: audiofield/widgets.py:91
+msgid "Frequency:"
+msgstr "Frecuencia:"
+
+#: audiofield/widgets.py:95
+msgid "Delete:"
+msgstr "Eliminar:"
+
+#: audiofield/widgets.py:133
+msgid "Allowed format - mp3, wav and ogg"
+msgstr "Formato permite - mp3, wav y ogg"
+
+#~ msgid "English"
+#~ msgstr "Inglés"
+
+#~ msgid "Spanish"
+#~ msgstr "Español"
+
+#~ msgid "Portuguese"
+#~ msgstr "Portugués"
diff --git a/fantasmixDjango/django_project/audiofield/locale/pt/LC_MESSAGES/django.mo b/fantasmixDjango/django_project/audiofield/locale/pt/LC_MESSAGES/django.mo
new file mode 100755
index 0000000000000000000000000000000000000000..cafb322cc2c43c9e11deaf681050d575c9bf6ea0
Binary files /dev/null and b/fantasmixDjango/django_project/audiofield/locale/pt/LC_MESSAGES/django.mo differ
diff --git a/fantasmixDjango/django_project/audiofield/locale/pt/LC_MESSAGES/django.po b/fantasmixDjango/django_project/audiofield/locale/pt/LC_MESSAGES/django.po
new file mode 100755
index 0000000000000000000000000000000000000000..ab8792eeb748772b0336dacf208ecf1492ada113
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/locale/pt/LC_MESSAGES/django.po
@@ -0,0 +1,175 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2018-01-21 11:39+0300\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1)\n"
+
+#: audiofield/admin.py:37
+#, python-format
+msgid "Successfully deleted %d audio files."
+msgstr "Excluído com sucesso arquivos %d áudio."
+
+#: audiofield/fields.py:87
+msgid "not allowed filetype!"
+msgstr ""
+
+#: audiofield/fields.py:94
+msgid ""
+"not allowed : file format conversion is not allowed for same audio type "
+"(except Wav)"
+msgstr ""
+
+#: audiofield/models.py:35
+#, fuzzy
+#| msgid "Audio Name"
+msgid "audio name"
+msgstr "Nome de áudio"
+
+#: audiofield/models.py:36
+#, fuzzy
+#| msgid "Audio file label"
+msgid "audio file label"
+msgstr "Label arquivo de áudio"
+
+#: audiofield/models.py:39 audiofield/models.py:50
+#, fuzzy
+#| msgid "Audio file"
+msgid "audio file"
+msgstr "Arquivo de áudio"
+
+#: audiofield/models.py:40
+msgid "user"
+msgstr ""
+
+#: audiofield/models.py:41
+#, fuzzy
+#| msgid "Select User"
+msgid "select user"
+msgstr "Selecione Usuário"
+
+#: audiofield/models.py:47
+#, fuzzy
+#| msgid "Audio files"
+msgid "can see Audio Files"
+msgstr "Arquivos de áudio"
+
+#: audiofield/models.py:51
+#, fuzzy
+#| msgid "Audio files"
+msgid "audio files"
+msgstr "Arquivos de áudio"
+
+#: audiofield/models.py:69
+#, fuzzy
+#| msgid "Audio file player"
+msgid "audio file player"
+msgstr "Reprodutor de arquivos de áudio"
+
+#: audiofield/widgets.py:24 audiofield/widgets.py:30
+msgid "Keep original"
+msgstr "Manter original"
+
+#: audiofield/widgets.py:25
+msgid "Mono"
+msgstr "Mono"
+
+#: audiofield/widgets.py:26
+msgid "Stereo"
+msgstr "Estéreo"
+
+#: audiofield/widgets.py:31
+msgid "8000 Hz"
+msgstr "8000 Hz"
+
+#: audiofield/widgets.py:32
+msgid "16000 Hz"
+msgstr "16000 Hz"
+
+#: audiofield/widgets.py:33
+msgid "22050 Hz"
+msgstr "22.050 Hz"
+
+#: audiofield/widgets.py:34
+msgid "44100 Hz"
+msgstr "44100 Hz"
+
+#: audiofield/widgets.py:35
+msgid "48000 Hz"
+msgstr "48000 Hz"
+
+#: audiofield/widgets.py:39
+msgid "Keep original audio file"
+msgstr "Manter arquivo de áudio original"
+
+#: audiofield/widgets.py:40
+msgid "Convert to MP3"
+msgstr "Converter para MP3"
+
+#: audiofield/widgets.py:41
+msgid "Convert to WAV"
+msgstr "Converter para WAV"
+
+#: audiofield/widgets.py:42
+msgid "Convert to OGG"
+msgstr "Converter para OGG"
+
+#: audiofield/widgets.py:79
+msgid "Allowed format - mp3 wav and ogg"
+msgstr "Formato permitido - mp3 wav e ogg"
+
+#: audiofield/widgets.py:83 audiofield/widgets.py:141
+msgid "Currently:"
+msgstr "Atualmente:"
+
+#: audiofield/widgets.py:85 audiofield/widgets.py:143
+msgid "Change:"
+msgstr "Mudança:"
+
+#: audiofield/widgets.py:87
+msgid "Upload:"
+msgstr "Upload:"
+
+#: audiofield/widgets.py:89
+#, fuzzy
+#| msgid "Convert To:"
+msgid "Convert to:"
+msgstr "Para converter:"
+
+#: audiofield/widgets.py:90
+msgid "Channel:"
+msgstr "Canal:"
+
+#: audiofield/widgets.py:91
+msgid "Frequency:"
+msgstr "Frequência:"
+
+#: audiofield/widgets.py:95
+msgid "Delete:"
+msgstr "Delete:"
+
+#: audiofield/widgets.py:133
+msgid "Allowed format - mp3, wav and ogg"
+msgstr "Formato permitido - mp3, wav e ogg"
+
+#~ msgid "English"
+#~ msgstr "Inglês"
+
+#~ msgid "Spanish"
+#~ msgstr "Espanhol"
+
+#~ msgid "Portuguese"
+#~ msgstr "Português"
diff --git a/fantasmixDjango/django_project/audiofield/locale/zh/LC_MESSAGES/django.mo b/fantasmixDjango/django_project/audiofield/locale/zh/LC_MESSAGES/django.mo
new file mode 100755
index 0000000000000000000000000000000000000000..a48b3aa99cb1f3f85c90c3dc86904c6844a89df8
Binary files /dev/null and b/fantasmixDjango/django_project/audiofield/locale/zh/LC_MESSAGES/django.mo differ
diff --git a/fantasmixDjango/django_project/audiofield/locale/zh/LC_MESSAGES/django.po b/fantasmixDjango/django_project/audiofield/locale/zh/LC_MESSAGES/django.po
new file mode 100755
index 0000000000000000000000000000000000000000..92cc8bfe571e0e505827647ccb34916c1cc8c298
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/locale/zh/LC_MESSAGES/django.po
@@ -0,0 +1,171 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: Django-Audiofield\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2018-01-21 11:39+0300\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: Belaid Arezqui <areski@gmail.com>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: audiofield/admin.py:37
+#, python-format
+msgid "Successfully deleted %d audio files."
+msgstr "成功的刪除 %d 語音檔案."
+
+#: audiofield/fields.py:87
+msgid "not allowed filetype!"
+msgstr ""
+
+#: audiofield/fields.py:94
+msgid ""
+"not allowed : file format conversion is not allowed for same audio type "
+"(except Wav)"
+msgstr ""
+
+#: audiofield/models.py:35
+#, fuzzy
+#| msgid "Audio Name"
+msgid "audio name"
+msgstr "語音檔案名稱"
+
+#: audiofield/models.py:36
+#, fuzzy
+#| msgid "Audio file label"
+msgid "audio file label"
+msgstr "語音檔案標籤"
+
+#: audiofield/models.py:39 audiofield/models.py:50
+#, fuzzy
+#| msgid "Audio file"
+msgid "audio file"
+msgstr "語音檔案"
+
+#: audiofield/models.py:40
+msgid "user"
+msgstr ""
+
+#: audiofield/models.py:41
+#, fuzzy
+#| msgid "Select User"
+msgid "select user"
+msgstr "選擇使用者"
+
+#: audiofield/models.py:47
+#, fuzzy
+#| msgid "Audio files"
+msgid "can see Audio Files"
+msgstr "語音檔案"
+
+#: audiofield/models.py:51
+#, fuzzy
+#| msgid "Audio files"
+msgid "audio files"
+msgstr "語音檔案"
+
+#: audiofield/models.py:69
+#, fuzzy
+#| msgid "Audio file player"
+msgid "audio file player"
+msgstr "語音檔案撥放"
+
+#: audiofield/widgets.py:24 audiofield/widgets.py:30
+msgid "Keep original"
+msgstr "保留原有"
+
+#: audiofield/widgets.py:25
+msgid "Mono"
+msgstr "單音"
+
+#: audiofield/widgets.py:26
+msgid "Stereo"
+msgstr "立體聲"
+
+#: audiofield/widgets.py:31
+msgid "8000 Hz"
+msgstr "800 Hz"
+
+#: audiofield/widgets.py:32
+msgid "16000 Hz"
+msgstr "1600 Hz"
+
+#: audiofield/widgets.py:33
+msgid "22050 Hz"
+msgstr "22050 Hz"
+
+#: audiofield/widgets.py:34
+msgid "44100 Hz"
+msgstr "44100 Hz"
+
+#: audiofield/widgets.py:35
+msgid "48000 Hz"
+msgstr "48000 Hz"
+
+#: audiofield/widgets.py:39
+msgid "Keep original audio file"
+msgstr "保留原有語音檔案"
+
+#: audiofield/widgets.py:40
+msgid "Convert to MP3"
+msgstr "轉成 MP3"
+
+#: audiofield/widgets.py:41
+msgid "Convert to WAV"
+msgstr "轉成 WAV"
+
+#: audiofield/widgets.py:42
+msgid "Convert to OGG"
+msgstr "轉成 OGG"
+
+#: audiofield/widgets.py:79
+msgid "Allowed format - mp3 wav and ogg"
+msgstr "允許的格式 - mp3 wav and ogg"
+
+#: audiofield/widgets.py:83 audiofield/widgets.py:141
+msgid "Currently:"
+msgstr "現在"
+
+#: audiofield/widgets.py:85 audiofield/widgets.py:143
+msgid "Change:"
+msgstr "變更"
+
+#: audiofield/widgets.py:87
+msgid "Upload:"
+msgstr "上傳"
+
+#: audiofield/widgets.py:89
+#, fuzzy
+#| msgid "Convert To:"
+msgid "Convert to:"
+msgstr "轉成:"
+
+#: audiofield/widgets.py:90
+msgid "Channel:"
+msgstr "頻道"
+
+#: audiofield/widgets.py:91
+msgid "Frequency:"
+msgstr "頻率"
+
+#: audiofield/widgets.py:95
+msgid "Delete:"
+msgstr "刪除"
+
+#: audiofield/widgets.py:133
+msgid "Allowed format - mp3, wav and ogg"
+msgstr "允許的格式 - mp3, wav 以及ogg"
+
+#~ msgid "English"
+#~ msgstr "英文"
+
+#~ msgid "Spanish"
+#~ msgstr "西班牙文"
diff --git a/fantasmixDjango/django_project/audiofield/middleware/__init__.py b/fantasmixDjango/django_project/audiofield/middleware/__init__.py
new file mode 100755
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/fantasmixDjango/django_project/audiofield/middleware/threadlocals.py b/fantasmixDjango/django_project/audiofield/middleware/threadlocals.py
new file mode 100755
index 0000000000000000000000000000000000000000..66e1d424d54c3737eedc2fed0427264b8ca93e22
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/middleware/threadlocals.py
@@ -0,0 +1,43 @@
+#
+# django-audiofield License
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# Copyright (C) 2011-2014 Star2Billing S.L.
+#
+# The Initial Developer of the Original Code is
+# Arezqui Belaid <info@star2billing.com>
+#
+
+import threading
+
+_thread_locals = threading.local()
+
+
+def get_current_request():
+ return getattr(_thread_locals, 'request', None)
+
+
+class ThreadLocals(object):
+ """
+ Middleware that gets various objects from the
+ request object and saves them in thread local storage.
+ """
+
+ def __init__(self, get_response=None):
+ self.get_response = get_response
+
+ def __call__(self, request):
+ response = None
+ if hasattr(self, 'process_request'):
+ response = self.process_request(request)
+ if not response:
+ response = self.get_response(request)
+ if hasattr(self, 'process_response'):
+ response = self.process_response(request, response)
+ return response
+
+ def process_request(self, request):
+ _thread_locals.request = request
diff --git a/fantasmixDjango/django_project/audiofield/migrations/0001_initial.py b/fantasmixDjango/django_project/audiofield/migrations/0001_initial.py
new file mode 100755
index 0000000000000000000000000000000000000000..02bde2918f17002a8a278104feb9ab084441674b
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/migrations/0001_initial.py
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9 on 2015-12-15 14:46
+from __future__ import unicode_literals
+
+import audiofield.fields
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='AudioFile',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('name', models.CharField(help_text='audio file label', max_length=150, verbose_name='audio name')),
+ ('audio_file', audiofield.fields.AudioField(blank=True, upload_to=b'upload/audiofiles', verbose_name='audio file')),
+ ('created_date', models.DateTimeField(auto_now_add=True)),
+ ('updated_date', models.DateTimeField(auto_now=True)),
+ ('user', models.ForeignKey(help_text='select user', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='user')),
+ ],
+ options={
+ 'db_table': 'audio_file',
+ 'verbose_name': 'audio file',
+ 'verbose_name_plural': 'audio files',
+ 'permissions': (('view_audiofile', 'can see Audio Files'),),
+ },
+ ),
+ ]
diff --git a/fantasmixDjango/django_project/audiofield/migrations/0002_auto_20180121_0750.py b/fantasmixDjango/django_project/audiofield/migrations/0002_auto_20180121_0750.py
new file mode 100755
index 0000000000000000000000000000000000000000..40b65d62aacc8c3d1203522a394bb8c61c222811
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/migrations/0002_auto_20180121_0750.py
@@ -0,0 +1,19 @@
+# Generated by Django 2.0.1 on 2018-01-21 07:50
+
+import audiofield.fields
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('audiofield', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='audiofile',
+ name='audio_file',
+ field=audiofield.fields.AudioField(blank=True, upload_to='upload/audiofiles', verbose_name='audio file'),
+ ),
+ ]
diff --git a/fantasmixDjango/django_project/audiofield/migrations/__init__.py b/fantasmixDjango/django_project/audiofield/migrations/__init__.py
new file mode 100755
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/fantasmixDjango/django_project/audiofield/models.py b/fantasmixDjango/django_project/audiofield/models.py
new file mode 100755
index 0000000000000000000000000000000000000000..1b8840425f77a2258cfee44dcce33a17a017fdb0
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/models.py
@@ -0,0 +1,69 @@
+#
+# django-audiofield License
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# Copyright (C) 2011-2014 Star2Billing S.L.
+#
+# The Initial Developer of the Original Code is
+# Arezqui Belaid <info@star2billing.com>
+#
+from __future__ import unicode_literals
+
+import six
+from django.db import models
+from django.utils.translation import ugettext_lazy as _
+from django.conf import settings
+from audiofield.fields import AudioField
+
+try:
+ from django.contrib.auth import get_user_model
+ User = settings.AUTH_USER_MODEL
+except ImportError:
+ from django.contrib.auth.models import User
+
+
+@six.python_2_unicode_compatible
+class AudioFile(models.Model):
+ """
+ This Model describe the Audio used on the platform,
+ this allow to upload audio file and configure
+ alternate Text2Speech System
+ """
+ name = models.CharField(max_length=150, blank=False, verbose_name=_('audio name'),
+ help_text=_('audio file label'))
+ audio_file = AudioField(upload_to='upload/audiofiles', blank=True,
+ ext_whitelist=('.mp3', '.wav', '.ogg'),
+ verbose_name=_('audio file'))
+ user = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name=_('user'),
+ help_text=_('select user'))
+ created_date = models.DateTimeField(auto_now_add=True)
+ updated_date = models.DateTimeField(auto_now=True)
+
+ class Meta:
+ permissions = (
+ ('view_audiofile', _('can see Audio Files')),
+ )
+ db_table = 'audio_file'
+ verbose_name = _('audio file')
+ verbose_name_plural = _('audio files')
+
+ def __str__(self):
+ return '[%s] %s' % (self.id, self.name)
+
+ def save(self, force_insert=False, force_update=False, using=None, update_fields=None):
+ # Call the "real" save() method
+ super(AudioFile, self).save(force_insert, force_update, using, update_fields)
+
+ def audio_file_player(self):
+ """audio player tag for admin"""
+ if self.audio_file:
+ file_url = settings.MEDIA_URL + str(self.audio_file)
+ player_string = '<audio src="%s" controls>Your browser does not support the audio element.</audio>' % \
+ (file_url)
+ return player_string
+
+ audio_file_player.allow_tags = True
+ audio_file_player.short_description = _('audio file player')
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/flashblock/basic.html b/fantasmixDjango/django_project/audiofield/static/audiofield/flashblock/basic.html
new file mode 100755
index 0000000000000000000000000000000000000000..7f6e99bd4789f7371b71584fa9cc4841d066e85f
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/static/audiofield/flashblock/basic.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+<title>SoundManager 2: Flash blocker handling - basic example</title>
+<meta name="description" content="Demo of SoundManager 2 handling flashblock / "click to flash" blockers gracefully" />
+<meta name="keywords" content="javascript sound, javascript audio, DHTML sound, flashblock, flash blocker, handling flashblock, click to flash, click2flash" />
+<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
+
+<!-- actual flashblock demo stuff, this is for you -->
+<link rel="stylesheet" type="text/css" href="flashblock.css" />
+<script type="text/javascript" src="../../script/soundmanager2.js"></script>
+
+<script type="text/javascript">
+// enable flash block handling
+soundManager.useFlashBlock = true;
+
+// custom demo options, not for your needs
+soundManager.debugMode = true;
+soundManager.url = '../../swf/';
+
+</script>
+</head>
+<body>
+
+<div>
+
+ <h1><a href="http://www.schillmania.com/projects/soundmanager2/">SoundManager 2</a>: Flashblock / "click to flash" handling: Basic Demo</h1>
+
+ <div id="sm2-container">
+ <!-- flash movie will be placed here -->
+ </div>
+
+ <p>See <a href="flashblock.css">flashblock.css</a> as a template for making your own SM2 + flash block implementations.</p>
+
+</div>
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/flashblock/flashblock.css b/fantasmixDjango/django_project/audiofield/static/audiofield/flashblock/flashblock.css
new file mode 100755
index 0000000000000000000000000000000000000000..fa11839aa5646030ad9b9e57305342369daacd04
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/static/audiofield/flashblock/flashblock.css
@@ -0,0 +1,130 @@
+/**
+ * SoundManager 2 + useFlashBlock
+ * ------------------------------
+ * Flash positioning and flashblock / clicktoflash handling
+ */
+
+#sm2-container {
+ /**
+ * where the SM2 flash movie goes. by default, relative container.
+ * set relative or absolute here, and don't touch it later or bad things will happen (see below comments.)
+ */
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ overflow: hidden;
+ /* screw IE 6, just make it display nice */
+ _overflow: hidden;
+}
+
+#sm2-container object,
+#sm2-container embed {
+ /**
+ * the actual SWF movie bit.
+ * important: The SWF needs to be able to be moved off-screen without display: or position: changes.
+ * changing display: or position: or overflow: here or on parent can cause SWF reload or other weird issues after unblock
+ * e.g., SM2 starts but strange errors, no whileplaying() etc.
+ */
+ width: 48px;
+ height: 48px;
+ /* some flash blockers may also respect this rule */
+ max-width: 48px;
+ max-height: 48px;
+}
+
+#sm2-container.swf_timedout {
+ /* expand to show the timed-out SWF content */
+ position: relative;
+ width: 48px;
+ height: 48px;
+}
+
+#sm2-container.swf_timedout,
+#sm2-container.swf_timedout object,
+#sm2-container.swf_timedout embed {
+ /**
+ * when SM2 didn't start normally, time-out case. flash blocked, missing SWF, no flash?
+ * 48px square flash placeholder is typically used by blockers.
+ */
+ min-width: 48px;
+ min-height: 48px;
+}
+
+#sm2-container.swf_unblocked {
+ /* SWF unblocked, or was never blocked to begin with; try to collapse container as much as possible. */
+ width: 1px;
+ height: 1px;
+}
+
+#sm2-container.swf_loaded object,
+#sm2-container.swf_loaded embed,
+#sm2-container.swf_unblocked object,
+#sm2-container.swf_unblocked embed {
+ /* hide flash off-screen (relative to container) when it has loaded OK */
+ left: -9999em;
+ top: -9999em;
+}
+
+#sm2-container.swf_error {
+ /* when there is a fatal error (flash loaded, but SM2 failed) */
+ display: none;
+}
+
+#sm2-container.high_performance,
+#sm2-container.high_performance.swf_timeout {
+ /* "high performance" case: keep on-screen at all times */
+ position: absolute;
+ position: fixed;
+}
+
+#sm2-container.high_performance {
+ overflow: hidden;
+ _top: -9999px; /* IE 6 hax, no position:fixed */
+ _left: -9999px;
+ bottom: 0px;
+ left: 0px;
+ /**
+ * special case: show at first with w/h, hide when unblocked.
+ * might be bad/annoying.
+ * try to stay within ClickToFlash "invisible" limits (so it won't be blocked.)
+ */
+ z-index: 99; /* try to stay on top */
+}
+
+#sm2-container.high_performance.swf_loaded,
+#sm2-container.high_performance.swf_unblocked {
+ z-index: auto;
+}
+
+#sm2-container.high_performance.swf_loaded,
+#sm2-container.high_performance.swf_unblocked,
+#sm2-container.high_performance.swf_unblocked object,
+#sm2-container.high_performance.swf_unblocked embed {
+ /**
+ * 8x8px is required minimum to load in fx/win32 in some cases(?)
+ * 6x6+ good for fast performance, even better when on-screen via position:fixed
+ * also, clickToFlash (Safari <5.1) may auto-load "invisible" SWFs at this size
+ */
+ height: 8px;
+ width: 8px;
+}
+
+#sm2-container.high_performance.swf_loaded {
+ /* stay bottom/left */
+ top: auto;
+ bottom: 0px;
+ left: 0px;
+}
+
+#sm2-container.high_performance.swf_loaded object,
+#sm2-container.high_performance.swf_loaded embed,
+#sm2-container.high_performance.swf_unblocked object,
+#sm2-container.high_performance.swf_unblocked embed {
+ /* high-performance case must stay on-screen */
+ left: auto;
+ top: auto;
+}
+
+#sm2-container.high_performance.swf_timedout {
+ z-index: 99; /* try to stay on top */
+}
\ No newline at end of file
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/flashblock/index.html b/fantasmixDjango/django_project/audiofield/static/audiofield/flashblock/index.html
new file mode 100755
index 0000000000000000000000000000000000000000..335386d2b7aa8512d4cfe55bea322e63e299471d
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/static/audiofield/flashblock/index.html
@@ -0,0 +1,128 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+<title>SoundManager 2: Flash Block handling examples</title>
+<meta name="robots" content="noindex" />
+<meta name="description" content="Demo of SoundManager 2 handling flashblock / "click to flash" blockers gracefully" />
+<meta name="keywords" content="javascript sound, javascript audio, DHTML sound, flashblock, flash blocker, handling flashblock, click to flash, click2flash" />
+<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
+<!-- design template, you don't need this -->
+<link rel="stylesheet" type="text/css" href="../index.css" />
+<link rel="stylesheet" type="text/css" href="../debug.css" />
+
+<!-- actual flashblock demo stuff, this is for you -->
+<link rel="stylesheet" type="text/css" href="flashblock.css" />
+<script type="text/javascript" src="../../script/soundmanager2.js"></script>
+
+<script type="text/javascript">
+// enable flash block handling
+soundManager.useFlashBlock = true; // make sure you check and use flashblock.css too, as that is used to position the SWF with this feature on!
+
+soundManager.preferFlash = true; // making sure this demo uses flash, of course...
+
+// custom demo options, not for your needs
+soundManager.debugMode = true;
+soundManager.url = '../../swf/';
+
+// flash version URL switch (for this demo page)
+var winLoc = window.location.toString();
+if (winLoc.match(/flash9/i)) {
+ soundManager.flashVersion = 9;
+ if (winLoc.match(/highperformance/i)) {
+ soundManager.useHighPerformance = true;
+ }
+} else if (winLoc.match(/flash8/i)) {
+ soundManager.flashVersion = 8;
+}
+
+soundManager.ontimeout(function(){
+ var loaded = soundManager.getMoviePercent();
+ document.getElementById('sm2-status').innerHTML = 'No response (yet), flash movie '+(loaded?'loaded OK (likely security/error case)':'has not loaded (likely flash-blocked.)')+' Waiting indefinitely ...';
+});
+
+soundManager.onready(function(){
+ var loaded = soundManager.getMoviePercent();
+ document.getElementById('sm2-status').innerHTML = 'SoundManager load OK';
+});
+
+</script>
+</head>
+<body>
+
+<div style="margin:1em;max-width:60em;font-size:110%">
+
+ <h1><a href="http://www.schillmania.com/projects/soundmanager2/">SoundManager 2</a>: Flashblock / "click to flash" handling demos</h1>
+
+ <h3>Show SWF inline, wait indefinitely for load (click-to-run or whitelist)</h3>
+
+ <p class="note">You can run this demo with <a href="#flash8" onclick="window.location.replace(this.href);window.location.reload()">Flash 8</a> (default), <a href="#flash9" onclick="window.location.replace(this.href);window.location.reload()">Flash 9</a> (normal mode) or <a href="#flash9-highperformance" onclick="window.location.replace(this.href);window.location.reload()">Flash 9 + highPerformance mode</a> (higher JS callback frequency).</p>
+
+ <h4>Where (and when) to show the SWF</h4>
+
+ <p>To handle potential flash block cases, put <code><div id="sm2-container"></div></code> in your markup where you'd like the SWF to appear in those cases. If not specified, SM2 will create and append the <code>#sm2-container</code> node to the document when it starts.</p>
+
+ <p>When <code>soundManager.useFlashBlock</code> is true, SM2 will not apply styles (eg. <code>style.position.left</code>) directly to the flash; rather, it will assign CSS classes and you can handle it as you choose. Take a look at <a href="#flashblock-css">the related CSS</a> file you will also need if you turn this feature on.</p>
+
+ <h4>Handling failed start-up cases</h4>
+
+ <p>In the blocked/failed start-up case, <code>#sm2-container</code> will have a class name of <code>swf_timedout</code> applied to it.</p>
+
+ <p>SM2 will start its init process, and will fire <code>onready()</code>, <code>onload()</code> and <code>onerror()</code> handlers accordingly. Keep in mind that while <code>onerror()</code> may fire at first, it may be preceded by a successful <code>onload()</code> if the user first loads the page and then later unblocks the flash movie.</p>
+
+ <p>Note that flash blockers may not run when viewing offline (via <code>file://</code>) content, so try viewing this demo online. For FlashBlock (under Firefox), you can also go to <code>about:config</code> using your address bar and change the value of <code>flashblock.blockLocal</code> to test while offline.</p>
+
+ <h3>Flash Block Example</h3>
+
+ <p>Here, Flash is appended by SM2 to the <code>#sm2-container</code> DIV and after a failed start attempt (if you have a blocker active), will have a <code>swf_timedout</code> class appended.</p>
+
+ <p>The SWF uses <code>position:absolute</code> and negative left/top values so as not to affect the normal page layout, but shifts to <code>left:auto;top:auto</code> (effectively left/top:0) in the blocked case, and becomes visible to the user. On a successful unblock, the movie goes back to left/top:-9999em and is hidden from view.</p>
+
+ <p>SoundManager 2 load status: <b id="sm2-status">Loading...</b></p>
+
+ <!-- here is where the SWF is shown in the blocked / failed start-up case. -->
+
+ <div id="sm2-container">
+ <!-- flash is appended here -->
+ </div>
+
+ <h3 id="flashblock-css">Flash Block-related CSS</h3>
+
+ <p>When <code>soundManager.useFlashBlock</code> is enabled, CSS is applied to <code>#sm2-container</code> depending on the progress of SM2's start-up.</p>
+ <p>This page + demos use the rules below, fully-defined and commented in <a href="flashblock.css">flashblock.css</a>. Use it as a base for your own SM2 + flash block implementations.</p>
+
+<pre class="block"><code>#sm2-container {
+ <span><span>/* Initial state: position:absolute/off-screen, or left/top:0 */</span></span>
+}
+#sm2-container.swf_timedout {
+ <span><span>/* Didn't load before time-out, show to user.
+ Maybe highlight on-screen, red border, etc..? */</span></span>
+}
+#sm2-container.swf_unblocked {
+ <span><span>/* Applied if movie loads successfully after
+ an unblock (flash started, so move off-screen etc.) */</span></span>
+}
+#sm2-container.swf_loaded {
+ <span><span>/* Applied if movie loads, regardless of whether
+ it was initially blocked */</span></span>
+}
+#sm2-container.swf_error {
+ <span><span>/* "Fatal" error case: SWF loaded,
+ but SM2 was unable to start for some reason.
+ (Flash security or other error case.) */</span></span>
+}
+#sm2-container.high_performance {
+ <span><span>/* Additional modifier for "high performance" mode
+ should apply position:fixed and left/bottom 0 to stay on-screen
+ at all times (better flash performance) */</span></span>
+}
+#sm2-container.flash_debug {
+ <span><span>/* Additional modifier for flash debug output mode
+ should use width/height 100% so you can read debug messages */</span></span>
+}</code></pre>
+
+ <h3>Basic Demo</h3>
+
+ <p>For a more minimal example, see the <a href="basic.html" title="SoundManager 2: Basic Flashblock handling demo">basic flashblock demo</a>.</p>
+
+</div>
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/flashblock/method1/flashblock.css b/fantasmixDjango/django_project/audiofield/static/audiofield/flashblock/method1/flashblock.css
new file mode 100755
index 0000000000000000000000000000000000000000..d8a9e69acc6920672de79bde4e43bb6c1c4bbc90
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/static/audiofield/flashblock/method1/flashblock.css
@@ -0,0 +1,61 @@
+#sm2-container {
+ /* where the SM2 flash movie goes. */
+ position:relative;
+}
+
+#sm2-container,
+#sm2-container embed,
+#sm2-container.swf_timedout {
+ /* 48px square flash placeholder is typically used by blockers */
+ width:48px;
+ height:48px;
+}
+
+#sm2-container.swf_timedout {
+ /* likely a flash block situation. Maybe make it more bold, red, show descriptive nested elements? */
+ border:1px solid red;
+}
+
+#sm2-container object,
+#sm2-container embed {
+ /* hide flash off-screen by default */
+ position:absolute;
+ left:-9999em;
+ top:-9999em;
+}
+
+#sm2-container.swf_timedout object,
+#sm2-container.swf_timedout embed {
+ /* when blocked, make visible inside container */
+ left:auto;
+ top:auto;
+}
+
+#sm2-container object,
+#sm2-container embed {
+ /* 6x6 is small enough to be "invisible" and not blocked by click2flash if allowed, also enough to be really fast/performant on-screen */
+ width:48px;
+ height:48px;
+}
+
+#sm2-container.swf_unblocked,
+#sm2-container.swf_unblocked object,
+#sm2-container.swf_unblocked embed {
+ width:6px;
+ height:6px;
+}
+
+#sm2-container.high_performance {
+ position:absolute;
+ position:fixed;
+ _top:0px; /* IE 6 hax */
+ bottom:0px;
+ left:0px;
+}
+
+#sm2-container.high_performance object,
+#sm2-container.high_performance embed {
+ position:absolute;
+ left:0px;
+ top:0px;
+}
\ No newline at end of file
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/flashblock/method1/flashblock.js b/fantasmixDjango/django_project/audiofield/static/audiofield/flashblock/method1/flashblock.js
new file mode 100755
index 0000000000000000000000000000000000000000..f6baa5c553f95ae2f9330849e5cc99de13693e08
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/static/audiofield/flashblock/method1/flashblock.js
@@ -0,0 +1,90 @@
+/*
+
+ FlashBlock handler for SoundManager 2
+ -------------------------------------------------------------------
+ Attempt to handle and gracefully recover from flashblock conditions
+ Requires SoundManger v2.95a.20090717+
+
+ http://schillmania.com/projects/soundmanager2/
+
+*/
+soundManager._flashBlock = new function() {
+
+ var _s = this;
+ this.name = 'soundManager._flashblock';
+ this.didTimeout = false; // did initial attempt fail?
+ this.timer = null; // for setTimeout call
+
+ this.startTimer = function(nMsec) {
+ // soundManager._wD(_s.name+'_.starttimer()');
+ _s.timer = window.setTimeout(_s.checkFlashStatus,nMsec);
+ };
+
+ this.stopTimer = function() {
+ // soundManager._wD(_s.name+'.stoptimer()');
+ if (_s.timer) {
+ window.clearTimeout(_s.timer);
+ _s.timer = null;
+ }
+ };
+
+ this.checkFlashStatus = function() {
+ // soundManager._wD(_s.name+'.checkflashstatus()');
+ var _sm = soundManager;
+ var oMC = _sm.oMC; // DIV (default: #sm2-container) for .SWF
+ var oStatus = document.getElementById('sm2-status'); // demo-only
+
+ if (!_sm.ok()) {
+ // make the movie more visible, so user can fix
+ oMC.className = 'swf-timedout';
+ _s.didTimeout = true;
+ var msg = 'No flash response, applying .swf-timedout CSS..';
+ _sm._wD(_s.name+': '+msg);
+ if (oStatus) {
+ oStatus.innerHTML = '<span style="color:#996633">'+msg+'</span>';
+ }
+ } else {
+ // SM2 loaded OK
+ // move the movie container to its proper place
+ oMC.className = 'swf-loaded';
+ if (!_s.didTimeout) {
+ // SM2 didn't previously fail, no blocker active
+ var msg = 'SM2 loaded OK (before timeout), fast unblock or no blocker.';
+ _sm._writeDebug(_s.name+'.checkFlashStatus: '+msg,1);
+ if (oStatus) {
+ oStatus.innerHTML = '<span style="color:green">'+msg+'</span>';
+ }
+ } else {
+ var msg = 'SM2 recovered after block (or timeout), loaded OK.';
+ _sm._wD(_s.name+': '+msg);
+ if (oStatus) {
+ oStatus.innerHTML = '<span style="color:#996633">'+msg+'</span>';
+ }
+ }
+ // stop timer, if applicable
+ _s.stopTimer();
+ return false;
+ }
+ };
+
+ soundManager.flashLoadTimeout = 0; // wait forever for flash to load - we'll set our own timeout via oninitmovie()
+
+ soundManager.oninitmovie = function() {
+ // when SWF is written (or ready to start), wait and make SWF visible (time-out case)
+ soundManager._flashBlock.startTimer(750);
+ };
+
+ soundManager.onready(function() {
+ // SM2 has now initialized, either no blocking OR blocked movie was allowed/whitelisted
+ var fb = soundManager._flashBlock;
+ // Yay! recovered OK.
+ fb.checkFlashStatus();
+ });
+
+ soundManager.ontimeout(function() {
+ // Blocking was passed (or no blocking), but then something *else* went wrong.
+ // stop timer, if applicable
+ fb.stopTimer();
+ });
+
+}();
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/flashblock/method1/index.html b/fantasmixDjango/django_project/audiofield/static/audiofield/flashblock/method1/index.html
new file mode 100755
index 0000000000000000000000000000000000000000..605c3f93e84dc4a390cfb6b7e6cde104a4c0a62f
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/static/audiofield/flashblock/method1/index.html
@@ -0,0 +1,76 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+<title>SoundManager 2: Flash blocker handling examples</title>
+<meta name="robots" content="noindex" />
+<meta name="description" content="Demo of SoundManager 2 handling flashblock / "click to flash" blockers gracefully" />
+<meta name="keywords" content="javascript sound, javascript audio, DHTML sound, flashblock, flash blocker, handling flashblock, click to flash" />
+<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
+<!-- design template, you don't need this -->
+<link rel="stylesheet" type="text/css" href="../../index.css" />
+<link rel="stylesheet" type="text/css" href="../../debug.css" />
+
+<!-- actual flashblock demo stuff, this is for you -->
+<link rel="stylesheet" type="text/css" href="flashblock.css" />
+<script type="text/javascript" src="../../../script/soundmanager2.js"></script>
+
+<script type="text/javascript">
+// custom demo options, not for your needs
+soundManager.debugMode = true;
+soundManager.url = '../../../swf/';
+
+// flash version URL switch (for this demo page)
+var winLoc = window.location.toString();
+if (winLoc.match(/flash9/i)) {
+ soundManager.flashVersion = 9;
+ if (winLoc.match(/highperformance/i)) {
+ soundManager.useHighPerformance = true;
+ }
+} else if (winLoc.match(/flash8/i)) {
+ soundManager.flashVersion = 8;
+}
+
+soundManager.onready(function(){
+ var loaded = soundManager.getMoviePercent();
+ document.getElementById('sm2-status').innerHTML = 'SoundManager load OK';
+});
+
+soundManager.ontimeout(function(){
+ var loaded = soundManager.getMoviePercent();
+ document.getElementById('sm2-status').innerHTML = 'No response (yet), flash movie '+(loaded?'loaded OK (likely security/error case)':'has not loaded (likely flash-blocked.)')+' Waiting indefinitely ...';
+});
+
+</script>
+</head>
+<body>
+
+<div style="margin:1em;max-width:60em;font-size:110%">
+
+ <h1><a href="http://www.schillmania.com/projects/soundmanager2/">SoundManager 2</a>: Flashblock / "click to flash" handling demos</h1>
+
+ <h3>Show SWF inline, wait indefinitely for load</h3>
+
+ <p class="note">You can run this demo with <a href="#flash8" onclick="window.location.replace(this.href);window.location.reload()">Flash 8</a> (default), <a href="#flash9" onclick="window.location.replace(this.href);window.location.reload()">Flash 9</a> (normal mode) or <a href="#flash9-highperformance" onclick="window.location.replace(this.href);window.location.reload()">Flash 9 + highPerformance mode</a> (higher JS callback frequency).</p>
+
+ <p>Typically SM2 appends a DIV and hides the SWF off-screen. To handle potential flash block cases, a flash container DIV with an ID of "sm2-container" is placed in the HTML. SM2 will find and append the flash movie to this element. In this case, the SWF can be targeted with CSS and is not positioned off-screen as it normally would be.</p>
+ <p>SM2 will start its init process, and will fire <code>onready()</code>, <code>onload()</code> and <code>onerror()</code> handlers accordingly. Keep in mind that while <code>onerror()</code> may fire at first, it may be preceded by a successful <code>onload()</code> if the user first loads the page and then later unblocks the flash movie.</p>
+ <p>Note that flash blockers may not run when viewing offline (via <code>file://</code>) content, so try viewing this demo online. For FlashBlock (under Firefox), you can also adjust <code>flashblock.blockLocal</code> under <code>about:config</code> in the address bar to test while offline.</p>
+
+ <p>CSS applied to <code>#sm2-container</code>, depending on state:</p>
+<pre class="block"><code>#sm2-container.movieContainer {<span><span>/* Initial state: position:absolute/off-screen, or inline/relative */</span></span>}
+#sm2-container.swf_timedout {<span><span>/* Didn't load before time-out, show to user: On-screen, red border, etc..? */</span></span>}
+#sm2-container.swf_unblocked {<span><span>/* Applied if a timeout followed by an unblock (flash started.) Move off-screen. */</span></span>}
+#sm2-container.high_performance {<span><span>/* Additional modifier for "high performance" mode, should apply position:fixed and left/bottom 0 to stay on-screen at all times (better flash performance) */</span></span>}
+#sm2-container.flash_debug {<span><span>/* Additional modifier for flash debug output mode, should use width/height 100% so you can read debug messages */</span></span>}
+#sm2-container.swf_error {<span><span>/* Additional modifier, "something really broke" (fatal: security, missing SWF etc.) */</span></span>}</code></pre>
+
+ <p>SoundManager 2 load status: <b id="sm2-status">Loading...</b></p>
+
+ <p>Take a look at <a href="flashblock.css">flashblock.css</a> for implementation details.</p>
+
+ <div id="sm2-container">
+ <!-- flash is appended here -->
+ </div>
+
+</div>
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/basic.html b/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/basic.html
new file mode 100755
index 0000000000000000000000000000000000000000..f0fbb82f04f6656bed0ba2f6e8ec0e114eb75534
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/basic.html
@@ -0,0 +1,104 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+<title>SoundManager 2 Demo: Play MP3 links on a page, "page as playlist" style</title>
+<style type="text/css">
+
+/*
+
+ -------------------------------------------------------------
+
+ In-page demo CSS - see external CSS for actual relevant stuff.
+
+ --------------------------------------------------------------
+
+ */
+
+#soundmanager-debug {
+ /* SM2 debug container (optional, makes debug more useable) */
+ position:absolute;position:fixed;*position:absolute;bottom:10px;right:10px;width:50em;height:18em;overflow:auto;background:#fff;margin:1em;padding:1em;border:1px solid #999;font-family:"lucida console",verdana,tahoma,"sans serif";font-size:x-small;line-height:1.5em;opacity:0.9;filter:alpha(opacity=90);z-index:99;
+}
+
+body {
+ font:50% normal verdana,arial,tahoma,"sans serif";
+}
+</style>
+<link rel="stylesheet" type="text/css" href="css/page-player.css" />
+<!-- soundManager.useFlashBlock: related CSS -->
+<link rel="stylesheet" type="text/css" href="../flashblock/flashblock.css" />
+<script type="text/javascript" src="../script/soundmanager2.js"></script>
+
+
+<script>
+
+/* --------
+
+ Config override: This demo uses shiny flash 9 stuff, overwriting Flash 8-based defaults
+ Alternate PP_CONFIG object must be defined before soundManager.onready()/onload() fire.
+ Alternately, edit the config in page-player.js to simply use the values below by default
+
+-------- */
+
+// demo only, but you can use these settings too..
+soundManager.flashVersion = 9;
+soundManager.preferFlash = true; // for visualization effects
+soundManager.useHighPerformance = true; // keep flash on screen, boost performance
+soundManager.wmode = 'transparent'; // transparent SWF, if possible
+soundManager.useFastPolling = true; // increased JS callback frequency
+soundManager.url = '../swf/';
+soundManager.debugFlash = true;
+// Added
+//soundManager.useHTML5Audio = false;
+
+// custom page player configuration
+
+var PP_CONFIG = {
+ autoStart: false, // begin playing first sound when page loads
+ playNext: false, // stop after one sound, or play through list until end
+ useThrottling: false, // try to rate-limit potentially-expensive calls (eg. dragging position around)</span>
+ usePeakData: true, // [Flash 9 only] whether or not to show peak data (left/right channel values) - nor noticable on CPU
+ useWaveformData: false,// [Flash 9 only] show raw waveform data - WARNING: LIKELY VERY CPU-HEAVY
+ useEQData: false, // [Flash 9 only] show EQ (frequency spectrum) data
+ useFavIcon: false, // try to apply peakData to address bar (Firefox + Opera) - performance note: appears to make Firefox 3 do some temporary, heavy disk access/swapping/garbage collection at first(?) - may be too heavy on CPU
+ useMovieStar: true // Flash 9.0r115+ only: Support for a subset of MPEG4 formats.
+}
+
+</script>
+
+<script type="text/javascript" src="script/page-player.js"></script>
+<script type="text/javascript">
+
+// demo only..
+function setTheme(sTheme) {
+ var o = document.getElementsByTagName('ul')[0];
+ o.className = 'playlist'+(sTheme?' '+sTheme:'');
+ return false;
+}
+</script>
+</head>
+
+<body>
+
+<div>
+
+ <div id="sm2-container">
+ <!-- SM2 flash movie goes here -->
+ </div>
+
+ <ul class="playlist">
+
+ <li><a href="../_mp3/rain.mp3">Rain</a></li>
+ <li><a href="../_mp3/webconf.wav">webconf.wav</a></li>
+ <li><a href="../_mp3/walking.mp3">Walking</a></li>
+ <li><a href="../_mp3/duck01.wav">Duck</a></li>
+
+ </ul>
+
+ <ul class="playlist">
+ <li><a href="http://freshly-ground.com/data/video/Rain%20on%20Car%20Roof.aac">Rain on Car Roof <span class="comment">(MPEG4 .AAC audio, 128 kbps AAC-LC exported from QuickTime)</span></a></li>
+ <li><a href="http://freshly-ground.com/data/video/Jellyfish.mov">Jellyfish <span class="comment">(848x480 H.264 video, playing audio portion only)</span></a></li>
+ </ul>
+
+</body>
+</html>
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/css/demo.css b/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/css/demo.css
new file mode 100755
index 0000000000000000000000000000000000000000..8977642525ab6a99ad2fb5f08d94eb06dbf96fd6
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/css/demo.css
@@ -0,0 +1,124 @@
+/*
+ -----------------------------------------------------------------
+ In-page demo CSS for code, documentation etc.
+ See page-player.css for actual playlist-relevant stuff.
+ -----------------------------------------------------------------
+ */
+
+#soundmanager-debug {
+ /* SM2 debug container (optional, makes debug more useable) */
+ position:absolute;position:fixed;*position:absolute;bottom:10px;right:10px;width:50em;height:18em;overflow:auto;background:#fff;margin:1em;padding:1em;border:1px solid #999;font-family:"lucida console",verdana,tahoma,"sans serif";font-size:x-small;line-height:1.5em;opacity:0.9;filter:alpha(opacity=90);z-index:99;
+}
+
+body {
+ font:75% normal verdana,arial,tahoma,"sans serif";
+}
+
+h1, h2, h3 {
+ font:300 3em "Helvetica Neue",georgia,"times new roman","Arial Rounded MT Bold",helvetica,verdana,tahoma,arial,"sans serif";
+ margin-bottom:0px;
+}
+
+h1, h2 {
+ letter-spacing:-1px; /* zomg web x.0! ;) */
+}
+
+h1, h2, h3 {
+ float:left;
+ clear:both;
+ border-bottom:1px solid #999;
+ padding-bottom:1px;
+ margin-bottom:0.25em;
+}
+
+h1 {
+ margin-top:0px;
+ margin-bottom:0px;
+ background-color:#666;
+ color:#ccc;
+ margin-left:-5px;
+ padding-left:5px;
+ padding-right:5px;
+}
+
+h1,
+h1 a {
+ color:#fff;
+ text-decoration:none;
+}
+
+h1 a:hover {
+ text-decoration:underline;
+}
+
+h2 {
+ font-size:2em;
+ margin-top:1em;
+ background-color:#aaa;
+ color:#fff;
+ padding:5px;
+ margin-left:-5px;
+ min-width:23em;
+}
+
+h3 {
+ font-size:1.65em;
+ margin-top:0.5em;
+ margin-bottom:0.25em;
+ color:#333;
+ min-width:28em;
+}
+
+h3 a {
+ font-size:small;
+}
+
+h4 {
+ color:#444;
+}
+
+ul.notes {
+ margin-left:0px;
+ padding-left:1.5em;
+}
+
+.note {
+ margin-top:0px;
+ font-style:italic;
+ color:#999;
+}
+
+pre {
+ font-size:1.2em;
+ _font-size:1em;
+}
+
+code {
+ font-family:"lucida console",monaco,courier,system;
+ font-size:1em;
+ color:#003366;
+}
+
+code span {
+ color:#666;
+}
+
+ul,
+p,
+pre {
+ clear:left;
+ max-width:46em;
+}
+
+ul.tight li {
+ max-width:44.5em;
+}
+
+ul.playlist {
+ /* undo the above nonsense */
+ max-width:none;
+}
+
+ul.tight {
+ padding-left:1.5em;
+}
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/css/optional-annotations.css b/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/css/optional-annotations.css
new file mode 100755
index 0000000000000000000000000000000000000000..f9bacfa37e5a4f9a5b879d22e27c9f52fad3d807
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/css/optional-annotations.css
@@ -0,0 +1,168 @@
+/*
+ ------------------------------------------
+ -- annotations (sub-tracks, notes etc.) --
+ ------------------------------------------
+*/
+
+ul.playlist li a.sm2_link .metadata {
+ display:none; /* hide by default */
+}
+
+ul.playlist li.sm2_paused a.sm2_link .metadata,
+ul.playlist li.sm2_playing a.sm2_link .metadata {
+ display:inline;
+}
+
+ul.playlist li ul {
+ list-style-type:none;
+ margin:0px;
+ padding:0px;
+ position:relative;
+ font-size:small;
+ display:none;
+}
+
+ul.playlist li ul li {
+ position:relative;
+ margin:0px;
+ padding:2px 3px;
+ border:1px solid transparent;
+ -moz-border-radius:6px;
+ -khtml-border-radius:6px;
+ border-radius:6px;
+ margin-right:1em;
+ font-family:helvetica,verdana,tahoma,arial,"sans serif";
+ font-size:x-small;
+ font-weight:300;
+ letter-spacing:0px;
+ background-color:transparent;
+ opacity:0.66;
+}
+
+ul.playlist li ul li:hover {
+ opacity:1;
+ background-color:#fff;
+ border-color:#ccc;
+ color:#666;
+}
+
+ul.playlist li.sm2_playing ul li,
+ul.playlist li.sm2_paused ul li {
+ color:#fff;
+}
+
+ul.playlist li.sm2_playing ul li:hover {
+ background-color:#fff;
+ color:#5588bb;
+ border-color:#336699;
+ opacity:0.9;
+}
+
+ul.playlist li.sm2_paused ul li:hover {
+ background-color:#888;
+}
+
+/* metadata */
+
+ul.playlist li .metadata .duration {
+ /* optional timing data */
+ display:none;
+}
+
+ul.playlist li .metadata ul li p {
+ margin:0px;
+ padding:0px;
+}
+
+ul.playlist li .metadata ul li span {
+ display:none;
+}
+
+ul.playlist li .controls .statusbar .annotation {
+ position:absolute;
+ background-color:transparent;
+ top:0px;
+ color:#666;
+ text-align:right;
+ margin-left:10px;
+ height:0.5em;
+}
+
+ul.playlist li .controls .statusbar .annotation:hover {
+ z-index:12; /* sit on top of note */
+}
+
+ul.playlist li .controls .statusbar .annotation span.bubble {
+ /* using · */
+ display:inline-block;
+ background-color:#fff;
+ border:1px solid #666;
+ border-radius:6px;
+ -moz-border-radius:6px;
+ -webkit-border-radius:6px;
+}
+
+ul.playlist li .controls .statusbar .annotation span {
+ display:block;
+ background:transparent url(../image/divot.png) no-repeat 50% 0px;
+ width:15px;
+ margin-left:-15px;
+ height:12px;
+ text-align:center;
+}
+
+ul.playlist li .controls .statusbar .annotation.alt {
+ top:auto;
+ bottom:0px;
+}
+
+ul.playlist li .controls .statusbar .annotation span:hover {
+ cursor:none; /* Fx3 rules. */
+ margin-top:0.1em;
+}
+
+ul.playlist li .controls .statusbar .annotation.alt span:hover {
+ margin-top:-0.1em;
+}
+
+ul.playlist li .controls .statusbar .annotation.alt span {
+ background:transparent url(../image/divot-bottom.png) no-repeat 50% bottom;
+}
+
+ul.playlist li .note {
+ position:absolute;
+ display:none;
+ left:0px;
+ top:0px;
+ z-index:10;
+ font-size:x-small;
+ padding:2px 4px 2px 4px;
+ width:auto;
+ color:#666;
+ background-color:#fff;
+ border:1px solid #ccc;
+ border-radius:6px;
+ -moz-border-radius:6px;
+ -webkit-border-radius:6px;
+ font-style:normal;
+ font-weight:bold;
+ font-family:arial,tahoma,verdana,"sans serif";
+ letter-spacing:0px;
+ margin-top:1.1em;
+}
+
+ul.playlist li .note.alt {
+ margin-top:-1.32em;
+}
+
+ul.playlist li .note:hover {
+ display:block !important;
+}
+
+ul.playlist li .sm2_divider {
+ font-size:0.75em;
+}
+
+ul.playlist li .sm2_metadata {
+ font-size:0.65em;
+}
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/css/optional-themes.css b/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/css/optional-themes.css
new file mode 100755
index 0000000000000000000000000000000000000000..62a8146919aec557928cc0c58b9e0296a891dbf2
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/css/optional-themes.css
@@ -0,0 +1,206 @@
+/*
+ ---------------------------------
+ -- alternate (optional) themes --
+ ---------------------------------
+*/
+
+ul.playlist.dark li.sm2_playing a {
+ color:#fff;
+}
+
+ul.playlist.dark li.sm2_playing .timing,
+ul.playlist.use-peak.dark li.sm2_playing .peak {
+ color:#999;
+}
+
+ul.playlist.use-spectrum.dark li.sm2_playing .spectrum-container {
+ background-color:#222;
+ border-color:#444;
+}
+
+ul.playlist.use-spectrum.dark li.sm2_playing .spectrum-container .spectrum {
+ background-color:#999;
+}
+
+ul.playlist.dark li.sm2_paused {
+ background-color:#333;
+}
+
+ul.playlist.dark li.sm2_paused a {
+ color:#999;
+}
+
+ul.playlist.dark li.sm2_playing,
+ul.playlist.dark li.sm2_playing:hover {
+ background-color:#333;
+}
+
+ul.playlist.dark li:hover .controls .statusbar {
+ background-color:#666;
+}
+
+ul.playlist.dark li .controls {
+ background-color:#333;
+}
+
+ul.playlist.dark li .controls .statusbar {
+ background-color:#666;
+ border-color:#444;
+}
+
+ul.playlist.dark li .controls .statusbar .position {
+ background-color:#111;
+ border-right:3px solid #111;
+ border-radius:3px;
+ -moz-border-radius:3px;
+ -webkit-border-radius:3px;
+}
+
+ul.playlist.dark li .controls .statusbar .loading {
+ background-color:#444;
+}
+
+ul.playlist.dark li .timing,
+ul.playlist.use-peak.dark li .peak {
+ background-color:#222;
+ border-color:#444;
+}
+
+ul.playlist.dark.use-peak li .peak .l,
+ul.playlist.dark.use-peak li .peak .r {
+ border-color:#444;
+ background-color:#999;
+}
+
+
+/* gold theme */
+
+ul.playlist.gold li.sm2_paused {
+ background-color:#996600;
+}
+
+ul.playlist.gold li.sm2_playing,
+ul.playlist.gold li.sm2_playing:hover {
+ background-color:#cc9900;
+}
+
+ul.playlist.gold li .controls {
+ background-color:transparent;
+}
+
+ul.playlist.gold li .controls .statusbar {
+ background-color:#fff;
+ border-color:#fff;
+}
+
+ul.playlist.gold li .controls .statusbar .position {
+ background-color:#996600;
+ border-right:3px solid #996600;
+ border-radius:3px;
+ -moz-border-radius:3px;
+ -webkit-border-radius:3px;
+}
+
+ul.playlist.gold li .controls .statusbar .loading {
+ background-color:#ffeedd;
+}
+
+ul.playlist.gold li .timing,
+ul.playlist.use-peak.gold li .peak {
+ background-color:#CC9900;
+ border-color:#ffcc33;
+}
+
+ul.playlist.use-spectrum.gold li.sm2_playing .spectrum-container {
+ background-color:#cc9900;
+ border-color:#ffcc33;
+}
+
+ul.playlist.use-spectrum.gold li.sm2_playing .spectrum-container .spectrum {
+ background-color:#fff;
+}
+
+ul.playlist.gold.use-peak li .peak .l,
+ul.playlist.gold.use-peak li .peak .r {
+ border-color:#fff;
+ background-color:#fff;
+}
+
+
+/* ZOMG PONIES!!!ONEONEONE */
+
+ul.playlist.bubblegum li a {
+ font-family:"comic sans ms",verdana,arial,tahoma,"sans serif"; /* heh */
+}
+
+ul.playlist.bubblegum li.sm2_paused,
+ul.playlist.bubblegum li.sm2_paused:hover {
+ background-color:#ffccee;
+}
+
+ul.playlist.bubblegum li.sm2_paused a,
+ul.playlist.bubblegum li.sm2_paused:hover a,
+ul.playlist.bubblegum li.sm2_paused .timing,
+ul.playlist.use-peak.bubblegum li.sm2_paused .peak {
+ color:#ff6699;
+}
+
+ul.playlist.bubblegum li:hover {
+ background-color:#ffddee;
+}
+
+ul.playlist.bubblegum li.sm2_playing,
+ul.playlist.bubblegum li.sm2_playing:hover {
+ background-color:#ff7799;
+}
+
+ul.playlist.bubblegum li .controls {
+ background-color:transparent;
+}
+
+ul.playlist.bubblegum li .controls .statusbar {
+ background-color:#fff;
+ border-color:#fff;
+}
+
+ul.playlist.bubblegum li .controls .statusbar .position {
+ background-color:#ffaacc;
+ border-right:3px solid #ffaacc;
+ border-radius:3px;
+ -moz-border-radius:3px;
+ -webkit-border-radius:3px;
+}
+
+ul.playlist.bubblegum li .controls .statusbar .loading {
+ background-color:#ffeedd;
+}
+
+ul.playlist.bubblegum li .timing,
+ul.playlist.use-peak.bubblegum li .peak {
+ background-color:#ffaacc;
+ border-color:#ffccee;
+}
+
+ul.playlist.use-spectrum.bubblegum li.sm2_playing .spectrum-container {
+ background-color:#ffaacc;
+ border-color:#ffccee;
+}
+
+ul.playlist.use-spectrum.bubblegum li.sm2_playing .spectrum-container .spectrum {
+ background-color:#fff;
+}
+
+ul.playlist.bubblegum.use-peak li .peak .l,
+ul.playlist.bubblegum.use-peak li .peak .r {
+ border-color:#fff;
+ background-color:#fff;
+}
+
+
+ul.playlist.shiny li.sm2_paused,
+ul.playlist.shiny li.sm2_playing {
+ background-image:url(../image/top-highlight.png);
+ background-repeat:repeat-x;
+ background-position:0px -1px;
+ _background-image:none; /* can't be bothered with IE 6. */
+}
\ No newline at end of file
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/css/page-player.css b/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/css/page-player.css
new file mode 100755
index 0000000000000000000000000000000000000000..0d72246301ca4ac3768f9c4165050f99f14dcf4a
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/css/page-player.css
@@ -0,0 +1,320 @@
+/*
+
+ SoundManager 2: "page as playlist" example
+ ------------------------------------------
+ http://schillmania.com/projects/soundmanager2/
+
+*/
+
+.spectrum-container {
+ display:none;
+}
+
+ul.use-spectrum li.sm2_playing .spectrum-container {
+ position:absolute;
+ left:0px;
+ top:0px;
+ margin-left:-266px;
+ margin-top:-1px;
+ display:block;
+ background-color:#5588bb;
+ border:1px solid #99ccff;
+ -moz-border-radius:4px;
+ -webkit-border-radius:4px;
+ border-radius:4px;
+}
+
+ul.use-spectrum .spectrum-box {
+ position:relative;
+ width:255px;
+ font-size:1em;
+ padding:2px 0px;
+ height:1.2em;
+ overflow:hidden;
+}
+
+ul.use-spectrum .spectrum-box .spectrum {
+ position:absolute;
+ left:0px;
+ top:-2px;
+ margin-top:20px;
+ display:block;
+ font-size:1px;
+ width:1px;
+ height:1px; /* set to 50px for a thick line, 1px for a thin line, etc. */
+ overflow:hidden;
+ background-color:#fff;
+}
+
+ul.playlist {
+ list-style-type:none;
+ margin:0px;
+ padding:0px;
+
+}
+
+ul.playlist li {
+ /* assume all items will be sounds rather than wait for onload etc. in this example.. may differ for your uses. */
+ position:relative;
+ display:block;
+ width:auto;
+ font-size:2em;
+ color:#666;
+ padding:0.25em 0.5em 0.25em 0.5em;
+ border:none;
+ letter-spacing:-1px; /* ZOMG WEB X.0. ;) */
+ background-color:#f9f9f9;
+ -webkit-transition-property: hover;
+ -webkit-transition: background-color 0.15s ease-in-out;
+ -moz-transition: background-color 0.15s linear 0s; /* firefox 4 */
+ -o-transition-property: background-color; /* opera 10.5 */
+ -o-transition-duration: 0.15s;
+
+}
+
+ul.playlist li a {
+ display:block;
+ text-decoration:none;
+ font-weight:normal;
+ color:#000;
+ font-size:120%;
+ outline:none;
+ position:relative;
+ z-index:2;
+}
+
+ul.playlist li.sm2_playing,
+ul.playlist li.sm2_paused,
+ul.playlist li.sm2_playing a {
+ color:#fff;
+ border-radius:3px;
+ -webkit-border-radius:3px;
+ -moz-border-radius:3px;
+}
+
+ul.playlist li:hover {
+ background-color:#eee;
+}
+
+ul.playlist li:hover a {
+ color:#333;
+}
+
+ul.playlist li.sm2_playing,
+ul.playlist li.sm2_playing:hover {
+ background-color:#6699cc;
+}
+
+ul.playlist li.sm2_paused {
+ background-color:#999;
+}
+
+ul.playlist li.sm2_playing:hover a,
+ul.playlist li.sm2_paused a {
+ color:#fff;
+}
+
+ul.playlist li .controls {
+ display:none;
+}
+
+ul.playlist li .peak,
+ul.playlist.use-peak li .peak {
+ display:none;
+ position:absolute;
+ top:0.55em;
+ right:0.5em;
+}
+
+ul.playlist li.sm2_playing .controls,
+ul.playlist li.sm2_paused .controls {
+ position:relative;
+ display:block;
+}
+
+ul.playlist.use-peak li.sm2_playing .peak,
+ul.playlist.use-peak li.sm2_paused .peak {
+ display:inline;
+ display:inline-block;
+}
+
+ul.playlist.use-peak li .peak {
+ display:none; /* IE 7 */
+}
+
+ul.playlist li.sm2_paused .controls {
+ background-color:#666;
+}
+
+ul.playlist li:hover .controls .statusbar {
+ position:relative;
+ cursor:ew-resize;
+ cursor:-moz-grab;
+ cursor:grab;
+}
+
+ul.playlist li.sm2_paused .controls .statusbar {
+ background-color:#ccc;
+}
+
+ul.playlist li .controls {
+ position:relative;
+ margin-top:0.25em;
+ margin-bottom:0.25em;
+ background-color:#99ccff;
+}
+
+ul.playlist li .controls .statusbar {
+ position:relative;
+ height:0.5em;
+ background-color:#ccddff;
+ border:2px solid #fff;
+ border-radius:2px;
+ -moz-border-radius:2px;
+ -webkit-border-radius:2px;
+ overflow:hidden;
+ cursor:-moz-grab;
+ cursor:grab;
+}
+
+ul.playlist li .controls.dragging .statusbar {
+ cursor:-moz-grabbing;
+ cursor:grabbing;
+}
+
+ul.playlist li .controls .statusbar .position,
+ul.playlist li .controls .statusbar .loading,
+ul.playlist li .controls .statusbar .annotation {
+ position:absolute;
+ left:0px;
+ top:0px;
+ height:0.5em;
+}
+
+ul.playlist li .controls .statusbar .position {
+ background-color:#336699;
+ border-right:3px solid #336699;
+ border-radius:3px;
+ -moz-border-radius:3px;
+ -webkit-border-radius:3px;
+}
+
+ul.playlist li.sm2_paused .controls .statusbar .position {
+ background-color:#666;
+ border-color:#666;
+}
+
+ul.playlist li .controls .statusbar .loading {
+ background-color:#eee;
+}
+
+ul.playlist li .controls .statusbar .position,
+ul.playlist li .controls .statusbar .loading {
+ width:0px;
+}
+
+ul.playlist li.sm2_playing a.sm2_link,
+ul.playlist li.sm2_paused a.sm2_link {
+ margin-right:4.5em; /* room for timing stuff */
+}
+
+ul.playlist li .timing {
+ position:absolute;
+ display:none;
+ text-align:right;
+ right:1em;
+ top:1em;
+ width:auto;
+ height:1em;
+ padding:3px 5px;
+ background-color:#5588bb;
+ border:1px solid #99ccff;
+ -moz-border-radius:4px;
+ -khtml-border-radius:4px;
+ border-radius:4px;
+ letter-spacing:0px;
+ font:44% monaco,"VT-100","lucida console",courier,system;
+ line-height:1em;
+ vertical-align:middle;
+}
+
+ul.playlist.use-peak li .timing {
+ right:4.25em;
+}
+
+ul.playlist li:hover .timing {
+ z-index:2;
+}
+
+ul.playlist li .timing div.sm2_timing {
+ margin:0px;
+ padding:0px;
+ margin-top:-1em;
+}
+
+ul.playlist li.sm2_playing .timing,
+ul.playlist li.sm2_paused .timing {
+ display:block;
+}
+
+ul.playlist li.sm2_paused .timing .sm2_position {
+ text-decoration:blink; /* hee hee. first actual appropriate use? :D */
+}
+
+ul.playlist li.sm2_paused .timing,
+ul.playlist.use-peak li.sm2_paused .peak {
+ background-color:#888;
+ border-color:#ccc;
+}
+
+/* peak data */
+
+/* ul.playlist ... */
+
+ul.playlist.use-peak li .peak {
+ display:none;
+ zoom:1;
+ border:1px solid #99ccff;
+ padding:2px;
+ height:0.55em;
+ -moz-border-radius:4px;
+ -khtml-border-radius:4px;
+ border-radius:4px;
+ background-color:#5588bb;
+ width:0.8em;
+ height:0.55em;
+ margin-top:-3px;
+}
+
+ul.playlist.use-peak li .peak-box {
+ position:relative;
+ width:100%;
+ height:0.55em;
+ overflow:hidden;
+}
+
+ul.playlist li .peak .l,
+ul.playlist li .peak .r {
+ position:absolute;
+ left:0px;
+ top:0px;
+ width:7px;
+ height:50px;
+ background:#fff;
+ border:1px solid #fff;
+ -moz-border-radius:1px;
+ -khtml-border-radius:1px;
+ margin-top:1em;
+}
+
+ul.playlist li .peak .l {
+ margin-right:1px;
+}
+
+ul.playlist li .peak .r {
+ left:10px;
+}
+
+#control-template {
+ display:none;
+}
\ No newline at end of file
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/image/divot-bottom.png b/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/image/divot-bottom.png
new file mode 100755
index 0000000000000000000000000000000000000000..05b1dff0bdb1e420d85573db768d459e48f1939c
Binary files /dev/null and b/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/image/divot-bottom.png differ
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/image/divot.png b/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/image/divot.png
new file mode 100755
index 0000000000000000000000000000000000000000..81da5fa19f9c4a9dd4dc63182bde52689ed2462b
Binary files /dev/null and b/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/image/divot.png differ
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/image/top-highlight.png b/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/image/top-highlight.png
new file mode 100755
index 0000000000000000000000000000000000000000..876bf340c440a5744866db9f38827cb9612a7b12
Binary files /dev/null and b/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/image/top-highlight.png differ
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/script/optional-page-player-metadata.js b/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/script/optional-page-player-metadata.js
new file mode 100755
index 0000000000000000000000000000000000000000..0faa0e353fcd1a1ffb04922ccac24fd29186b4f2
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/script/optional-page-player-metadata.js
@@ -0,0 +1,142 @@
+// SoundManager 2: Page Player demo, MetaData UI prototype
+
+/*jslint white: false, onevar: true, undef: true, nomen: false, eqeqeq: true, plusplus: false, bitwise: true, newcap: true, immed: true */
+/*global pagePlayer, document, window */
+
+var Metadata = function(oSound) {
+
+ var self = this,
+ pl = pagePlayer,
+ oLI = oSound._data.oLI,
+ o = oLI.getElementsByTagName('ul')[0],
+ oItems = o.getElementsByTagName('li'),
+ oTemplate = document.createElement('div'),
+ oTemplate2 = document.createElement('div'),
+ oTemplate3 = document.createElement('div'),
+ oDuration, i;
+
+ oTemplate.innerHTML = '<span> </span>';
+ oTemplate.className = 'annotation';
+ oTemplate2.innerHTML = '<span> </span>';
+ oTemplate2.className = 'annotation alt';
+ oTemplate3.className = 'note';
+
+ this.totalTime = 0;
+ this.data = [];
+ this.data.givenDuration = null;
+ this.data.currentItem = null;
+ this.data.mainTitle = oSound._data.oLink.innerHTML;
+
+ this.strToTime = function(sTime) {
+ var segments = sTime.split(':'),
+ seconds = 0, i;
+ for (i=segments.length; i--;) {
+ seconds += parseInt(segments[i],10)*Math.pow(60,segments.length-1-i); // hours, minutes
+ }
+ return seconds;
+ };
+
+ // make stuff
+ this.createElements = function() {
+ var oFrag = document.createDocumentFragment(),
+ oNode = null,
+ oNodeSpan = null,
+ oNode2 = null, i;
+ for (i=0; i<self.data.length; i++) {
+ oNode = (i%2===0?oTemplate:oTemplate2).cloneNode(true);
+ oNodeSpan = oNode.getElementsByTagName('span')[0];
+ oNode.rel = i;
+ self.data[i].o = oNode;
+ oNode2 = oTemplate3.cloneNode(true);
+ if (i%2===0) {
+ oNode2.className = 'note alt';
+ }
+ oNode2.innerHTML = this.data[i].title;
+ // evil old-skool event handlers, css:hover-only ideally would be nice excluding IE 6
+ oNode.onmouseover = self.mouseover;
+ oNode.onmouseout = self.mouseout;
+ this.data[i].oNote = oNode2;
+ oSound._data.oControls.appendChild(oNode2);
+ oFrag.appendChild(oNode);
+ }
+ self.refresh();
+ oSound._data.oStatus.appendChild(oFrag);
+ };
+
+ this.refreshMetadata = function(oSound) {
+ // Display info as appropriate
+ var i, j, index = null,
+ now = oSound.position,
+ metadata = oSound._data.metadata.data;
+ for (i=0, j=metadata.length; i<j; i++) {
+ if (now >= metadata[i].startTimeMS && now <= metadata[i].endTimeMS) {
+ index = i;
+ break;
+ }
+ }
+ if (index !== metadata.currentItem) {
+ // update
+ oSound._data.oLink.innerHTML = metadata.mainTitle+' <span class="metadata"><span class="sm2_divider"> | </span><span class="sm2_metadata">'+metadata[index].title+'</span></span>';
+ pl.setPageTitle(metadata[index].title+' | '+metadata.mainTitle);
+ metadata.currentItem = index;
+ }
+ };
+
+ this.refresh = function() {
+ var offset = 0,
+ relWidth = null,
+ duration = (self.data.givenDuration?self.data.givenDuration:oSound.durationEstimate), i;
+ for (i=0; i<self.data.length; i++) {
+ if (duration) {
+ relWidth = (((self.data[i].duration*1000)/duration)*100);
+ self.data[i].o.style.left = (offset?offset+'%':'-2px');
+ self.data[i].oNote.style.left = (offset?offset+'%':'0px');
+ offset += relWidth;
+ }
+ }
+ };
+
+ this.mouseover = function(e) {
+ self.data[this.rel].oNote.style.visibility = 'hidden';
+ self.data[this.rel].oNote.style.display = 'inline-block';
+ self.data[this.rel].oNote.style.marginLeft = -parseInt(self.data[this.rel].oNote.offsetWidth/2,10)+'px';
+ self.data[this.rel].oNote.style.visibility = 'visible';
+ };
+
+ this.mouseout = function() {
+ self.data[this.rel].oNote.style.display = 'none';
+ };
+
+ // ----
+
+ for (i=0; i<oItems.length; i++) {
+ this.data[i] = {
+ o: null,
+ title: oItems[i].getElementsByTagName('p')[0].innerHTML,
+ startTime: oItems[i].getElementsByTagName('span')[0].innerHTML,
+ startSeconds: self.strToTime(oItems[i].getElementsByTagName('span')[0].innerHTML.replace(/[()]/g,'')),
+ duration: 0,
+ durationMS: null,
+ startTimeMS: null,
+ endTimeMS: null,
+ oNote: null
+ };
+ }
+
+ oDuration = pl.getByClassName('duration','div',oLI);
+ this.data.givenDuration = (oDuration.length?self.strToTime(oDuration[0].innerHTML)*1000:0);
+
+ for (i=0; i<this.data.length; i++) {
+ this.data[i].duration = parseInt(this.data[i+1]?this.data[i+1].startSeconds:(self.data.givenDuration?self.data.givenDuration:oSound.durationEstimate)/1000,10)-this.data[i].startSeconds;
+ this.data[i].startTimeMS = this.data[i].startSeconds*1000;
+ this.data[i].durationMS = this.data[i].duration*1000;
+ this.data[i].endTimeMS = this.data[i].startTimeMS+this.data[i].durationMS;
+ this.totalTime += this.data[i].duration;
+ }
+
+ // ----
+
+ this.createElements();
+ this.refresh();
+
+}; // MetaData();
\ No newline at end of file
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/script/page-player.js b/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/script/page-player.js
new file mode 100755
index 0000000000000000000000000000000000000000..e628bc97fa29c487a09e1f4a7a30071bafe7aa84
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/static/audiofield/page-player/script/page-player.js
@@ -0,0 +1,1079 @@
+/**
+ * SoundManager 2 Demo: "Page as playlist" UI
+ * ----------------------------------------------
+ * http://schillmania.com/projects/soundmanager2/
+ *
+ * An example of a Muxtape.com-style UI, where an
+ * unordered list of MP3 links becomes a playlist
+ *
+ * Flash 9 "MovieStar" edition supports MPEG4
+ * audio as well.
+ *
+ * Requires SoundManager 2 Javascript API.
+ */
+
+/*jslint white: false, onevar: true, undef: true, nomen: false, eqeqeq: true, plusplus: false, bitwise: true, newcap: true, immed: true */
+/*global soundManager, window, document, navigator, setTimeout, attachEvent, Metadata, PP_CONFIG */
+
+var pagePlayer = null;
+
+function PagePlayer() {
+
+ var self = this,
+ pl = this,
+ sm = soundManager, // soundManager instance
+ _event,
+ vuDataCanvas = null,
+ controlTemplate = null,
+ _head = document.getElementsByTagName('head')[0],
+ spectrumContainer = null,
+ // sniffing for favicon stuff, IE workarounds and touchy-feely devices
+ ua = navigator.userAgent,
+ supportsFavicon = (ua.match(/(opera|firefox)/i)),
+ isTouchDevice = (ua.match(/ipad|ipod|iphone/i)),
+ cleanup;
+
+ // configuration options
+ // note that if Flash 9 is required, you must set soundManager.flashVersion = 9 in your script before this point.
+
+ this.config = {
+ usePeakData: false, // [Flash 9 only]: show peak data
+ useWaveformData: false, // [Flash 9 only]: enable sound spectrum (raw waveform data) - WARNING: CPU-INTENSIVE: may set CPUs on fire.
+ useEQData: false, // [Flash 9 only]: enable sound EQ (frequency spectrum data) - WARNING: Also CPU-intensive.
+ fillGraph: false, // [Flash 9 only]: draw full lines instead of only top (peak) spectrum points
+ useMovieStar: true, // [Flash 9 only]: Support for MPEG4 audio formats
+ allowRightClick: true, // let users right-click MP3 links ("save as...", etc.) or discourage (can't prevent.)
+ useThrottling: true, // try to rate-limit potentially-expensive calls (eg. dragging position around)
+ autoStart: false, // begin playing first sound when page loads
+ playNext: true, // stop after one sound, or play through list until end
+ updatePageTitle: true, // change the page title while playing sounds
+ emptyTime: '-:--', // null/undefined timer values (before data is available)
+ useFavIcon: false // try to show peakData in address bar (Firefox + Opera) - may be too CPU heavy
+ };
+
+ this.css = { // CSS class names appended to link during various states
+ sDefault: 'sm2_link', // default state
+ sLoading: 'sm2_loading',
+ sPlaying: 'sm2_playing',
+ sPaused: 'sm2_paused'
+ };
+
+ this.sounds = [];
+ this.soundsByObject = [];
+ this.lastSound = null;
+ this.soundCount = 0;
+ this.strings = [];
+ this.dragActive = false;
+ this.dragExec = new Date();
+ this.dragTimer = null;
+ this.pageTitle = document.title;
+ this.lastWPExec = new Date();
+ this.lastWLExec = new Date();
+ this.vuMeterData = [];
+ this.oControls = null;
+
+ this._mergeObjects = function(oMain,oAdd) {
+ // non-destructive merge
+ var o1 = {}, o2, i, o; // clone o1
+ for (i in oMain) {
+ if (oMain.hasOwnProperty(i)) {
+ o1[i] = oMain[i];
+ }
+ }
+ o2 = (typeof oAdd === 'undefined'?{}:oAdd);
+ for (o in o2) {
+ if (typeof o1[o] === 'undefined') {
+ o1[o] = o2[o];
+ }
+ }
+ return o1;
+ };
+
+ _event = (function() {
+
+ var old = (window.attachEvent && !window.addEventListener),
+ _slice = Array.prototype.slice,
+ evt = {
+ add: (old?'attachEvent':'addEventListener'),
+ remove: (old?'detachEvent':'removeEventListener')
+ };
+
+ function getArgs(oArgs) {
+ var args = _slice.call(oArgs), len = args.length;
+ if (old) {
+ args[1] = 'on' + args[1]; // prefix
+ if (len > 3) {
+ args.pop(); // no capture
+ }
+ } else if (len === 3) {
+ args.push(false);
+ }
+ return args;
+ }
+
+ function apply(args, sType) {
+ var element = args.shift(),
+ method = [evt[sType]];
+ if (old) {
+ element[method](args[0], args[1]);
+ } else {
+ element[method].apply(element, args);
+ }
+ }
+
+ function add() {
+ apply(getArgs(arguments), 'add');
+ }
+
+ function remove() {
+ apply(getArgs(arguments), 'remove');
+ }
+
+ return {
+ 'add': add,
+ 'remove': remove
+ };
+
+ }());
+
+ // event + DOM utilities
+
+ this.hasClass = function(o, cStr) {
+ return (typeof(o.className)!=='undefined'?new RegExp('(^|\\s)'+cStr+'(\\s|$)').test(o.className):false);
+ };
+
+ this.addClass = function(o, cStr) {
+ if (!o || !cStr || self.hasClass(o,cStr)) {
+ return false; // safety net
+ }
+ o.className = (o.className?o.className+' ':'')+cStr;
+ };
+
+ this.removeClass = function(o, cStr) {
+ if (!o || !cStr || !self.hasClass(o,cStr)) {
+ return false;
+ }
+ o.className = o.className.replace(new RegExp('( '+cStr+')|('+cStr+')','g'),'');
+ };
+
+ this.select = function(className, oParent) {
+ var result = self.getByClassName(className, 'div', oParent||null);
+ return (result ? result[0] : null);
+ };
+
+ this.getByClassName = (document.querySelectorAll ? function(className, tagNames, oParent) { // tagNames: string or ['div', 'p'] etc.
+
+ var pattern = ('.'+className), qs;
+ if (tagNames) {
+ tagNames = tagNames.split(' ');
+ }
+ qs = (tagNames.length > 1 ? tagNames.join(pattern+', ') : tagNames[0]+pattern);
+ return (oParent?oParent:document).querySelectorAll(qs);
+
+ } : function(className, tagNames, oParent) {
+
+ var node = (oParent?oParent:document), matches = [], i, j, nodes = [];
+ if (tagNames) {
+ tagNames = tagNames.split(' ');
+ }
+ if (tagNames instanceof Array) {
+ for (i=tagNames.length; i--;) {
+ if (!nodes || !nodes[tagNames[i]]) {
+ nodes[tagNames[i]] = node.getElementsByTagName(tagNames[i]);
+ }
+ }
+ for (i=tagNames.length; i--;) {
+ for (j=nodes[tagNames[i]].length; j--;) {
+ if (self.hasClass(nodes[tagNames[i]][j], className)) {
+ matches.push(nodes[tagNames[i]][j]);
+ }
+ }
+ }
+ } else {
+ nodes = node.all||node.getElementsByTagName('*');
+ for (i=0, j=nodes.length; i<j; i++) {
+ if (self.hasClass(nodes[i],className)) {
+ matches.push(nodes[i]);
+ }
+ }
+ }
+ return matches;
+
+ });
+
+ this.isChildOfClass = function(oChild, oClass) {
+ if (!oChild || !oClass) {
+ return false;
+ }
+ while (oChild.parentNode && !self.hasClass(oChild,oClass)) {
+ oChild = oChild.parentNode;
+ }
+ return (self.hasClass(oChild,oClass));
+ };
+
+ this.getParentByNodeName = function(oChild, sParentNodeName) {
+ if (!oChild || !sParentNodeName) {
+ return false;
+ }
+ sParentNodeName = sParentNodeName.toLowerCase();
+ while (oChild.parentNode && sParentNodeName !== oChild.parentNode.nodeName.toLowerCase()) {
+ oChild = oChild.parentNode;
+ }
+ return (oChild.parentNode && sParentNodeName === oChild.parentNode.nodeName.toLowerCase()?oChild.parentNode:null);
+ };
+
+ this.getOffX = function(o) {
+ // http://www.xs4all.nl/~ppk/js/findpos.html
+ var curleft = 0;
+ if (o.offsetParent) {
+ while (o.offsetParent) {
+ curleft += o.offsetLeft;
+ o = o.offsetParent;
+ }
+ }
+ else if (o.x) {
+ curleft += o.x;
+ }
+ return curleft;
+ };
+
+ this.getTime = function(nMSec, bAsString) {
+ // convert milliseconds to mm:ss, return as object literal or string
+ var nSec = Math.floor(nMSec/1000),
+ min = Math.floor(nSec/60),
+ sec = nSec-(min*60);
+ // if (min === 0 && sec === 0) return null; // return 0:00 as null
+ return (bAsString?(min+':'+(sec<10?'0'+sec:sec)):{'min':min,'sec':sec});
+ };
+
+ this.getSoundByObject = function(o) {
+ return (typeof self.soundsByObject[o.id] !== 'undefined'?self.soundsByObject[o.id]:null);
+ };
+
+ this.getPreviousItem = function(o) {
+ // given <li> playlist item, find previous <li> and then <a>
+ if (o.previousElementSibling) {
+ o = o.previousElementSibling;
+ } else {
+ o = o.previousSibling; // move from original node..
+ while (o && o.previousSibling && o.previousSibling.nodeType !== 1) {
+ o = o.previousSibling;
+ }
+ }
+ if (o.nodeName.toLowerCase() !== 'li') {
+ return null;
+ } else {
+ return o.getElementsByTagName('a')[0];
+ }
+ };
+
+ this.playPrevious = function(oSound) {
+ if (!oSound) {
+ oSound = self.lastSound;
+ }
+ if (!oSound) {
+ return false;
+ }
+ var previousItem = self.getPreviousItem(oSound._data.oLI);
+ if (previousItem) {
+ pl.handleClick({target:previousItem}); // fake a click event - aren't we sneaky. ;)
+ }
+ return previousItem;
+ };
+
+ this.getNextItem = function(o) {
+ // given <li> playlist item, find next <li> and then <a>
+ if (o.nextElementSibling) {
+ o = o.nextElementSibling;
+ } else {
+ o = o.nextSibling; // move from original node..
+ while (o && o.nextSibling && o.nextSibling.nodeType !== 1) {
+ o = o.nextSibling;
+ }
+ }
+ if (o.nodeName.toLowerCase() !== 'li') {
+ return null;
+ } else {
+ return o.getElementsByTagName('a')[0];
+ }
+ };
+
+ this.playNext = function(oSound) {
+ if (!oSound) {
+ oSound = self.lastSound;
+ }
+ if (!oSound) {
+ return false;
+ }
+ var nextItem = self.getNextItem(oSound._data.oLI);
+ if (nextItem) {
+ pl.handleClick({target:nextItem}); // fake a click event - aren't we sneaky. ;)
+ }
+ return nextItem;
+ };
+
+ this.setPageTitle = function(sTitle) {
+ if (!self.config.updatePageTitle) {
+ return false;
+ }
+ try {
+ document.title = (sTitle?sTitle+' - ':'')+self.pageTitle;
+ } catch(e) {
+ // oh well
+ self.setPageTitle = function() {
+ return false;
+ };
+ }
+ };
+
+ this.events = {
+
+ // handlers for sound events as they're started/stopped/played
+
+ play: function() {
+ pl.removeClass(this._data.oLI,this._data.className);
+ this._data.className = pl.css.sPlaying;
+ pl.addClass(this._data.oLI,this._data.className);
+ self.setPageTitle(this._data.originalTitle);
+ },
+
+ stop: function() {
+ pl.removeClass(this._data.oLI,this._data.className);
+ this._data.className = '';
+ this._data.oPosition.style.width = '0px';
+ self.setPageTitle();
+ self.resetPageIcon();
+ },
+
+ pause: function() {
+ if (pl.dragActive) {
+ return false;
+ }
+ pl.removeClass(this._data.oLI,this._data.className);
+ this._data.className = pl.css.sPaused;
+ pl.addClass(this._data.oLI,this._data.className);
+ self.setPageTitle();
+ self.resetPageIcon();
+ },
+
+ resume: function() {
+ if (pl.dragActive) {
+ return false;
+ }
+ pl.removeClass(this._data.oLI,this._data.className);
+ this._data.className = pl.css.sPlaying;
+ pl.addClass(this._data.oLI,this._data.className);
+ },
+
+ finish: function() {
+ pl.removeClass(this._data.oLI,this._data.className);
+ this._data.className = '';
+ this._data.oPosition.style.width = '0px';
+ // play next if applicable
+ if (self.config.playNext) {
+ pl.playNext(this);
+ } else {
+ self.setPageTitle();
+ self.resetPageIcon();
+ }
+ },
+
+ whileloading: function() {
+ function doWork() {
+ this._data.oLoading.style.width = (((this.bytesLoaded/this.bytesTotal)*100)+'%'); // theoretically, this should work.
+ if (!this._data.didRefresh && this._data.metadata) {
+ this._data.didRefresh = true;
+ this._data.metadata.refresh();
+ }
+ }
+ if (!pl.config.useThrottling) {
+ doWork.apply(this);
+ } else {
+ var d = new Date();
+ if (d && d-self.lastWLExec>30 || this.bytesLoaded === this.bytesTotal) {
+ doWork.apply(this);
+ self.lastWLExec = d;
+ }
+ }
+
+ },
+
+ onload: function() {
+ if (!this.loaded) {
+ var oTemp = this._data.oLI.getElementsByTagName('a')[0],
+ oString = oTemp.innerHTML,
+ oThis = this;
+ oTemp.innerHTML = oString+' <span style="font-size:0.5em"> | Load failed, d\'oh! '+(sm.sandbox.noRemote?' Possible cause: Flash sandbox is denying remote URL access.':(sm.sandbox.noLocal?'Flash denying local filesystem access':'404?'))+'</span>';
+ setTimeout(function(){
+ oTemp.innerHTML = oString;
+ // pl.events.finish.apply(oThis); // load next
+ },5000);
+ } else {
+ if (this._data.metadata) {
+ this._data.metadata.refresh();
+ }
+ }
+ },
+
+ whileplaying: function() {
+ var d = null;
+ if (pl.dragActive || !pl.config.useThrottling) {
+ self.updateTime.apply(this);
+ if (sm.flashVersion >= 9) {
+ if (pl.config.usePeakData && this.instanceOptions.usePeakData) {
+ self.updatePeaks.apply(this);
+ }
+ if (pl.config.useWaveformData && this.instanceOptions.useWaveformData || pl.config.useEQData && this.instanceOptions.useEQData) {
+ self.updateGraph.apply(this);
+ }
+ }
+ if (this._data.metadata) {
+ d = new Date();
+ if (d && d-self.lastWPExec>500) {
+ this._data.metadata.refreshMetadata(this);
+ self.lastWPExec = d;
+ }
+ }
+ this._data.oPosition.style.width = (((this.position/self.getDurationEstimate(this))*100)+'%');
+ } else {
+ d = new Date();
+ if (d-self.lastWPExec>30) {
+ self.updateTime.apply(this);
+ if (sm.flashVersion >= 9) {
+ if (pl.config.usePeakData && this.instanceOptions.usePeakData) {
+ self.updatePeaks.apply(this);
+ }
+ if (pl.config.useWaveformData && this.instanceOptions.useWaveformData || pl.config.useEQData && this.instanceOptions.useEQData) {
+ self.updateGraph.apply(this);
+ }
+ }
+ if (this._data.metadata) {
+ this._data.metadata.refreshMetadata(this);
+ }
+ this._data.oPosition.style.width = (((this.position/self.getDurationEstimate(this))*100)+'%');
+ self.lastWPExec = d;
+ }
+ }
+ }
+
+ }; // events{}
+
+ this.setPageIcon = function(sDataURL) {
+ if (!self.config.useFavIcon || !self.config.usePeakData || !sDataURL) {
+ return false;
+ }
+ var link = document.getElementById('sm2-favicon');
+ if (link) {
+ _head.removeChild(link);
+ link = null;
+ }
+ if (!link) {
+ link = document.createElement('link');
+ link.id = 'sm2-favicon';
+ link.rel = 'shortcut icon';
+ link.type = 'image/png';
+ link.href = sDataURL;
+ document.getElementsByTagName('head')[0].appendChild(link);
+ }
+ };
+
+ this.resetPageIcon = function() {
+ if (!self.config.useFavIcon) {
+ return false;
+ }
+ var link = document.getElementById('favicon');
+ if (link) {
+ link.href = '/favicon.ico';
+ }
+ };
+
+ this.updatePeaks = function() {
+ var o = this._data.oPeak,
+ oSpan = o.getElementsByTagName('span');
+ oSpan[0].style.marginTop = (13-(Math.floor(15*this.peakData.left))+'px');
+ oSpan[1].style.marginTop = (13-(Math.floor(15*this.peakData.right))+'px');
+ if (sm.flashVersion > 8 && self.config.useFavIcon && self.config.usePeakData) {
+ self.setPageIcon(self.vuMeterData[parseInt(16*this.peakData.left,10)][parseInt(16*this.peakData.right,10)]);
+ }
+ };
+
+ this.updateGraph = function() {
+ if (pl.config.flashVersion < 9 || (!pl.config.useWaveformData && !pl.config.useEQData)) {
+ return false;
+ }
+ var sbC = this._data.oGraph.getElementsByTagName('div'),
+ scale, i, offset;
+ if (pl.config.useWaveformData) {
+ // raw waveform
+ scale = 8; // Y axis (+/- this distance from 0)
+ for (i=255; i--;) {
+ sbC[255-i].style.marginTop = (1+scale+Math.ceil(this.waveformData.left[i]*-scale))+'px';
+ }
+ } else {
+ // eq spectrum
+ offset = 9;
+ for (i=255; i--;) {
+ sbC[255-i].style.marginTop = ((offset*2)-1+Math.ceil(this.eqData[i]*-offset))+'px';
+ }
+ }
+ };
+
+ this.resetGraph = function() {
+ if (!pl.config.useEQData || pl.config.flashVersion<9) {
+ return false;
+ }
+ var sbC = this._data.oGraph.getElementsByTagName('div'),
+ scale = (!pl.config.useEQData?'9px':'17px'),
+ nHeight = (!pl.config.fillGraph?'1px':'32px'),
+ i;
+ for (i=255; i--;) {
+ sbC[255-i].style.marginTop = scale; // EQ scale
+ sbC[255-i].style.height = nHeight;
+ }
+ };
+
+ this.updateTime = function() {
+ var str = self.strings.timing.replace('%s1',self.getTime(this.position,true));
+ str = str.replace('%s2',self.getTime(self.getDurationEstimate(this),true));
+ this._data.oTiming.innerHTML = str;
+ };
+
+ this.getTheDamnTarget = function(e) {
+ return (e.target||(window.event?window.event.srcElement:null));
+ };
+
+ this.withinStatusBar = function(o) {
+ return (self.isChildOfClass(o,'controls'));
+ };
+
+ this.handleClick = function(e) {
+
+ // a sound (or something) was clicked - determine what and handle appropriately
+
+ if (e.button === 2) {
+ if (!pl.config.allowRightClick) {
+ pl.stopEvent(e);
+ }
+ return pl.config.allowRightClick; // ignore right-clicks
+ }
+ var o = self.getTheDamnTarget(e),
+ sURL, soundURL, thisSound, oControls, oLI, str;
+ if (!o) {
+ return true;
+ }
+ if (self.dragActive) {
+ self.stopDrag(); // to be safe
+ }
+ if (self.withinStatusBar(o)) {
+ // self.handleStatusClick(e);
+ return false;
+ }
+ if (o.nodeName.toLowerCase() !== 'a') {
+ o = self.getParentByNodeName(o,'a');
+ }
+ if (!o) {
+ // not a link
+ return true;
+ }
+
+ // OK, we're dealing with a link
+
+ sURL = o.getAttribute('href');
+
+ if (!o.href || (!sm.canPlayLink(o) && !self.hasClass(o,'playable')) || self.hasClass(o,'exclude')) {
+
+ // do nothing, don't return anything.
+ return true;
+
+ } else {
+
+ // we have something we're interested in.
+
+ // find and init parent UL, if need be
+ self.initUL(self.getParentByNodeName(o, 'ul'));
+
+ // and decorate the link too, if needed
+ self.initItem(o);
+
+ soundURL = o.href;
+ thisSound = self.getSoundByObject(o);
+
+ if (thisSound) {
+
+ // sound already exists
+ self.setPageTitle(thisSound._data.originalTitle);
+ if (thisSound === self.lastSound) {
+ // ..and was playing (or paused) and isn't in an error state
+ if (thisSound.readyState !== 2) {
+ if (thisSound.playState !== 1) {
+ // not yet playing
+ thisSound.play();
+ } else {
+ thisSound.togglePause();
+ }
+ } else {
+ sm._writeDebug('Warning: sound failed to load (security restrictions, 404 or bad format)',2);
+ }
+ } else {
+ // ..different sound
+ if (self.lastSound) {
+ self.stopSound(self.lastSound);
+ }
+ if (spectrumContainer) {
+ thisSound._data.oTimingBox.appendChild(spectrumContainer);
+ }
+ thisSound.togglePause(); // start playing current
+ }
+
+ } else {
+
+ // create sound
+ thisSound = sm.createSound({
+ id:o.id,
+ url:decodeURI(soundURL),
+ onplay:self.events.play,
+ onstop:self.events.stop,
+ onpause:self.events.pause,
+ onresume:self.events.resume,
+ onfinish:self.events.finish,
+ whileloading:self.events.whileloading,
+ whileplaying:self.events.whileplaying,
+ onmetadata:self.events.metadata,
+ onload:self.events.onload
+ });
+
+ // append control template
+ oControls = self.oControls.cloneNode(true);
+ oLI = o.parentNode;
+ oLI.appendChild(oControls);
+ if (spectrumContainer) {
+ oLI.appendChild(spectrumContainer);
+ }
+ self.soundsByObject[o.id] = thisSound;
+
+ // tack on some custom data
+ thisSound._data = {
+ oLink: o, // DOM reference within SM2 object event handlers
+ oLI: oLI,
+ oControls: self.select('controls',oLI),
+ oStatus: self.select('statusbar',oLI),
+ oLoading: self.select('loading',oLI),
+ oPosition: self.select('position',oLI),
+ oTimingBox: self.select('timing',oLI),
+ oTiming: self.select('timing',oLI).getElementsByTagName('div')[0],
+ oPeak: self.select('peak',oLI),
+ oGraph: self.select('spectrum-box',oLI),
+ className: self.css.sPlaying,
+ originalTitle: o.innerHTML,
+ metadata: null
+ };
+
+ if (spectrumContainer) {
+ thisSound._data.oTimingBox.appendChild(spectrumContainer);
+ }
+
+ // "Metadata"
+ if (thisSound._data.oLI.getElementsByTagName('ul').length) {
+ thisSound._data.metadata = new Metadata(thisSound);
+ }
+
+ // set initial timer stuff (before loading)
+ str = self.strings.timing.replace('%s1',self.config.emptyTime);
+ str = str.replace('%s2',self.config.emptyTime);
+ thisSound._data.oTiming.innerHTML = str;
+ self.sounds.push(thisSound);
+ if (self.lastSound) {
+ self.stopSound(self.lastSound);
+ }
+ self.resetGraph.apply(thisSound);
+ thisSound.play();
+
+ }
+
+ self.lastSound = thisSound; // reference for next call
+ return self.stopEvent(e);
+
+ }
+
+ };
+
+ this.handleMouseDown = function(e) {
+ // a sound link was clicked
+ if (isTouchDevice && e.touches) {
+ e = e.touches[0];
+ }
+ if (e.button === 2) {
+ if (!pl.config.allowRightClick) {
+ pl.stopEvent(e);
+ }
+ return pl.config.allowRightClick; // ignore right-clicks
+ }
+ var o = self.getTheDamnTarget(e);
+ if (!o) {
+ return true;
+ }
+ if (!self.withinStatusBar(o)) {
+ return true;
+ }
+ self.dragActive = true;
+ self.lastSound.pause();
+ self.setPosition(e);
+ if (!isTouchDevice) {
+ _event.add(document,'mousemove',self.handleMouseMove);
+ } else {
+ _event.add(document,'touchmove',self.handleMouseMove);
+ }
+ self.addClass(self.lastSound._data.oControls,'dragging');
+ return self.stopEvent(e);
+ };
+
+ this.handleMouseMove = function(e) {
+ if (isTouchDevice && e.touches) {
+ e = e.touches[0];
+ }
+ // set position accordingly
+ if (self.dragActive) {
+ if (self.config.useThrottling) {
+ // be nice to CPU/externalInterface
+ var d = new Date();
+ if (d-self.dragExec>20) {
+ self.setPosition(e);
+ } else {
+ window.clearTimeout(self.dragTimer);
+ self.dragTimer = window.setTimeout(function(){self.setPosition(e);},20);
+ }
+ self.dragExec = d;
+ } else {
+ // oh the hell with it
+ self.setPosition(e);
+ }
+ } else {
+ self.stopDrag();
+ }
+ e.stopPropagation = true;
+ return false;
+ };
+
+ this.stopDrag = function(e) {
+ if (self.dragActive) {
+ self.removeClass(self.lastSound._data.oControls,'dragging');
+ if (!isTouchDevice) {
+ _event.remove(document,'mousemove',self.handleMouseMove);
+ } else {
+ _event.remove(document,'touchmove',self.handleMouseMove);
+ }
+ if (!pl.hasClass(self.lastSound._data.oLI,self.css.sPaused)) {
+ self.lastSound.resume();
+ }
+ self.dragActive = false;
+ return self.stopEvent(e);
+ }
+ };
+
+ this.handleStatusClick = function(e) {
+ self.setPosition(e);
+ if (!pl.hasClass(self.lastSound._data.oLI,self.css.sPaused)) {
+ self.resume();
+ }
+ return self.stopEvent(e);
+ };
+
+ this.stopEvent = function(e) {
+ if (typeof e !== 'undefined') {
+ if (typeof e.preventDefault !== 'undefined') {
+ e.preventDefault();
+ } else {
+ e.stopPropagation = true;
+ e.returnValue = false;
+ }
+ }
+ return false;
+ };
+
+ this.setPosition = function(e) {
+ // called from slider control
+ var oThis = self.getTheDamnTarget(e),
+ x, oControl, oSound, nMsecOffset;
+ if (!oThis) {
+ return true;
+ }
+ oControl = oThis;
+ while (!self.hasClass(oControl,'controls') && oControl.parentNode) {
+ oControl = oControl.parentNode;
+ }
+ oSound = self.lastSound;
+ x = parseInt(e.clientX,10);
+ // play sound at this position
+ nMsecOffset = Math.floor((x-self.getOffX(oControl)-4)/(oControl.offsetWidth)*self.getDurationEstimate(oSound));
+ if (!isNaN(nMsecOffset)) {
+ nMsecOffset = Math.min(nMsecOffset,oSound.duration);
+ }
+ if (!isNaN(nMsecOffset)) {
+ oSound.setPosition(nMsecOffset);
+ }
+ };
+
+ this.stopSound = function(oSound) {
+ sm._writeDebug('stopping sound: '+oSound.sID);
+ sm.stop(oSound.sID);
+ if (!isTouchDevice) { // iOS 4.2+ security blocks onfinish() -> playNext() if we set a .src in-between(?)
+ sm.unload(oSound.sID);
+ }
+ };
+
+ this.getDurationEstimate = function(oSound) {
+ if (oSound.instanceOptions.isMovieStar) {
+ return (oSound.duration);
+ } else {
+ return (!oSound._data.metadata || !oSound._data.metadata.data.givenDuration ? (oSound.durationEstimate||0) : oSound._data.metadata.data.givenDuration);
+ }
+ };
+
+ this.createVUData = function() {
+
+ var i=0, j=0,
+ canvas = vuDataCanvas.getContext('2d'),
+ vuGrad = canvas.createLinearGradient(0, 16, 0, 0),
+ bgGrad, outline;
+
+ vuGrad.addColorStop(0,'rgb(0,192,0)');
+ vuGrad.addColorStop(0.30,'rgb(0,255,0)');
+ vuGrad.addColorStop(0.625,'rgb(255,255,0)');
+ vuGrad.addColorStop(0.85,'rgb(255,0,0)');
+ bgGrad = canvas.createLinearGradient(0, 16, 0, 0);
+ outline = 'rgba(0,0,0,0.2)';
+ bgGrad.addColorStop(0,outline);
+ bgGrad.addColorStop(1,'rgba(0,0,0,0.5)');
+ for (i=0; i<16; i++) {
+ self.vuMeterData[i] = [];
+ }
+ for (i=0; i<16; i++) {
+ for (j=0; j<16; j++) {
+ // reset/erase canvas
+ vuDataCanvas.setAttribute('width',16);
+ vuDataCanvas.setAttribute('height',16);
+ // draw new stuffs
+ canvas.fillStyle = bgGrad;
+ canvas.fillRect(0,0,7,15);
+ canvas.fillRect(8,0,7,15);
+ /*
+ // shadow
+ canvas.fillStyle = 'rgba(0,0,0,0.1)';
+ canvas.fillRect(1,15-i,7,17-(17-i));
+ canvas.fillRect(9,15-j,7,17-(17-j));
+ */
+ canvas.fillStyle = vuGrad;
+ canvas.fillRect(0,15-i,7,16-(16-i));
+ canvas.fillRect(8,15-j,7,16-(16-j));
+ // and now, clear out some bits.
+ canvas.clearRect(0,3,16,1);
+ canvas.clearRect(0,7,16,1);
+ canvas.clearRect(0,11,16,1);
+ self.vuMeterData[i][j] = vuDataCanvas.toDataURL('image/png');
+ // for debugging VU images
+ /*
+ var o = document.createElement('img');
+ o.style.marginRight = '5px';
+ o.src = self.vuMeterData[i][j];
+ document.documentElement.appendChild(o);
+ */
+ }
+ }
+
+ };
+
+ this.testCanvas = function() {
+ // canvas + toDataURL();
+ var c = document.createElement('canvas'),
+ ctx = null, ok;
+ if (!c || typeof c.getContext === 'undefined') {
+ return null;
+ }
+ ctx = c.getContext('2d');
+ if (!ctx || typeof c.toDataURL !== 'function') {
+ return null;
+ }
+ // just in case..
+ try {
+ ok = c.toDataURL('image/png');
+ } catch(e) {
+ // no canvas or no toDataURL()
+ return null;
+ }
+ // assume we're all good.
+ return c;
+ };
+
+ this.initItem = function(oNode) {
+ if (!oNode.id) {
+ oNode.id = 'pagePlayerMP3Sound'+(self.soundCount++);
+ }
+ self.addClass(oNode,self.css.sDefault); // add default CSS decoration
+ };
+
+ this.initUL = function(oULNode) {
+ // set up graph box stuffs
+ if (sm.flashVersion >= 9) {
+ self.addClass(oULNode,self.cssBase);
+ }
+ };
+
+ this.init = function(oConfig) {
+
+ if (oConfig) {
+ // allow overriding via arguments object
+ sm._writeDebug('pagePlayer.init(): Using custom configuration');
+ this.config = this._mergeObjects(oConfig,this.config);
+ } else {
+ sm._writeDebug('pagePlayer.init(): Using default configuration');
+ }
+
+ var i, spectrumBox, sbC, oF, oClone, oTiming;
+
+ // apply externally-defined override, if applicable
+ this.cssBase = []; // optional features added to ul.playlist
+
+ // apply some items to SM2
+ sm.useFlashBlock = true;
+
+ if (sm.flashVersion >= 9) {
+
+ sm.useMovieStar = this.config.useMovieStar; // enable playing FLV, MP4 etc.
+ sm.defaultOptions.usePeakData = this.config.usePeakData;
+ sm.defaultOptions.useWaveformData = this.config.useWaveformData;
+ sm.defaultOptions.useEQData = this.config.useEQData;
+
+ if (this.config.usePeakData) {
+ this.cssBase.push('use-peak');
+ }
+
+ if (this.config.useWaveformData || this.config.useEQData) {
+ this.cssBase.push('use-spectrum');
+ }
+
+ this.cssBase = this.cssBase.join(' ');
+
+ if (this.config.useFavIcon) {
+ vuDataCanvas = self.testCanvas();
+ if (vuDataCanvas && supportsFavicon) {
+ // these browsers support dynamically-updating the favicon
+ self.createVUData();
+ } else {
+ // browser doesn't support doing this
+ this.config.useFavIcon = false;
+ }
+ }
+
+ } else if (this.config.usePeakData || this.config.useWaveformData || this.config.useEQData) {
+
+ sm._writeDebug('Page player: Note: soundManager.flashVersion = 9 is required for peak/waveform/EQ features.');
+
+ }
+
+ controlTemplate = document.createElement('div');
+
+ controlTemplate.innerHTML = [
+
+ // control markup inserted dynamically after each page player link
+ // if you want to change the UI layout, this is the place to do it.
+
+ ' <div class="controls">',
+ ' <div class="statusbar">',
+ ' <div class="loading"></div>',
+ ' <div class="position"></div>',
+ ' </div>',
+ ' </div>',
+
+ ' <div class="timing">',
+ ' <div id="sm2_timing" class="timing-data">',
+ ' <span class="sm2_position">%s1</span> / <span class="sm2_total">%s2</span>',
+ ' </div>',
+ ' </div>',
+
+ ' <div class="peak">',
+ ' <div class="peak-box"><span class="l"></span><span class="r"></span></div>',
+ ' </div>',
+
+ ' <div class="spectrum-container">',
+ ' <div class="spectrum-box">',
+ ' <div class="spectrum"></div>',
+ ' </div>',
+ ' </div>'
+
+ ].join('\n');
+
+ if (sm.flashVersion >= 9) {
+
+ // create the spectrum box ish
+ spectrumContainer = self.select('spectrum-container',controlTemplate);
+
+ // take out of template, too
+ spectrumContainer = controlTemplate.removeChild(spectrumContainer);
+
+ spectrumBox = self.select('spectrum-box',spectrumContainer);
+
+ sbC = spectrumBox.getElementsByTagName('div')[0];
+ oF = document.createDocumentFragment();
+ oClone = null;
+ for (i=256; i--;) {
+ oClone = sbC.cloneNode(false);
+ oClone.style.left = (i)+'px';
+ oF.appendChild(oClone);
+ }
+ spectrumBox.removeChild(sbC);
+ spectrumBox.appendChild(oF);
+
+ } else {
+
+ // flash 8-only, take out the spectrum container and peak elements
+ controlTemplate.removeChild(self.select('spectrum-container',controlTemplate));
+ controlTemplate.removeChild(self.select('peak',controlTemplate));
+
+ }
+
+ self.oControls = controlTemplate.cloneNode(true);
+
+ oTiming = self.select('timing-data',controlTemplate);
+ self.strings.timing = oTiming.innerHTML;
+ oTiming.innerHTML = '';
+ oTiming.id = '';
+
+ function doEvents(action) { // action: add / remove
+
+ _event[action](document,'click',self.handleClick);
+
+ if (!isTouchDevice) {
+ _event[action](document,'mousedown',self.handleMouseDown);
+ _event[action](document,'mouseup',self.stopDrag);
+ } else {
+ _event[action](document,'touchstart',self.handleMouseDown);
+ _event[action](document,'touchend',self.stopDrag);
+ }
+
+ _event[action](window, 'unload', cleanup);
+
+ }
+
+ cleanup = function() {
+ doEvents('remove');
+ };
+
+ doEvents('add');
+
+ sm._writeDebug('pagePlayer.init(): Ready',1);
+
+ if (self.config.autoStart) {
+ // grab the first ul.playlist link
+ pl.handleClick({target:pl.getByClassName('playlist', 'ul')[0].getElementsByTagName('a')[0]});
+ }
+
+ };
+
+}
+
+soundManager.useFlashBlock = true;
+
+soundManager.onready(function() {
+ pagePlayer = new PagePlayer();
+ pagePlayer.init(typeof PP_CONFIG !== 'undefined' ? PP_CONFIG : null);
+});
\ No newline at end of file
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/script/soundmanager2-jsmin.js b/fantasmixDjango/django_project/audiofield/static/audiofield/script/soundmanager2-jsmin.js
new file mode 100755
index 0000000000000000000000000000000000000000..e997c2f45b7a582431cddda58de76c6b9c37b04f
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/static/audiofield/script/soundmanager2-jsmin.js
@@ -0,0 +1,102 @@
+/** @license
+
+
+ SoundManager 2: JavaScript Sound for the Web
+ ----------------------------------------------
+ http://schillmania.com/projects/soundmanager2/
+
+ Copyright (c) 2007, Scott Schiller. All rights reserved.
+ Code provided under the BSD License:
+ http://schillmania.com/projects/soundmanager2/license.txt
+
+ V2.97a.20110918
+*/
+(function(R){function S(S,ea){function k(b){return function(a){return!this._t||!this._t._a?(this._t&&this._t.sID?c._wD(h+"ignoring "+a.type+": "+this._t.sID):c._wD(h+"ignoring "+a.type),null):b.call(this,a)}}this.flashVersion=8;this.debugMode=!0;this.debugFlash=!1;this.useConsole=!0;this.waitForWindowLoad=this.consoleOnly=!1;this.bgColor="#ffffff";this.useHighPerformance=!1;this.flashPollingInterval=null;this.flashLoadTimeout=1E3;this.wmode=null;this.allowScriptAccess="always";this.useFlashBlock=
+!1;this.useHTML5Audio=!0;this.html5Test=/^(probably|maybe)$/i;this.preferFlash=!0;this.audioFormats={mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:!0},mp4:{related:["aac","m4a"],type:['audio/mp4; codecs="mp4a.40.2"',"audio/aac","audio/x-m4a","audio/MP4A-LATM","audio/mpeg4-generic"],required:!1},ogg:{type:["audio/ogg; codecs=vorbis"],required:!1},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave","audio/x-wav"],required:!1}};this.defaultOptions=
+{autoLoad:!1,stream:!0,autoPlay:!1,loops:1,onid3:null,onload:null,whileloading:null,onplay:null,onpause:null,onresume:null,whileplaying:null,onstop:null,onfailure:null,onfinish:null,multiShot:!0,multiShotEvents:!1,position:null,pan:0,type:null,usePolicyFile:!1,volume:100};this.flash9Options={isMovieStar:null,usePeakData:!1,useWaveformData:!1,useEQData:!1,onbufferchange:null,ondataerror:null};this.movieStarOptions={bufferTime:3,serverURL:null,onconnect:null,duration:null};this.movieID="sm2-container";
+this.id=ea||"sm2movie";this.swfCSS={swfBox:"sm2-object-box",swfDefault:"movieContainer",swfError:"swf_error",swfTimedout:"swf_timedout",swfLoaded:"swf_loaded",swfUnblocked:"swf_unblocked",sm2Debug:"sm2_debug",highPerf:"high_performance",flashDebug:"flash_debug"};this.debugID="soundmanager-debug";this.debugURLParam=/([#?&])debug=1/i;this.versionNumber="V2.97a.20110918";this.movieURL=this.version=null;this.url=S||null;this.altURL=null;this.enabled=this.swfLoaded=!1;this.oMC=this.o=null;this.sounds=
+{};this.soundIDs=[];this.didFlashBlock=this.specialWmodeCase=this.muted=!1;this.filePattern=null;this.filePatterns={flash8:/\.mp3(\?.*)?$/i,flash9:/\.mp3(\?.*)?$/i};this.features={buffering:!1,peakData:!1,waveformData:!1,eqData:!1,movieStar:!1};this.sandbox={type:null,types:{remote:"remote (domain-based) rules",localWithFile:"local with file access (no internet access)",localWithNetwork:"local with network (internet access only, no local access)",localTrusted:"local, trusted (local+internet access)"},
+description:null,noRemote:null,noLocal:null};this.hasHTML5=typeof Audio!=="undefined"&&typeof(new Audio).canPlayType!=="undefined";this.html5={usingFlash:null};this.flash={};this.ignoreFlash=this.html5Only=!1;var xa,c=this,h="HTML5::",u,r=navigator.userAgent,i=R,J=i.location.href.toString(),g=document,fa,T,j,y=[],ga=!0,q,K=!1,L=!1,m=!1,v=!1,ha=!1,l,Pa=0,M,s,ia,C,D,U,ya,ja,B,V,W,E,ka,X,Y,F,za,la,Qa=["log","info","warn","error"],Aa,Z,Ba,N=null,ma=null,n,na,G,Ca,$,aa,oa,o,ba=!1,pa=!1,Da,Ea,w=null,Fa,
+ca,O,z,qa,ra,Ga,p,Ha=Array.prototype.slice,P=!1,t,da,Ia,x,Ja,sa=r.match(/(ipad|iphone|ipod)/i),Ra=r.match(/(mobile|pre\/|xoom)/i)||sa,A=r.match(/msie/i),Sa=r.match(/webkit/i),Q=r.match(/safari/i)&&!r.match(/chrome/i),Ta=r.match(/opera/i),ta=!J.match(/usehtml5audio/i)&&!J.match(/sm2\-ignorebadua/i)&&Q&&r.match(/OS X 10_6_([3-7])/i),ua=typeof console!=="undefined"&&typeof console.log!=="undefined",va=typeof g.hasFocus!=="undefined"?g.hasFocus():null,H=Q&&typeof g.hasFocus==="undefined",Ka=!H,La=/(mp3|mp4|mpa)/i,
+I=g.location?g.location.protocol.match(/http/i):null,Ma=!I?"http://":"",Na=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|mp4v|3gp|3g2)\s*(?:$|;)/i,Oa=["mpeg4","aac","flv","mov","mp4","m4v","f4v","m4a","mp4v","3gp","3g2"],Ua=RegExp("\\.("+Oa.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i;this.useAltURL=!I;this._global_a=null;if(Ra&&(c.useHTML5Audio=!0,c.preferFlash=!1,sa))P=c.ignoreFlash=!0;this.supported=this.ok=function(){return w?m&&!v:c.useHTML5Audio&&
+c.hasHTML5};this.getMovie=function(c){return u(c)||g[c]||i[c]};this.createSound=function(b){function a(){e=$(e);c.sounds[d.id]=new xa(d);c.soundIDs.push(d.id);return c.sounds[d.id]}var e=null,f=null,d=null;if(!m||!c.ok())return oa("soundManager.createSound(): "+n(!m?"notReady":"notOK")),!1;arguments.length===2&&(b={id:arguments[0],url:arguments[1]});d=e=s(b);d.id.toString().charAt(0).match(/^[0-9]$/)&&c._wD("soundManager.createSound(): "+n("badID",d.id),2);c._wD("soundManager.createSound(): "+d.id+
+" ("+d.url+")",1);if(o(d.id,!0))return c._wD("soundManager.createSound(): "+d.id+" exists",1),c.sounds[d.id];if(ca(d))f=a(),c._wD("Loading sound "+d.id+" via HTML5"),f._setup_html5(d);else{if(j>8){if(d.isMovieStar===null)d.isMovieStar=d.serverURL||(d.type?d.type.match(Na):!1)||d.url.match(Ua);d.isMovieStar&&c._wD("soundManager.createSound(): using MovieStar handling");if(d.isMovieStar){if(d.usePeakData)l("noPeak"),d.usePeakData=!1;d.loops>1&&l("noNSLoop")}}d=aa(d,"soundManager.createSound(): ");f=
+a();if(j===8)c.o._createSound(d.id,d.loops||1,d.usePolicyFile);else if(c.o._createSound(d.id,d.url,d.usePeakData,d.useWaveformData,d.useEQData,d.isMovieStar,d.isMovieStar?d.bufferTime:!1,d.loops||1,d.serverURL,d.duration||null,d.autoPlay,!0,d.autoLoad,d.usePolicyFile),!d.serverURL)f.connected=!0,d.onconnect&&d.onconnect.apply(f);!d.serverURL&&(d.autoLoad||d.autoPlay)&&f.load(d)}!d.serverURL&&d.autoPlay&&f.play();return f};this.destroySound=function(b,a){if(!o(b))return!1;var e=c.sounds[b],f;e._iO=
+{};e.stop();e.unload();for(f=0;f<c.soundIDs.length;f++)if(c.soundIDs[f]===b){c.soundIDs.splice(f,1);break}a||e.destruct(!0);delete c.sounds[b];return!0};this.load=function(b,a){return!o(b)?!1:c.sounds[b].load(a)};this.unload=function(b){return!o(b)?!1:c.sounds[b].unload()};this.onposition=function(b,a,e,f){return!o(b)?!1:c.sounds[b].onposition(a,e,f)};this.start=this.play=function(b,a){return!m||!c.ok()?(oa("soundManager.play(): "+n(!m?"notReady":"notOK")),!1):!o(b)?(a instanceof Object||(a={url:a}),
+a&&a.url?(c._wD('soundManager.play(): attempting to create "'+b+'"',1),a.id=b,c.createSound(a).play()):!1):c.sounds[b].play(a)};this.setPosition=function(b,a){return!o(b)?!1:c.sounds[b].setPosition(a)};this.stop=function(b){if(!o(b))return!1;c._wD("soundManager.stop("+b+")",1);return c.sounds[b].stop()};this.stopAll=function(){var b;c._wD("soundManager.stopAll()",1);for(b in c.sounds)c.sounds.hasOwnProperty(b)&&c.sounds[b].stop()};this.pause=function(b){return!o(b)?!1:c.sounds[b].pause()};this.pauseAll=
+function(){var b;for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].pause()};this.resume=function(b){return!o(b)?!1:c.sounds[b].resume()};this.resumeAll=function(){var b;for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].resume()};this.togglePause=function(b){return!o(b)?!1:c.sounds[b].togglePause()};this.setPan=function(b,a){return!o(b)?!1:c.sounds[b].setPan(a)};this.setVolume=function(b,a){return!o(b)?!1:c.sounds[b].setVolume(a)};this.mute=function(b){var a=0;typeof b!=="string"&&(b=null);if(b){if(!o(b))return!1;
+c._wD('soundManager.mute(): Muting "'+b+'"');return c.sounds[b].mute()}else{c._wD("soundManager.mute(): Muting all sounds");for(a=c.soundIDs.length;a--;)c.sounds[c.soundIDs[a]].mute();c.muted=!0}return!0};this.muteAll=function(){c.mute()};this.unmute=function(b){typeof b!=="string"&&(b=null);if(b){if(!o(b))return!1;c._wD('soundManager.unmute(): Unmuting "'+b+'"');return c.sounds[b].unmute()}else{c._wD("soundManager.unmute(): Unmuting all sounds");for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].unmute();
+c.muted=!1}return!0};this.unmuteAll=function(){c.unmute()};this.toggleMute=function(b){return!o(b)?!1:c.sounds[b].toggleMute()};this.getMemoryUse=function(){var b=0;c.o&&j!==8&&(b=parseInt(c.o._getMemoryUse(),10));return b};this.disable=function(b){var a;typeof b==="undefined"&&(b=!1);if(v)return!1;v=!0;l("shutdown",1);for(a=c.soundIDs.length;a--;)Aa(c.sounds[c.soundIDs[a]]);M(b);p.remove(i,"load",D);return!0};this.canPlayMIME=function(b){var a;c.hasHTML5&&(a=O({type:b}));return!w||a?a:b?!!(j>8&&
+b.match(Na)||b.match(c.mimePattern)):null};this.canPlayURL=function(b){var a;c.hasHTML5&&(a=O({url:b}));return!w||a?a:b?!!b.match(c.filePattern):null};this.canPlayLink=function(b){return typeof b.type!=="undefined"&&b.type&&c.canPlayMIME(b.type)?!0:c.canPlayURL(b.href)};this.getSoundById=function(b,a){if(!b)throw Error("soundManager.getSoundById(): sID is null/undefined");var e=c.sounds[b];!e&&!a&&c._wD('"'+b+'" is an invalid sound ID.',2);return e};this.onready=function(b,a){if(b&&b instanceof Function)return m&&
+c._wD(n("queue","onready")),a||(a=i),ia("onready",b,a),C(),!0;else throw n("needFunction","onready");};this.ontimeout=function(b,a){if(b&&b instanceof Function)return m&&c._wD(n("queue","ontimeout")),a||(a=i),ia("ontimeout",b,a),C({type:"ontimeout"}),!0;else throw n("needFunction","ontimeout");};this._wD=this._writeDebug=function(b,a,e){var f,d;if(!c.debugMode)return!1;typeof e!=="undefined"&&e&&(b=b+" | "+(new Date).getTime());if(ua&&c.useConsole){e=Qa[a];if(typeof console[e]!=="undefined")console[e](b);
+else console.log(b);if(c.useConsoleOnly)return!0}try{f=u("soundmanager-debug");if(!f)return!1;d=g.createElement("div");if(++Pa%2===0)d.className="sm2-alt";a=typeof a==="undefined"?0:parseInt(a,10);d.appendChild(g.createTextNode(b));if(a){if(a>=2)d.style.fontWeight="bold";if(a===3)d.style.color="#ff3333"}f.insertBefore(d,f.firstChild)}catch(Va){}return!0};this._debug=function(){var b,a;l("currentObj",1);b=0;for(a=c.soundIDs.length;b<a;b++)c.sounds[c.soundIDs[b]]._debug()};this.reboot=function(){c._wD("soundManager.reboot()");
+c.soundIDs.length&&c._wD("Destroying "+c.soundIDs.length+" SMSound objects...");var b,a;for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].destruct();try{if(A)ma=c.o.innerHTML;N=c.o.parentNode.removeChild(c.o);c._wD("Flash movie removed.")}catch(e){l("badRemove",2)}ma=N=w=null;c.enabled=ka=m=ba=pa=K=L=v=c.swfLoaded=!1;c.soundIDs=c.sounds=[];c.o=null;for(b in y)if(y.hasOwnProperty(b))for(a=y[b].length;a--;)y[b][a].fired=!1;c._wD("soundManager: Rebooting...");i.setTimeout(c.beginDelayedInit,20)};
+this.getMoviePercent=function(){return c.o&&typeof c.o.PercentLoaded!=="undefined"?c.o.PercentLoaded():null};this.beginDelayedInit=function(){ha=!0;E();setTimeout(function(){if(pa)return!1;Y();W();return pa=!0},20);U()};this.destruct=function(){c._wD("soundManager.destruct()");c.disable(!0)};xa=function(b){var a=this,e,f,d;this.sID=b.id;this.url=b.url;this._iO=this.instanceOptions=this.options=s(b);this.pan=this.options.pan;this.volume=this.options.volume;this._lastURL=null;this.isHTML5=!1;this._a=
+null;this.id3={};this._debug=function(){if(c.debugMode){var b=null,d=[],e,f;for(b in a.options)a.options[b]!==null&&(a.options[b]instanceof Function?(e=a.options[b].toString(),e=e.replace(/\s\s+/g," "),f=e.indexOf("{"),d.push(" "+b+": {"+e.substr(f+1,Math.min(Math.max(e.indexOf("\n")-1,64),64)).replace(/\n/g,"")+"... }")):d.push(" "+b+": "+a.options[b]));c._wD("SMSound() merged options: {\n"+d.join(", \n")+"\n}")}};this._debug();this.load=function(b){var d=null;if(typeof b!=="undefined")a._iO=s(b,
+a.options),a.instanceOptions=a._iO;else if(b=a.options,a._iO=b,a.instanceOptions=a._iO,a._lastURL&&a._lastURL!==a.url)l("manURL"),a._iO.url=a.url,a.url=null;if(!a._iO.url)a._iO.url=a.url;c._wD("SMSound.load(): "+a._iO.url,1);if(a._iO.url===a.url&&a.readyState!==0&&a.readyState!==2)return l("onURL",1),a;a._lastURL=a.url;a.loaded=!1;a.readyState=1;a.playState=0;if(ca(a._iO))d=a._setup_html5(a._iO),d._called_load?c._wD(h+"ignoring request to load again: "+a.sID):(c._wD(h+"load: "+a.sID),a._html5_canplay=
+!1,d.load(),d._called_load=!0,a._iO.autoPlay&&a.play());else try{a.isHTML5=!1,a._iO=aa($(a._iO)),j===8?c.o._load(a.sID,a._iO.url,a._iO.stream,a._iO.autoPlay,a._iO.whileloading?1:0,a._iO.loops||1,a._iO.usePolicyFile):c.o._load(a.sID,a._iO.url,!!a._iO.stream,!!a._iO.autoPlay,a._iO.loops||1,!!a._iO.autoLoad,a._iO.usePolicyFile)}catch(e){l("smError",2),q("onload",!1),F({type:"SMSOUND_LOAD_JS_EXCEPTION",fatal:!0})}return a};this.unload=function(){a.readyState!==0&&(c._wD('SMSound.unload(): "'+a.sID+'"'),
+a.isHTML5?(f(),a._a&&(a._a.pause(),qa(a._a))):j===8?c.o._unload(a.sID,"about:blank"):c.o._unload(a.sID),e());return a};this.destruct=function(b){c._wD('SMSound.destruct(): "'+a.sID+'"');if(a.isHTML5){if(f(),a._a)a._a.pause(),qa(a._a),P||a._remove_html5_events(),a._a._t=null,a._a=null}else a._iO.onfailure=null,c.o._destroySound(a.sID);b||c.destroySound(a.sID,!0)};this.start=this.play=function(b,e){var f,e=e===void 0?!0:e;b||(b={});a._iO=s(b,a._iO);a._iO=s(a._iO,a.options);a.instanceOptions=a._iO;if(a._iO.serverURL&&
+!a.connected)return a.getAutoPlay()||(c._wD("SMSound.play(): Netstream not connected yet - setting autoPlay"),a.setAutoPlay(!0)),a;ca(a._iO)&&(a._setup_html5(a._iO),d());if(a.playState===1&&!a.paused)if(f=a._iO.multiShot)c._wD('SMSound.play(): "'+a.sID+'" already playing (multi-shot)',1);else return c._wD('SMSound.play(): "'+a.sID+'" already playing (one-shot)',1),a;if(a.loaded)c._wD('SMSound.play(): "'+a.sID+'"');else if(a.readyState===0){c._wD('SMSound.play(): Attempting to load "'+a.sID+'"',1);
+if(!a.isHTML5)a._iO.autoPlay=!0;a.load(a._iO)}else if(a.readyState===2)return c._wD('SMSound.play(): Could not load "'+a.sID+'" - exiting',2),a;else c._wD('SMSound.play(): "'+a.sID+'" is loading - attempting to play..',1);if(!a.isHTML5&&j===9&&a.position>0&&a.position===a.duration)c._wD('SMSound.play(): "'+a.sID+'": Sound at end, resetting to position:0'),a._iO.position=0;if(a.paused&&a.position&&a.position>0)c._wD('SMSound.play(): "'+a.sID+'" is resuming from paused state',1),a.resume();else{c._wD('SMSound.play(): "'+
+a.sID+'" is starting to play');a.playState=1;a.paused=!1;(!a.instanceCount||a._iO.multiShotEvents||!a.isHTML5&&j>8&&!a.getAutoPlay())&&a.instanceCount++;a.position=typeof a._iO.position!=="undefined"&&!isNaN(a._iO.position)?a._iO.position:0;if(!a.isHTML5)a._iO=aa($(a._iO));if(a._iO.onplay&&e)a._iO.onplay.apply(a),a._onplay_called=!0;a.setVolume(a._iO.volume,!0);a.setPan(a._iO.pan,!0);a.isHTML5?(d(),f=a._setup_html5(),a.setPosition(a._iO.position),f.play()):c.o._start(a.sID,a._iO.loops||1,j===9?a._iO.position:
+a._iO.position/1E3)}return a};this.stop=function(b){if(a.playState===1){a._onbufferchange(0);a.resetOnPosition(0);a.paused=!1;if(!a.isHTML5)a.playState=0;a._iO.onstop&&a._iO.onstop.apply(a);if(a.isHTML5){if(a._a)a.setPosition(0),a._a.pause(),a.playState=0,a._onTimer(),f()}else c.o._stop(a.sID,b),a._iO.serverURL&&a.unload();a.instanceCount=0;a._iO={}}return a};this.setAutoPlay=function(b){c._wD("sound "+a.sID+" turned autoplay "+(b?"on":"off"));a._iO.autoPlay=b;a.isHTML5||(c.o._setAutoPlay(a.sID,b),
+b&&!a.instanceCount&&a.readyState===1&&(a.instanceCount++,c._wD("sound "+a.sID+" incremented instance count to "+a.instanceCount)))};this.getAutoPlay=function(){return a._iO.autoPlay};this.setPosition=function(b){b===void 0&&(b=0);var d=a.isHTML5?Math.max(b,0):Math.min(a.duration||a._iO.duration,Math.max(b,0));a.position=d;b=a.position/1E3;a.resetOnPosition(a.position);a._iO.position=d;if(a.isHTML5){if(a._a)if(a._html5_canplay){if(a._a.currentTime!==b){c._wD("setPosition("+b+"): setting position");
+try{a._a.currentTime=b,(a.playState===0||a.paused)&&a._a.pause()}catch(e){c._wD("setPosition("+b+"): setting position failed: "+e.message,2)}}}else c._wD("setPosition("+b+"): delaying, sound not ready")}else b=j===9?a.position:b,a.readyState&&a.readyState!==2&&c.o._setPosition(a.sID,b,a.paused||!a.playState);a.isHTML5&&a.paused&&a._onTimer(!0);return a};this.pause=function(b){if(a.paused||a.playState===0&&a.readyState!==1)return a;c._wD("SMSound.pause()");a.paused=!0;a.isHTML5?(a._setup_html5().pause(),
+f()):(b||b===void 0)&&c.o._pause(a.sID);a._iO.onpause&&a._iO.onpause.apply(a);return a};this.resume=function(){if(!a.paused)return a;c._wD("SMSound.resume()");a.paused=!1;a.playState=1;a.isHTML5?(a._setup_html5().play(),d()):(a._iO.isMovieStar&&a.setPosition(a.position),c.o._pause(a.sID));!a._onplay_called&&a._iO.onplay?(a._iO.onplay.apply(a),a._onplay_called=!0):a._iO.onresume&&a._iO.onresume.apply(a);return a};this.togglePause=function(){c._wD("SMSound.togglePause()");if(a.playState===0)return a.play({position:j===
+9&&!a.isHTML5?a.position:a.position/1E3}),a;a.paused?a.resume():a.pause();return a};this.setPan=function(b,d){typeof b==="undefined"&&(b=0);typeof d==="undefined"&&(d=!1);a.isHTML5||c.o._setPan(a.sID,b);a._iO.pan=b;if(!d)a.pan=b,a.options.pan=b;return a};this.setVolume=function(b,d){typeof b==="undefined"&&(b=100);typeof d==="undefined"&&(d=!1);if(a.isHTML5){if(a._a)a._a.volume=Math.max(0,Math.min(1,b/100))}else c.o._setVolume(a.sID,c.muted&&!a.muted||a.muted?0:b);a._iO.volume=b;if(!d)a.volume=b,
+a.options.volume=b;return a};this.mute=function(){a.muted=!0;if(a.isHTML5){if(a._a)a._a.muted=!0}else c.o._setVolume(a.sID,0);return a};this.unmute=function(){a.muted=!1;var b=typeof a._iO.volume!=="undefined";if(a.isHTML5){if(a._a)a._a.muted=!1}else c.o._setVolume(a.sID,b?a._iO.volume:a.options.volume);return a};this.toggleMute=function(){return a.muted?a.unmute():a.mute()};this.onposition=function(c,b,d){a._onPositionItems.push({position:c,method:b,scope:typeof d!=="undefined"?d:a,fired:!1});return a};
+this.processOnPosition=function(){var b,d;b=a._onPositionItems.length;if(!b||!a.playState||a._onPositionFired>=b)return!1;for(;b--;)if(d=a._onPositionItems[b],!d.fired&&a.position>=d.position)d.fired=!0,c._onPositionFired++,d.method.apply(d.scope,[d.position]);return!0};this.resetOnPosition=function(b){var d,e;d=a._onPositionItems.length;if(!d)return!1;for(;d--;)if(e=a._onPositionItems[d],e.fired&&b<=e.position)e.fired=!1,c._onPositionFired--;return!0};d=function(){a.isHTML5&&Da(a)};f=function(){a.isHTML5&&
+Ea(a)};e=function(){a._onPositionItems=[];a._onPositionFired=0;a._hasTimer=null;a._onplay_called=!1;a._a=null;a._html5_canplay=!1;a.bytesLoaded=null;a.bytesTotal=null;a.position=null;a.duration=a._iO&&a._iO.duration?a._iO.duration:null;a.durationEstimate=null;a.failures=0;a.loaded=!1;a.playState=0;a.paused=!1;a.readyState=0;a.muted=!1;a.isBuffering=!1;a.instanceOptions={};a.instanceCount=0;a.peakData={left:0,right:0};a.waveformData={left:[],right:[]};a.eqData=[];a.eqData.left=[];a.eqData.right=[]};
+e();this._onTimer=function(b){var d={};if(a._hasTimer||b)return a._a&&(b||(a.playState>0||a.readyState===1)&&!a.paused)?(a.duration=a._get_html5_duration(),a.durationEstimate=a.duration,b=a._a.currentTime?a._a.currentTime*1E3:0,a._whileplaying(b,d,d,d,d),!0):(c._wD('_onTimer: Warn for "'+a.sID+'": '+(!a._a?"Could not find element. ":"")+(a.playState===0?"playState bad, 0?":"playState = "+a.playState+", OK")),!1)};this._get_html5_duration=function(){var c=a._a?a._a.duration*1E3:a._iO?a._iO.duration:
+void 0;return c&&!isNaN(c)&&c!==Infinity?c:a._iO?a._iO.duration:null};this._setup_html5=function(b){var b=s(a._iO,b),d=P?c._global_a:a._a,f=decodeURI(b.url),g=d&&d._t?d._t.instanceOptions:null;if(d){if(d._t&&g.url===b.url&&(!a._lastURL||a._lastURL===g.url))return d;c._wD("setting new URL on existing object: "+f+(a._lastURL?", old URL: "+a._lastURL:""));P&&d._t&&d._t.playState&&b.url!==g.url&&d._t.stop();e();d.src=b.url;a.url=b.url;a._lastURL=b.url;d._called_load=!1}else if(c._wD("creating HTML5 Audio() element with URL: "+
+f),d=new Audio(b.url),d._called_load=!1,P)c._global_a=d;a.isHTML5=!0;a._a=d;d._t=a;a._add_html5_events();d.loop=b.loops>1?"loop":"";b.autoLoad||b.autoPlay?(d.autobuffer="auto",d.preload="auto",a.load(),d._called_load=!0):(d.autobuffer=!1,d.preload="none");d.loop=b.loops>1?"loop":"";return d};this._add_html5_events=function(){if(a._a._added_events)return!1;var b;c._wD(h+"adding event listeners: "+a.sID);a._a._added_events=!0;for(b in x)x.hasOwnProperty(b)&&a._a&&a._a.addEventListener(b,x[b],!1);return!0};
+this._remove_html5_events=function(){var b;c._wD(h+"removing event listeners: "+a.sID);a._a._added_events=!1;for(b in x)x.hasOwnProperty(b)&&a._a&&a._a.removeEventListener(b,x[b],!1)};this._onload=function(b){b=!!b;c._wD('SMSound._onload(): "'+a.sID+'"'+(b?" loaded.":" failed to load? - "+a.url),b?1:2);!b&&!a.isHTML5&&(c.sandbox.noRemote===!0&&c._wD("SMSound._onload(): "+n("noNet"),1),c.sandbox.noLocal===!0&&c._wD("SMSound._onload(): "+n("noLocal"),1));a.loaded=b;a.readyState=b?3:2;a._onbufferchange(0);
+a._iO.onload&&a._iO.onload.apply(a,[b]);return!0};this._onbufferchange=function(b){if(a.playState===0)return!1;if(b&&a.isBuffering||!b&&!a.isBuffering)return!1;a.isBuffering=b===1;a._iO.onbufferchange&&(c._wD("SMSound._onbufferchange(): "+b),a._iO.onbufferchange.apply(a));return!0};this._onfailure=function(b,d,e){a.failures++;c._wD('SMSound._onfailure(): "'+a.sID+'" count '+a.failures);if(a._iO.onfailure&&a.failures===1)a._iO.onfailure(a,b,d,e);else c._wD("SMSound._onfailure(): ignoring")};this._onfinish=
+function(){var b=a._iO.onfinish;a._onbufferchange(0);a.resetOnPosition(0);if(a.instanceCount){a.instanceCount--;if(!a.instanceCount)a.playState=0,a.paused=!1,a.instanceCount=0,a.instanceOptions={},a._iO={},f();if((!a.instanceCount||a._iO.multiShotEvents)&&b)c._wD('SMSound._onfinish(): "'+a.sID+'"'),b.apply(a)}};this._whileloading=function(c,b,d,e){a.bytesLoaded=c;a.bytesTotal=b;a.duration=Math.floor(d);a.bufferLength=e;if(a._iO.isMovieStar)a.durationEstimate=a.duration;else if(a.durationEstimate=
+a._iO.duration?a.duration>a._iO.duration?a.duration:a._iO.duration:parseInt(a.bytesTotal/a.bytesLoaded*a.duration,10),a.durationEstimate===void 0)a.durationEstimate=a.duration;a.readyState!==3&&a._iO.whileloading&&a._iO.whileloading.apply(a)};this._whileplaying=function(c,b,d,e,f){if(isNaN(c)||c===null)return!1;a.position=c;a.processOnPosition();if(!a.isHTML5&&j>8){if(a._iO.usePeakData&&typeof b!=="undefined"&&b)a.peakData={left:b.leftPeak,right:b.rightPeak};if(a._iO.useWaveformData&&typeof d!=="undefined"&&
+d)a.waveformData={left:d.split(","),right:e.split(",")};if(a._iO.useEQData&&typeof f!=="undefined"&&f&&f.leftEQ&&(c=f.leftEQ.split(","),a.eqData=c,a.eqData.left=c,typeof f.rightEQ!=="undefined"&&f.rightEQ))a.eqData.right=f.rightEQ.split(",")}a.playState===1&&(!a.isHTML5&&j===8&&!a.position&&a.isBuffering&&a._onbufferchange(0),a._iO.whileplaying&&a._iO.whileplaying.apply(a));return!0};this._onid3=function(b,d){c._wD('SMSound._onid3(): "'+this.sID+'" ID3 data received.');var e=[],f,g;f=0;for(g=b.length;f<
+g;f++)e[b[f]]=d[f];a.id3=s(a.id3,e);a._iO.onid3&&a._iO.onid3.apply(a)};this._onconnect=function(b){b=b===1;c._wD('SMSound._onconnect(): "'+a.sID+'"'+(b?" connected.":" failed to connect? - "+a.url),b?1:2);if(a.connected=b)a.failures=0,o(a.sID)&&(a.getAutoPlay()?a.play(void 0,a.getAutoPlay()):a._iO.autoLoad&&a.load()),a._iO.onconnect&&a._iO.onconnect.apply(a,[b])};this._ondataerror=function(b){a.playState>0&&(c._wD("SMSound._ondataerror(): "+b),a._iO.ondataerror&&a._iO.ondataerror.apply(a))}};X=function(){return g.body||
+g._docElement||g.getElementsByTagName("div")[0]};u=function(b){return g.getElementById(b)};s=function(b,a){var e={},f,d;for(f in b)b.hasOwnProperty(f)&&(e[f]=b[f]);f=typeof a==="undefined"?c.defaultOptions:a;for(d in f)f.hasOwnProperty(d)&&typeof e[d]==="undefined"&&(e[d]=f[d]);return e};p=function(){function b(a){var a=Ha.call(a),b=a.length;c?(a[1]="on"+a[1],b>3&&a.pop()):b===3&&a.push(!1);return a}function a(a,b){var g=a.shift(),j=[f[b]];if(c)g[j](a[0],a[1]);else g[j].apply(g,a)}var c=i.attachEvent,
+f={add:c?"attachEvent":"addEventListener",remove:c?"detachEvent":"removeEventListener"};return{add:function(){a(b(arguments),"add")},remove:function(){a(b(arguments),"remove")}}}();x={abort:k(function(){c._wD(h+"abort: "+this._t.sID)}),canplay:k(function(){if(this._t._html5_canplay)return!0;this._t._html5_canplay=!0;c._wD(h+"canplay: "+this._t.sID+", "+this._t.url);this._t._onbufferchange(0);var b=!isNaN(this._t.position)?this._t.position/1E3:null;if(this._t.position&&this.currentTime!==b){c._wD(h+
+"canplay: setting position to "+b);try{this.currentTime=b}catch(a){c._wD(h+"setting position failed: "+a.message,2)}}}),load:k(function(){this._t.loaded||(this._t._onbufferchange(0),this._t._whileloading(this._t.bytesTotal,this._t.bytesTotal,this._t._get_html5_duration()),this._t._onload(!0))}),emptied:k(function(){c._wD(h+"emptied: "+this._t.sID)}),ended:k(function(){c._wD(h+"ended: "+this._t.sID);this._t._onfinish()}),error:k(function(){c._wD(h+"error: "+this.error.code);this._t._onload(!1)}),loadeddata:k(function(){var b=
+this._t,a=b.bytesTotal||1;c._wD(h+"loadeddata: "+this._t.sID);if(!b._loaded&&!Q)b.duration=b._get_html5_duration(),b._whileloading(a,a,b._get_html5_duration()),b._onload(!0)}),loadedmetadata:k(function(){c._wD(h+"loadedmetadata: "+this._t.sID)}),loadstart:k(function(){c._wD(h+"loadstart: "+this._t.sID);this._t._onbufferchange(1)}),play:k(function(){c._wD(h+"play: "+this._t.sID+", "+this._t.url);this._t._onbufferchange(0)}),playing:k(function(){c._wD(h+"playing: "+this._t.sID+", "+this._t.url);this._t._onbufferchange(0)}),
+progress:k(function(b){if(this._t.loaded)return!1;var a,e,f;f=0;var d=b.type==="progress";e=b.target.buffered;var g=b.loaded||0,wa=b.total||1;if(e&&e.length){for(a=e.length;a--;)f=e.end(a)-e.start(a);g=f/b.target.duration;if(d&&e.length>1){f=[];e=e.length;for(a=0;a<e;a++)f.push(b.target.buffered.start(a)+"-"+b.target.buffered.end(a));c._wD(h+"progress: timeRanges: "+f.join(", "))}d&&!isNaN(g)&&c._wD(h+"progress: "+this._t.sID+": "+Math.floor(g*100)+"% loaded")}isNaN(g)||(this._t._onbufferchange(0),
+this._t._whileloading(g,wa,this._t._get_html5_duration()),g&&wa&&g===wa&&x.load.call(this,b))}),ratechange:k(function(){c._wD(h+"ratechange: "+this._t.sID)}),suspend:k(function(b){c._wD(h+"suspend: "+this._t.sID);x.progress.call(this,b)}),stalled:k(function(){c._wD(h+"stalled: "+this._t.sID)}),timeupdate:k(function(){this._t._onTimer()}),waiting:k(function(){c._wD(h+"waiting: "+this._t.sID);this._t._onbufferchange(1)})};ca=function(b){return!b.serverURL&&(b.type?O({type:b.type}):O({url:b.url})||c.html5Only)};
+qa=function(b){if(b)b.src=r.match(/gecko/i)?"":"about:blank"};O=function(b){function a(a){return c.preferFlash&&t&&!c.ignoreFlash&&typeof c.flash[a]!=="undefined"&&c.flash[a]}if(!c.useHTML5Audio||!c.hasHTML5)return!1;var e=b.url||null,b=b.type||null,f=c.audioFormats,d;if(b&&c.html5[b]!=="undefined")return c.html5[b]&&!a(b);if(!z){z=[];for(d in f)f.hasOwnProperty(d)&&(z.push(d),f[d].related&&(z=z.concat(f[d].related)));z=RegExp("\\.("+z.join("|")+")(\\?.*)?$","i")}d=e?e.toLowerCase().match(z):null;
+if(!d||!d.length)if(b)e=b.indexOf(";"),d=(e!==-1?b.substr(0,e):b).substr(6);else return!1;else d=d[1];return d&&typeof c.html5[d]!=="undefined"?c.html5[d]&&!a(d):(b="audio/"+d,e=c.html5.canPlayType({type:b}),(c.html5[d]=e)&&c.html5[b]&&!a(b))};Ga=function(){function b(b){var d,e,f=!1;if(!a||typeof a.canPlayType!=="function")return!1;if(b instanceof Array){d=0;for(e=b.length;d<e&&!f;d++)if(c.html5[b[d]]||a.canPlayType(b[d]).match(c.html5Test))f=!0,c.html5[b[d]]=!0,c.flash[b[d]]=!(!c.preferFlash||!t||
+!b[d].match(La));return f}else return b=a&&typeof a.canPlayType==="function"?a.canPlayType(b):!1,!(!b||!b.match(c.html5Test))}if(!c.useHTML5Audio||typeof Audio==="undefined")return!1;var a=typeof Audio!=="undefined"?Ta?new Audio(null):new Audio:null,e,f={},d,g;d=c.audioFormats;for(e in d)if(d.hasOwnProperty(e)&&(f[e]=b(d[e].type),f["audio/"+e]=f[e],c.flash[e]=c.preferFlash&&!c.ignoreFlash&&e.match(La)?!0:!1,d[e]&&d[e].related))for(g=d[e].related.length;g--;)f["audio/"+d[e].related[g]]=f[e],c.html5[d[e].related[g]]=
+f[e],c.flash[d[e].related[g]]=f[e];f.canPlayType=a?b:null;c.html5=s(c.html5,f);return!0};V={notReady:"Not loaded yet - wait for soundManager.onload()/onready()",notOK:"Audio support is not available.",domError:"soundManager::createMovie(): appendChild/innerHTML call failed. DOM not ready or other error.",spcWmode:"soundManager::createMovie(): Removing wmode, preventing known SWF loading issue(s)",swf404:"soundManager: Verify that %s is a valid path.",tryDebug:"Try soundManager.debugFlash = true for more security details (output goes to SWF.)",
+checkSWF:"See SWF output for more debug info.",localFail:"soundManager: Non-HTTP page ("+g.location.protocol+" URL?) Review Flash player security settings for this special case:\nhttp://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html\nMay need to add/allow path, eg. c:/sm2/ or /users/me/sm2/",waitFocus:"soundManager: Special case: Waiting for focus-related event..",waitImpatient:"soundManager: Getting impatient, still waiting for Flash%s...",waitForever:"soundManager: Waiting indefinitely for Flash (will recover if unblocked)...",
+needFunction:"soundManager: Function object expected for %s",badID:'Warning: Sound ID "%s" should be a string, starting with a non-numeric character',currentObj:"--- soundManager._debug(): Current sound objects ---",waitEI:"soundManager::initMovie(): Waiting for ExternalInterface call from Flash..",waitOnload:"soundManager: Waiting for window.onload()",docLoaded:"soundManager: Document already loaded",onload:"soundManager::initComplete(): calling soundManager.onload()",onloadOK:"soundManager.onload() complete",
+init:"soundManager::init()",didInit:"soundManager::init(): Already called?",flashJS:"soundManager: Attempting to call Flash from JS..",secNote:"Flash security note: Network/internet URLs will not load due to security restrictions. Access can be configured via Flash Player Global Security Settings Page: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html",badRemove:"Warning: Failed to remove flash movie.",noPeak:"Warning: peakData features unsupported for movieStar formats",
+shutdown:"soundManager.disable(): Shutting down",queue:"soundManager: Queueing %s handler",smFail:"soundManager: Failed to initialise.",smError:"SMSound.load(): Exception: JS-Flash communication failed, or JS error.",fbTimeout:"No flash response, applying ."+c.swfCSS.swfTimedout+" CSS..",fbLoaded:"Flash loaded",fbHandler:"soundManager::flashBlockHandler()",manURL:"SMSound.load(): Using manually-assigned URL",onURL:"soundManager.load(): current URL already assigned.",badFV:'soundManager.flashVersion must be 8 or 9. "%s" is invalid. Reverting to %s.',
+as2loop:"Note: Setting stream:false so looping can work (flash 8 limitation)",noNSLoop:"Note: Looping not implemented for MovieStar formats",needfl9:"Note: Switching to flash 9, required for MP4 formats.",mfTimeout:"Setting flashLoadTimeout = 0 (infinite) for off-screen, mobile flash case",mfOn:"mobileFlash::enabling on-screen flash repositioning",policy:"Enabling usePolicyFile for data access"};n=function(){var b=Ha.call(arguments),a=b.shift(),a=V&&V[a]?V[a]:"",c,f;if(a&&b&&b.length){c=0;for(f=b.length;c<
+f;c++)a=a.replace("%s",b[c])}return a};$=function(b){if(j===8&&b.loops>1&&b.stream)l("as2loop"),b.stream=!1;return b};aa=function(b,a){if(b&&!b.usePolicyFile&&(b.onid3||b.usePeakData||b.useWaveformData||b.useEQData))c._wD((a||"")+n("policy")),b.usePolicyFile=!0;return b};oa=function(b){typeof console!=="undefined"&&typeof console.warn!=="undefined"?console.warn(b):c._wD(b)};fa=function(){return!1};Aa=function(b){for(var a in b)b.hasOwnProperty(a)&&typeof b[a]==="function"&&(b[a]=fa)};Z=function(b){typeof b===
+"undefined"&&(b=!1);if(v||b)l("smFail",2),c.disable(b)};Ba=function(b){var a=null;if(b)if(b.match(/\.swf(\?.*)?$/i)){if(a=b.substr(b.toLowerCase().lastIndexOf(".swf?")+4))return b}else b.lastIndexOf("/")!==b.length-1&&(b+="/");return(b&&b.lastIndexOf("/")!==-1?b.substr(0,b.lastIndexOf("/")+1):"./")+c.movieURL};ja=function(){j=parseInt(c.flashVersion,10);if(j!==8&&j!==9)c._wD(n("badFV",j,8)),c.flashVersion=j=8;var b=c.debugMode||c.debugFlash?"_debug.swf":".swf";if(c.useHTML5Audio&&!c.html5Only&&c.audioFormats.mp4.required&&
+j<9)c._wD(n("needfl9")),c.flashVersion=j=9;c.version=c.versionNumber+(c.html5Only?" (HTML5-only mode)":j===9?" (AS3/Flash 9)":" (AS2/Flash 8)");j>8?(c.defaultOptions=s(c.defaultOptions,c.flash9Options),c.features.buffering=!0,c.defaultOptions=s(c.defaultOptions,c.movieStarOptions),c.filePatterns.flash9=RegExp("\\.(mp3|"+Oa.join("|")+")(\\?.*)?$","i"),c.features.movieStar=!0):c.features.movieStar=!1;c.filePattern=c.filePatterns[j!==8?"flash9":"flash8"];c.movieURL=(j===8?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",
+b);c.features.peakData=c.features.waveformData=c.features.eqData=j>8};za=function(b,a){if(!c.o)return!1;c.o._setPolling(b,a)};la=function(){if(c.debugURLParam.test(J))c.debugMode=!0;if(u(c.debugID))return!1;var b,a,e,f;if(c.debugMode&&!u(c.debugID)&&(!ua||!c.useConsole||c.useConsole&&ua&&!c.consoleOnly)){b=g.createElement("div");b.id=c.debugID+"-toggle";a={position:"fixed",bottom:"0px",right:"0px",width:"1.2em",height:"1.2em",lineHeight:"1.2em",margin:"2px",textAlign:"center",border:"1px solid #999",
+cursor:"pointer",background:"#fff",color:"#333",zIndex:10001};b.appendChild(g.createTextNode("-"));b.onclick=Ca;b.title="Toggle SM2 debug console";if(r.match(/msie 6/i))b.style.position="absolute",b.style.cursor="hand";for(f in a)a.hasOwnProperty(f)&&(b.style[f]=a[f]);a=g.createElement("div");a.id=c.debugID;a.style.display=c.debugMode?"block":"none";if(c.debugMode&&!u(b.id)){try{e=X(),e.appendChild(b)}catch(d){throw Error(n("domError")+" \n"+d.toString());}e.appendChild(a)}}};o=this.getSoundById;
+l=function(b,a){return b?c._wD(n(b),a):""};if(J.indexOf("sm2-debug=alert")+1&&c.debugMode)c._wD=function(b){R.alert(b)};Ca=function(){var b=u(c.debugID),a=u(c.debugID+"-toggle");if(!b)return!1;ga?(a.innerHTML="+",b.style.display="none"):(a.innerHTML="-",b.style.display="block");ga=!ga};q=function(b,a,c){if(typeof sm2Debugger!=="undefined")try{sm2Debugger.handleEvent(b,a,c)}catch(f){}return!0};G=function(){var b=[];c.debugMode&&b.push(c.swfCSS.sm2Debug);c.debugFlash&&b.push(c.swfCSS.flashDebug);c.useHighPerformance&&
+b.push(c.swfCSS.highPerf);return b.join(" ")};na=function(){var b=n("fbHandler"),a=c.getMoviePercent(),e=c.swfCSS,f={type:"FLASHBLOCK"};if(c.html5Only)return!1;if(c.ok()){if(c.didFlashBlock&&c._wD(b+": Unblocked"),c.oMC)c.oMC.className=[G(),e.swfDefault,e.swfLoaded+(c.didFlashBlock?" "+e.swfUnblocked:"")].join(" ")}else{if(w)c.oMC.className=G()+" "+e.swfDefault+" "+(a===null?e.swfTimedout:e.swfError),c._wD(b+": "+n("fbTimeout")+(a?" ("+n("fbLoaded")+")":""));c.didFlashBlock=!0;C({type:"ontimeout",
+ignoreInit:!0,error:f});F(f)}};ia=function(b,a,c){typeof y[b]==="undefined"&&(y[b]=[]);y[b].push({method:a,scope:c||null,fired:!1})};C=function(b){b||(b={type:"onready"});if(!m&&b&&!b.ignoreInit)return!1;if(b.type==="ontimeout"&&c.ok())return!1;var a={success:b&&b.ignoreInit?c.ok():!v},e=b&&b.type?y[b.type]||[]:[],f=[],d,g=[a],j=w&&c.useFlashBlock&&!c.ok();if(b.error)g[0].error=b.error;a=0;for(d=e.length;a<d;a++)e[a].fired!==!0&&f.push(e[a]);if(f.length){c._wD("soundManager: Firing "+f.length+" "+
+b.type+"() item"+(f.length===1?"":"s"));a=0;for(d=f.length;a<d;a++)if(f[a].scope?f[a].method.apply(f[a].scope,g):f[a].method.apply(this,g),!j)f[a].fired=!0}return!0};D=function(){i.setTimeout(function(){c.useFlashBlock&&na();C();c.onload instanceof Function&&(l("onload",1),c.onload.apply(i),l("onloadOK",1));c.waitForWindowLoad&&p.add(i,"load",D)},1)};da=function(){if(t!==void 0)return t;var b=!1,a=navigator,c=a.plugins,f,d=i.ActiveXObject;if(c&&c.length)(a=a.mimeTypes)&&a["application/x-shockwave-flash"]&&
+a["application/x-shockwave-flash"].enabledPlugin&&a["application/x-shockwave-flash"].enabledPlugin.description&&(b=!0);else if(typeof d!=="undefined"){try{f=new d("ShockwaveFlash.ShockwaveFlash")}catch(g){}b=!!f}return t=b};Fa=function(){var b,a;if(sa&&r.match(/os (1|2|3_0|3_1)/i)){c.hasHTML5=!1;c.html5Only=!0;if(c.oMC)c.oMC.style.display="none";return!1}if(c.useHTML5Audio){if(!c.html5||!c.html5.canPlayType)return c._wD("SoundManager: No HTML5 Audio() support detected."),c.hasHTML5=!1,!0;else c.hasHTML5=
+!0;if(ta&&(c._wD("soundManager::Note: Buggy HTML5 Audio in Safari on this OS X release, see https://bugs.webkit.org/show_bug.cgi?id=32159 - "+(!t?" would use flash fallback for MP3/MP4, but none detected.":"will use flash fallback for MP3/MP4, if available"),1),da()))return!0}else return!0;for(a in c.audioFormats)if(c.audioFormats.hasOwnProperty(a)&&(c.audioFormats[a].required&&!c.html5.canPlayType(c.audioFormats[a].type)||c.flash[a]||c.flash[c.audioFormats[a].type]))b=!0;c.ignoreFlash&&(b=!1);c.html5Only=
+c.hasHTML5&&c.useHTML5Audio&&!b;return!c.html5Only};Da=function(b){if(!b._hasTimer)b._hasTimer=!0};Ea=function(b){if(b._hasTimer)b._hasTimer=!1};F=function(b){b=typeof b!=="undefined"?b:{};c.onerror instanceof Function&&c.onerror.apply(i,[{type:typeof b.type!=="undefined"?b.type:null}]);typeof b.fatal!=="undefined"&&b.fatal&&c.disable()};Ia=function(){if(!ta||!da())return!1;var b=c.audioFormats,a,e;for(e in b)if(b.hasOwnProperty(e)&&(e==="mp3"||e==="mp4"))if(c._wD("soundManager: Using flash fallback for "+
+e+" format"),c.html5[e]=!1,b[e]&&b[e].related)for(a=b[e].related.length;a--;)c.html5[b[e].related[a]]=!1};this._setSandboxType=function(b){var a=c.sandbox;a.type=b;a.description=a.types[typeof a.types[b]!=="undefined"?b:"unknown"];c._wD("Flash security sandbox type: "+a.type);if(a.type==="localWithFile")a.noRemote=!0,a.noLocal=!1,l("secNote",2);else if(a.type==="localWithNetwork")a.noRemote=!1,a.noLocal=!0;else if(a.type==="localTrusted")a.noRemote=!1,a.noLocal=!1};this._externalInterfaceOK=function(b){if(c.swfLoaded)return!1;
+var a=(new Date).getTime();c._wD("soundManager::externalInterfaceOK()"+(b?" (~"+(a-b)+" ms)":""));q("swf",!0);q("flashtojs",!0);c.swfLoaded=!0;H=!1;ta&&Ia();A?setTimeout(T,100):T()};Y=function(b,a){function e(){c._wD("-- SoundManager 2 "+c.version+(!c.html5Only&&c.useHTML5Audio?c.hasHTML5?" + HTML5 audio":", no HTML5 audio support":"")+(!c.html5Only?(c.useHighPerformance?", high performance mode, ":", ")+((c.flashPollingInterval?"custom ("+c.flashPollingInterval+"ms)":"normal")+" polling")+(c.wmode?
+", wmode: "+c.wmode:"")+(c.debugFlash?", flash debug mode":"")+(c.useFlashBlock?", flashBlock mode":""):"")+" --",1)}function f(a,b){return'<param name="'+a+'" value="'+b+'" />'}if(K&&L)return!1;if(c.html5Only)return ja(),e(),c.oMC=u(c.movieID),T(),L=K=!0,!1;var d=a||c.url,j=c.altURL||d,h;h=X();var i,o,k=G(),m,p=null,p=(p=g.getElementsByTagName("html")[0])&&p.dir&&p.dir.match(/rtl/i),b=typeof b==="undefined"?c.id:b;ja();c.url=Ba(I?d:j);a=c.url;c.wmode=!c.wmode&&c.useHighPerformance?"transparent":
+c.wmode;if(c.wmode!==null&&(r.match(/msie 8/i)||!A&&!c.useHighPerformance)&&navigator.platform.match(/win32|win64/i))c.specialWmodeCase=!0,l("spcWmode"),c.wmode=null;h={name:b,id:b,src:a,width:"auto",height:"auto",quality:"high",allowScriptAccess:c.allowScriptAccess,bgcolor:c.bgColor,pluginspage:Ma+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:c.wmode,hasPriority:"true"};if(c.debugFlash)h.FlashVars="debug=1";c.wmode||
+delete h.wmode;if(A)d=g.createElement("div"),o=['<object id="'+b+'" data="'+a+'" type="'+h.type+'" title="'+h.title+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+Ma+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="'+h.width+'" height="'+h.height+'">',f("movie",a),f("AllowScriptAccess",c.allowScriptAccess),f("quality",h.quality),c.wmode?f("wmode",c.wmode):"",f("bgcolor",c.bgColor),f("hasPriority","true"),c.debugFlash?f("FlashVars",h.FlashVars):
+"","</object>"].join("");else for(i in d=g.createElement("embed"),h)h.hasOwnProperty(i)&&d.setAttribute(i,h[i]);la();k=G();if(h=X())if(c.oMC=u(c.movieID)||g.createElement("div"),c.oMC.id){m=c.oMC.className;c.oMC.className=(m?m+" ":c.swfCSS.swfDefault)+(k?" "+k:"");c.oMC.appendChild(d);if(A)i=c.oMC.appendChild(g.createElement("div")),i.className=c.swfCSS.swfBox,i.innerHTML=o;L=!0}else{c.oMC.id=c.movieID;c.oMC.className=c.swfCSS.swfDefault+" "+k;i=k=null;if(!c.useFlashBlock)if(c.useHighPerformance)k=
+{position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"};else if(k={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},p)k.left=Math.abs(parseInt(k.left,10))+"px";if(Sa)c.oMC.style.zIndex=1E4;if(!c.debugFlash)for(m in k)k.hasOwnProperty(m)&&(c.oMC.style[m]=k[m]);try{A||c.oMC.appendChild(d);h.appendChild(c.oMC);if(A)i=c.oMC.appendChild(g.createElement("div")),i.className=c.swfCSS.swfBox,i.innerHTML=o;L=!0}catch(q){throw Error(n("domError")+" \n"+
+q.toString());}}K=!0;e();c._wD("soundManager::createMovie(): Trying to load "+a+(!I&&c.altURL?" (alternate URL)":""),1);return!0};W=function(){if(c.html5Only)return Y(),!1;if(c.o)return!1;c.o=c.getMovie(c.id);if(!c.o)N?(A?c.oMC.innerHTML=ma:c.oMC.appendChild(N),N=null,K=!0):Y(c.id,c.url),c.o=c.getMovie(c.id);c.o&&l("waitEI");c.oninitmovie instanceof Function&&setTimeout(c.oninitmovie,1);return!0};U=function(){setTimeout(ya,1E3)};ya=function(){if(ba)return!1;ba=!0;p.remove(i,"load",U);if(H&&!va)return l("waitFocus"),
+!1;var b;m||(b=c.getMoviePercent(),c._wD(n("waitImpatient",b===100?" (SWF loaded)":b>0?" (SWF "+b+"% loaded)":"")));setTimeout(function(){b=c.getMoviePercent();m||(c._wD("soundManager: No Flash response within expected time.\nLikely causes: "+(b===0?"Loading "+c.movieURL+" may have failed (and/or Flash "+j+"+ not present?), ":"")+"Flash blocked or JS-Flash security error."+(c.debugFlash?" "+n("checkSWF"):""),2),!I&&b&&(l("localFail",2),c.debugFlash||l("tryDebug",2)),b===0&&c._wD(n("swf404",c.url)),
+q("flashtojs",!1,": Timed out"+I?" (Check flash security or flash blockers)":" (No plugin/missing SWF?)"));!m&&Ka&&(b===null?c.useFlashBlock||c.flashLoadTimeout===0?(c.useFlashBlock&&na(),l("waitForever")):Z(!0):c.flashLoadTimeout===0?l("waitForever"):Z(!0))},c.flashLoadTimeout)};B=function(){function b(){p.remove(i,"focus",B);p.remove(i,"load",B)}if(va||!H)return b(),!0;va=Ka=!0;c._wD("soundManager::handleFocus()");Q&&H&&p.remove(i,"mousemove",B);ba=!1;b();return!0};Ja=function(){var b,a=[];if(c.useHTML5Audio&&
+c.hasHTML5){for(b in c.audioFormats)c.audioFormats.hasOwnProperty(b)&&a.push(b+": "+c.html5[b]+(!c.html5[b]&&t&&c.flash[b]?" (using flash)":c.preferFlash&&c.flash[b]&&t?" (preferring flash)":!c.html5[b]?" ("+(c.audioFormats[b].required?"required, ":"")+"and no flash support)":""));c._wD("-- SoundManager 2: HTML5 support tests ("+c.html5Test+"): "+a.join(", ")+" --",1)}};M=function(b){if(m)return!1;if(c.html5Only)return c._wD("-- SoundManager 2: loaded --"),m=!0,D(),q("onload",!0),!0;var a;if(!c.useFlashBlock||
+!c.flashLoadTimeout||c.getMoviePercent())m=!0,v&&(a={type:!t&&w?"NO_FLASH":"INIT_TIMEOUT"});c._wD("-- SoundManager 2 "+(v?"failed to load":"loaded")+" ("+(v?"security/load error":"OK")+") --",1);if(v||b){if(c.useFlashBlock&&c.oMC)c.oMC.className=G()+" "+(c.getMoviePercent()===null?c.swfCSS.swfTimedout:c.swfCSS.swfError);C({type:"ontimeout",error:a});q("onload",!1);F(a);return!1}else q("onload",!0);if(c.waitForWindowLoad&&!ha)return l("waitOnload"),p.add(i,"load",D),!1;else c.waitForWindowLoad&&ha&&
+l("docLoaded"),D();return!0};T=function(){l("init");if(m)return l("didInit"),!1;if(c.html5Only){if(!m)p.remove(i,"load",c.beginDelayedInit),c.enabled=!0,M();return!0}W();try{l("flashJS"),c.o._externalInterfaceTest(!1),za(!0,c.flashPollingInterval||(c.useHighPerformance?10:50)),c.debugMode||c.o._disableDebug(),c.enabled=!0,q("jstoflash",!0),c.html5Only||p.add(i,"unload",fa)}catch(b){return c._wD("js/flash exception: "+b.toString()),q("jstoflash",!1),F({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),Z(!0),
+M(),!1}M();p.remove(i,"load",c.beginDelayedInit);return!0};E=function(){if(ka)return!1;ka=!0;la();(function(){var b=J.toLowerCase(),a=null,a=null,e=typeof console!=="undefined"&&typeof console.log!=="undefined";if(b.indexOf("sm2-usehtml5audio=")!==-1)a=b.charAt(b.indexOf("sm2-usehtml5audio=")+18)==="1",e&&console.log((a?"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter"),c.useHTML5Audio=a;if(b.indexOf("sm2-preferflash=")!==-1)a=b.charAt(b.indexOf("sm2-preferflash=")+16)==="1",e&&console.log((a?
+"Enabling ":"Disabling ")+"preferFlash via URL parameter"),c.preferFlash=a})();if(!t&&c.hasHTML5)c._wD("SoundManager: No Flash detected"+(!c.useHTML5Audio?", enabling HTML5.":". Trying HTML5-only mode.")),c.useHTML5Audio=!0,c.preferFlash=!1;Ga();c.html5.usingFlash=Fa();w=c.html5.usingFlash;Ja();if(!t&&w)c._wD("SoundManager: Fatal error: Flash is needed to play some required formats, but is not available."),c.flashLoadTimeout=1;g.removeEventListener&&g.removeEventListener("DOMContentLoaded",E,!1);
+W();return!0};ra=function(){g.readyState==="complete"&&(E(),g.detachEvent("onreadystatechange",ra));return!0};da();p.add(i,"focus",B);p.add(i,"load",B);p.add(i,"load",U);Q&&H&&p.add(i,"mousemove",B);g.addEventListener?g.addEventListener("DOMContentLoaded",E,!1):g.attachEvent?g.attachEvent("onreadystatechange",ra):(q("onload",!1),F({type:"NO_DOM2_EVENTS",fatal:!0}));g.readyState==="complete"&&setTimeout(E,100)}var ea=null;if(typeof SM2_DEFER==="undefined"||!SM2_DEFER)ea=new S;R.SoundManager=S;R.soundManager=
+ea})(window);
\ No newline at end of file
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/script/soundmanager2-nodebug-jsmin.js b/fantasmixDjango/django_project/audiofield/static/audiofield/script/soundmanager2-nodebug-jsmin.js
new file mode 100755
index 0000000000000000000000000000000000000000..449d9826f5c49ad393acdad03c7aa7c73f1313a7
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/static/audiofield/script/soundmanager2-nodebug-jsmin.js
@@ -0,0 +1,74 @@
+/** @license
+ *
+ * SoundManager 2: JavaScript Sound for the Web
+ * ----------------------------------------------
+ * http://schillmania.com/projects/soundmanager2/
+ *
+ * Copyright (c) 2007, Scott Schiller. All rights reserved.
+ * Code provided under the BSD License:
+ * http://schillmania.com/projects/soundmanager2/license.txt
+ *
+ * V2.97a.20110918
+ */
+(function(Z){function M(M,Y){function j(c){return function(a){return!this._t||!this._t._a?null:c.call(this,a)}}this.flashVersion=8;this.debugFlash=this.debugMode=!1;this.useConsole=!0;this.waitForWindowLoad=this.consoleOnly=!1;this.bgColor="#ffffff";this.useHighPerformance=!1;this.flashPollingInterval=null;this.flashLoadTimeout=1E3;this.wmode=null;this.allowScriptAccess="always";this.useFlashBlock=!1;this.useHTML5Audio=!0;this.html5Test=/^(probably|maybe)$/i;this.preferFlash=!0;this.audioFormats=
+{mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:!0},mp4:{related:["aac","m4a"],type:['audio/mp4; codecs="mp4a.40.2"',"audio/aac","audio/x-m4a","audio/MP4A-LATM","audio/mpeg4-generic"],required:!1},ogg:{type:["audio/ogg; codecs=vorbis"],required:!1},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave","audio/x-wav"],required:!1}};this.defaultOptions={autoLoad:!1,stream:!0,autoPlay:!1,loops:1,onid3:null,onload:null,whileloading:null,onplay:null,
+onpause:null,onresume:null,whileplaying:null,onstop:null,onfailure:null,onfinish:null,multiShot:!0,multiShotEvents:!1,position:null,pan:0,type:null,usePolicyFile:!1,volume:100};this.flash9Options={isMovieStar:null,usePeakData:!1,useWaveformData:!1,useEQData:!1,onbufferchange:null,ondataerror:null};this.movieStarOptions={bufferTime:3,serverURL:null,onconnect:null,duration:null};this.movieID="sm2-container";this.id=Y||"sm2movie";this.swfCSS={swfBox:"sm2-object-box",swfDefault:"movieContainer",swfError:"swf_error",
+swfTimedout:"swf_timedout",swfLoaded:"swf_loaded",swfUnblocked:"swf_unblocked",sm2Debug:"sm2_debug",highPerf:"high_performance",flashDebug:"flash_debug"};this.debugID="soundmanager-debug";this.debugURLParam=/([#?&])debug=1/i;this.versionNumber="V2.97a.20110918";this.movieURL=this.version=null;this.url=M||null;this.altURL=null;this.enabled=this.swfLoaded=!1;this.oMC=this.o=null;this.sounds={};this.soundIDs=[];this.didFlashBlock=this.specialWmodeCase=this.muted=!1;this.filePattern=null;this.filePatterns=
+{flash8:/\.mp3(\?.*)?$/i,flash9:/\.mp3(\?.*)?$/i};this.features={buffering:!1,peakData:!1,waveformData:!1,eqData:!1,movieStar:!1};this.sandbox={};this.hasHTML5=typeof Audio!=="undefined"&&typeof(new Audio).canPlayType!=="undefined";this.html5={usingFlash:null};this.flash={};this.ignoreFlash=this.html5Only=!1;var qa,c=this,N,o=navigator.userAgent,i=Z,$=i.location.href.toString(),h=document,aa,O,g,s=[],F=!1,G=!1,m=!1,t=!1,ra=!1,H,n,ba,z,A,P,sa,ca,x,Q,B,da,ea,R,C,ta,fa,ua,S,va,I=null,ga=null,y,ha,D,
+T,U,ia,l,V=!1,ja=!1,wa,xa,q=null,ya,W,J,u,ka,la,za,k,Ha=Array.prototype.slice,K=!1,p,X,Aa,r,Ba,ma=o.match(/(ipad|iphone|ipod)/i),Ia=o.match(/(mobile|pre\/|xoom)/i)||ma,v=o.match(/msie/i),Ja=o.match(/webkit/i),L=o.match(/safari/i)&&!o.match(/chrome/i),Ka=o.match(/opera/i),na=!$.match(/usehtml5audio/i)&&!$.match(/sm2\-ignorebadua/i)&&L&&o.match(/OS X 10_6_([3-7])/i),oa=typeof h.hasFocus!=="undefined"?h.hasFocus():null,E=L&&typeof h.hasFocus==="undefined",Ca=!E,Da=/(mp3|mp4|mpa)/i,pa=h.location?h.location.protocol.match(/http/i):
+null,Ea=!pa?"http://":"",Fa=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|mp4v|3gp|3g2)\s*(?:$|;)/i,Ga=["mpeg4","aac","flv","mov","mp4","m4v","f4v","m4a","mp4v","3gp","3g2"],La=RegExp("\\.("+Ga.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i;this.useAltURL=!pa;this._global_a=null;if(Ia&&(c.useHTML5Audio=!0,c.preferFlash=!1,ma))K=c.ignoreFlash=!0;this.supported=this.ok=function(){return q?m&&!t:c.useHTML5Audio&&c.hasHTML5};this.getMovie=function(c){return N(c)||
+h[c]||i[c]};this.createSound=function(b){function a(){e=T(e);c.sounds[d.id]=new qa(d);c.soundIDs.push(d.id);return c.sounds[d.id]}var e=null,f=null,d=null;if(!m||!c.ok())return ia("soundManager.createSound(): "+y(!m?"notReady":"notOK")),!1;arguments.length===2&&(b={id:arguments[0],url:arguments[1]});d=e=n(b);if(l(d.id,!0))return c.sounds[d.id];if(W(d))f=a(),f._setup_html5(d);else{if(g>8){if(d.isMovieStar===null)d.isMovieStar=d.serverURL||(d.type?d.type.match(Fa):!1)||d.url.match(La);if(d.isMovieStar&&
+d.usePeakData)d.usePeakData=!1}d=U(d,"soundManager.createSound(): ");f=a();if(g===8)c.o._createSound(d.id,d.loops||1,d.usePolicyFile);else if(c.o._createSound(d.id,d.url,d.usePeakData,d.useWaveformData,d.useEQData,d.isMovieStar,d.isMovieStar?d.bufferTime:!1,d.loops||1,d.serverURL,d.duration||null,d.autoPlay,!0,d.autoLoad,d.usePolicyFile),!d.serverURL)f.connected=!0,d.onconnect&&d.onconnect.apply(f);!d.serverURL&&(d.autoLoad||d.autoPlay)&&f.load(d)}!d.serverURL&&d.autoPlay&&f.play();return f};this.destroySound=
+function(b,a){if(!l(b))return!1;var e=c.sounds[b],f;e._iO={};e.stop();e.unload();for(f=0;f<c.soundIDs.length;f++)if(c.soundIDs[f]===b){c.soundIDs.splice(f,1);break}a||e.destruct(!0);delete c.sounds[b];return!0};this.load=function(b,a){return!l(b)?!1:c.sounds[b].load(a)};this.unload=function(b){return!l(b)?!1:c.sounds[b].unload()};this.onposition=function(b,a,e,f){return!l(b)?!1:c.sounds[b].onposition(a,e,f)};this.start=this.play=function(b,a){return!m||!c.ok()?(ia("soundManager.play(): "+y(!m?"notReady":
+"notOK")),!1):!l(b)?(a instanceof Object||(a={url:a}),a&&a.url?(a.id=b,c.createSound(a).play()):!1):c.sounds[b].play(a)};this.setPosition=function(b,a){return!l(b)?!1:c.sounds[b].setPosition(a)};this.stop=function(b){return!l(b)?!1:c.sounds[b].stop()};this.stopAll=function(){for(var b in c.sounds)c.sounds.hasOwnProperty(b)&&c.sounds[b].stop()};this.pause=function(b){return!l(b)?!1:c.sounds[b].pause()};this.pauseAll=function(){var b;for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].pause()};this.resume=
+function(b){return!l(b)?!1:c.sounds[b].resume()};this.resumeAll=function(){var b;for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].resume()};this.togglePause=function(b){return!l(b)?!1:c.sounds[b].togglePause()};this.setPan=function(b,a){return!l(b)?!1:c.sounds[b].setPan(a)};this.setVolume=function(b,a){return!l(b)?!1:c.sounds[b].setVolume(a)};this.mute=function(b){var a=0;typeof b!=="string"&&(b=null);if(b)return!l(b)?!1:c.sounds[b].mute();else{for(a=c.soundIDs.length;a--;)c.sounds[c.soundIDs[a]].mute();
+c.muted=!0}return!0};this.muteAll=function(){c.mute()};this.unmute=function(b){typeof b!=="string"&&(b=null);if(b)return!l(b)?!1:c.sounds[b].unmute();else{for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].unmute();c.muted=!1}return!0};this.unmuteAll=function(){c.unmute()};this.toggleMute=function(b){return!l(b)?!1:c.sounds[b].toggleMute()};this.getMemoryUse=function(){var b=0;c.o&&g!==8&&(b=parseInt(c.o._getMemoryUse(),10));return b};this.disable=function(b){var a;typeof b==="undefined"&&(b=!1);
+if(t)return!1;t=!0;for(a=c.soundIDs.length;a--;)ua(c.sounds[c.soundIDs[a]]);H(b);k.remove(i,"load",A);return!0};this.canPlayMIME=function(b){var a;c.hasHTML5&&(a=J({type:b}));return!q||a?a:b?!!(g>8&&b.match(Fa)||b.match(c.mimePattern)):null};this.canPlayURL=function(b){var a;c.hasHTML5&&(a=J({url:b}));return!q||a?a:b?!!b.match(c.filePattern):null};this.canPlayLink=function(b){return typeof b.type!=="undefined"&&b.type&&c.canPlayMIME(b.type)?!0:c.canPlayURL(b.href)};this.getSoundById=function(b){if(!b)throw Error("soundManager.getSoundById(): sID is null/undefined");
+return c.sounds[b]};this.onready=function(c,a){if(c&&c instanceof Function)return a||(a=i),ba("onready",c,a),z(),!0;else throw y("needFunction","onready");};this.ontimeout=function(c,a){if(c&&c instanceof Function)return a||(a=i),ba("ontimeout",c,a),z({type:"ontimeout"}),!0;else throw y("needFunction","ontimeout");};this._wD=this._writeDebug=function(){return!0};this._debug=function(){};this.reboot=function(){var b,a;for(b=c.soundIDs.length;b--;)c.sounds[c.soundIDs[b]].destruct();try{if(v)ga=c.o.innerHTML;
+I=c.o.parentNode.removeChild(c.o)}catch(e){}ga=I=q=null;c.enabled=da=m=V=ja=F=G=t=c.swfLoaded=!1;c.soundIDs=c.sounds=[];c.o=null;for(b in s)if(s.hasOwnProperty(b))for(a=s[b].length;a--;)s[b][a].fired=!1;i.setTimeout(c.beginDelayedInit,20)};this.getMoviePercent=function(){return c.o&&typeof c.o.PercentLoaded!=="undefined"?c.o.PercentLoaded():null};this.beginDelayedInit=function(){ra=!0;B();setTimeout(function(){if(ja)return!1;R();Q();return ja=!0},20);P()};this.destruct=function(){c.disable(!0)};qa=
+function(b){var a=this,e,f,d;this.sID=b.id;this.url=b.url;this._iO=this.instanceOptions=this.options=n(b);this.pan=this.options.pan;this.volume=this.options.volume;this._lastURL=null;this.isHTML5=!1;this._a=null;this.id3={};this._debug=function(){};this.load=function(b){var d=null;if(typeof b!=="undefined")a._iO=n(b,a.options),a.instanceOptions=a._iO;else if(b=a.options,a._iO=b,a.instanceOptions=a._iO,a._lastURL&&a._lastURL!==a.url)a._iO.url=a.url,a.url=null;if(!a._iO.url)a._iO.url=a.url;if(a._iO.url===
+a.url&&a.readyState!==0&&a.readyState!==2)return a;a._lastURL=a.url;a.loaded=!1;a.readyState=1;a.playState=0;if(W(a._iO)){if(d=a._setup_html5(a._iO),!d._called_load)a._html5_canplay=!1,d.load(),d._called_load=!0,a._iO.autoPlay&&a.play()}else try{a.isHTML5=!1,a._iO=U(T(a._iO)),g===8?c.o._load(a.sID,a._iO.url,a._iO.stream,a._iO.autoPlay,a._iO.whileloading?1:0,a._iO.loops||1,a._iO.usePolicyFile):c.o._load(a.sID,a._iO.url,!!a._iO.stream,!!a._iO.autoPlay,a._iO.loops||1,!!a._iO.autoLoad,a._iO.usePolicyFile)}catch(e){C({type:"SMSOUND_LOAD_JS_EXCEPTION",
+fatal:!0})}return a};this.unload=function(){a.readyState!==0&&(a.isHTML5?(f(),a._a&&(a._a.pause(),ka(a._a))):g===8?c.o._unload(a.sID,"about:blank"):c.o._unload(a.sID),e());return a};this.destruct=function(b){if(a.isHTML5){if(f(),a._a)a._a.pause(),ka(a._a),K||a._remove_html5_events(),a._a._t=null,a._a=null}else a._iO.onfailure=null,c.o._destroySound(a.sID);b||c.destroySound(a.sID,!0)};this.start=this.play=function(b,w){var e,w=w===void 0?!0:w;b||(b={});a._iO=n(b,a._iO);a._iO=n(a._iO,a.options);a.instanceOptions=
+a._iO;if(a._iO.serverURL&&!a.connected)return a.getAutoPlay()||a.setAutoPlay(!0),a;W(a._iO)&&(a._setup_html5(a._iO),d());if(a.playState===1&&!a.paused&&(e=a._iO.multiShot,!e))return a;if(!a.loaded)if(a.readyState===0){if(!a.isHTML5)a._iO.autoPlay=!0;a.load(a._iO)}else if(a.readyState===2)return a;if(!a.isHTML5&&g===9&&a.position>0&&a.position===a.duration)a._iO.position=0;if(a.paused&&a.position&&a.position>0)a.resume();else{a.playState=1;a.paused=!1;(!a.instanceCount||a._iO.multiShotEvents||!a.isHTML5&&
+g>8&&!a.getAutoPlay())&&a.instanceCount++;a.position=typeof a._iO.position!=="undefined"&&!isNaN(a._iO.position)?a._iO.position:0;if(!a.isHTML5)a._iO=U(T(a._iO));if(a._iO.onplay&&w)a._iO.onplay.apply(a),a._onplay_called=!0;a.setVolume(a._iO.volume,!0);a.setPan(a._iO.pan,!0);a.isHTML5?(d(),e=a._setup_html5(),a.setPosition(a._iO.position),e.play()):c.o._start(a.sID,a._iO.loops||1,g===9?a._iO.position:a._iO.position/1E3)}return a};this.stop=function(b){if(a.playState===1){a._onbufferchange(0);a.resetOnPosition(0);
+a.paused=!1;if(!a.isHTML5)a.playState=0;a._iO.onstop&&a._iO.onstop.apply(a);if(a.isHTML5){if(a._a)a.setPosition(0),a._a.pause(),a.playState=0,a._onTimer(),f()}else c.o._stop(a.sID,b),a._iO.serverURL&&a.unload();a.instanceCount=0;a._iO={}}return a};this.setAutoPlay=function(b){a._iO.autoPlay=b;a.isHTML5||(c.o._setAutoPlay(a.sID,b),b&&!a.instanceCount&&a.readyState===1&&a.instanceCount++)};this.getAutoPlay=function(){return a._iO.autoPlay};this.setPosition=function(b){b===void 0&&(b=0);var d=a.isHTML5?
+Math.max(b,0):Math.min(a.duration||a._iO.duration,Math.max(b,0));a.position=d;b=a.position/1E3;a.resetOnPosition(a.position);a._iO.position=d;if(a.isHTML5){if(a._a&&a._html5_canplay&&a._a.currentTime!==b)try{a._a.currentTime=b,(a.playState===0||a.paused)&&a._a.pause()}catch(e){}}else b=g===9?a.position:b,a.readyState&&a.readyState!==2&&c.o._setPosition(a.sID,b,a.paused||!a.playState);a.isHTML5&&a.paused&&a._onTimer(!0);return a};this.pause=function(b){if(a.paused||a.playState===0&&a.readyState!==
+1)return a;a.paused=!0;a.isHTML5?(a._setup_html5().pause(),f()):(b||b===void 0)&&c.o._pause(a.sID);a._iO.onpause&&a._iO.onpause.apply(a);return a};this.resume=function(){if(!a.paused)return a;a.paused=!1;a.playState=1;a.isHTML5?(a._setup_html5().play(),d()):(a._iO.isMovieStar&&a.setPosition(a.position),c.o._pause(a.sID));!a._onplay_called&&a._iO.onplay?(a._iO.onplay.apply(a),a._onplay_called=!0):a._iO.onresume&&a._iO.onresume.apply(a);return a};this.togglePause=function(){if(a.playState===0)return a.play({position:g===
+9&&!a.isHTML5?a.position:a.position/1E3}),a;a.paused?a.resume():a.pause();return a};this.setPan=function(b,d){typeof b==="undefined"&&(b=0);typeof d==="undefined"&&(d=!1);a.isHTML5||c.o._setPan(a.sID,b);a._iO.pan=b;if(!d)a.pan=b,a.options.pan=b;return a};this.setVolume=function(b,d){typeof b==="undefined"&&(b=100);typeof d==="undefined"&&(d=!1);if(a.isHTML5){if(a._a)a._a.volume=Math.max(0,Math.min(1,b/100))}else c.o._setVolume(a.sID,c.muted&&!a.muted||a.muted?0:b);a._iO.volume=b;if(!d)a.volume=b,
+a.options.volume=b;return a};this.mute=function(){a.muted=!0;if(a.isHTML5){if(a._a)a._a.muted=!0}else c.o._setVolume(a.sID,0);return a};this.unmute=function(){a.muted=!1;var b=typeof a._iO.volume!=="undefined";if(a.isHTML5){if(a._a)a._a.muted=!1}else c.o._setVolume(a.sID,b?a._iO.volume:a.options.volume);return a};this.toggleMute=function(){return a.muted?a.unmute():a.mute()};this.onposition=function(b,c,d){a._onPositionItems.push({position:b,method:c,scope:typeof d!=="undefined"?d:a,fired:!1});return a};
+this.processOnPosition=function(){var b,d;b=a._onPositionItems.length;if(!b||!a.playState||a._onPositionFired>=b)return!1;for(;b--;)if(d=a._onPositionItems[b],!d.fired&&a.position>=d.position)d.fired=!0,c._onPositionFired++,d.method.apply(d.scope,[d.position]);return!0};this.resetOnPosition=function(b){var d,e;d=a._onPositionItems.length;if(!d)return!1;for(;d--;)if(e=a._onPositionItems[d],e.fired&&b<=e.position)e.fired=!1,c._onPositionFired--;return!0};d=function(){a.isHTML5&&wa(a)};f=function(){a.isHTML5&&
+xa(a)};e=function(){a._onPositionItems=[];a._onPositionFired=0;a._hasTimer=null;a._onplay_called=!1;a._a=null;a._html5_canplay=!1;a.bytesLoaded=null;a.bytesTotal=null;a.position=null;a.duration=a._iO&&a._iO.duration?a._iO.duration:null;a.durationEstimate=null;a.failures=0;a.loaded=!1;a.playState=0;a.paused=!1;a.readyState=0;a.muted=!1;a.isBuffering=!1;a.instanceOptions={};a.instanceCount=0;a.peakData={left:0,right:0};a.waveformData={left:[],right:[]};a.eqData=[];a.eqData.left=[];a.eqData.right=[]};
+e();this._onTimer=function(b){var c={};if(a._hasTimer||b)return a._a&&(b||(a.playState>0||a.readyState===1)&&!a.paused)?(a.duration=a._get_html5_duration(),a.durationEstimate=a.duration,b=a._a.currentTime?a._a.currentTime*1E3:0,a._whileplaying(b,c,c,c,c),!0):!1};this._get_html5_duration=function(){var b=a._a?a._a.duration*1E3:a._iO?a._iO.duration:void 0;return b&&!isNaN(b)&&b!==Infinity?b:a._iO?a._iO.duration:null};this._setup_html5=function(b){var b=n(a._iO,b),d=K?c._global_a:a._a;decodeURI(b.url);
+var f=d&&d._t?d._t.instanceOptions:null;if(d){if(d._t&&f.url===b.url&&(!a._lastURL||a._lastURL===f.url))return d;K&&d._t&&d._t.playState&&b.url!==f.url&&d._t.stop();e();d.src=b.url;a.url=b.url;a._lastURL=b.url;d._called_load=!1}else if(d=new Audio(b.url),d._called_load=!1,K)c._global_a=d;a.isHTML5=!0;a._a=d;d._t=a;a._add_html5_events();d.loop=b.loops>1?"loop":"";b.autoLoad||b.autoPlay?(d.autobuffer="auto",d.preload="auto",a.load(),d._called_load=!0):(d.autobuffer=!1,d.preload="none");d.loop=b.loops>
+1?"loop":"";return d};this._add_html5_events=function(){if(a._a._added_events)return!1;var b;a._a._added_events=!0;for(b in r)r.hasOwnProperty(b)&&a._a&&a._a.addEventListener(b,r[b],!1);return!0};this._remove_html5_events=function(){var b;a._a._added_events=!1;for(b in r)r.hasOwnProperty(b)&&a._a&&a._a.removeEventListener(b,r[b],!1)};this._onload=function(b){b=!!b;a.loaded=b;a.readyState=b?3:2;a._onbufferchange(0);a._iO.onload&&a._iO.onload.apply(a,[b]);return!0};this._onbufferchange=function(b){if(a.playState===
+0)return!1;if(b&&a.isBuffering||!b&&!a.isBuffering)return!1;a.isBuffering=b===1;a._iO.onbufferchange&&a._iO.onbufferchange.apply(a);return!0};this._onfailure=function(b,c,d){a.failures++;if(a._iO.onfailure&&a.failures===1)a._iO.onfailure(a,b,c,d)};this._onfinish=function(){var b=a._iO.onfinish;a._onbufferchange(0);a.resetOnPosition(0);if(a.instanceCount){a.instanceCount--;if(!a.instanceCount)a.playState=0,a.paused=!1,a.instanceCount=0,a.instanceOptions={},a._iO={},f();(!a.instanceCount||a._iO.multiShotEvents)&&
+b&&b.apply(a)}};this._whileloading=function(b,c,d,e){a.bytesLoaded=b;a.bytesTotal=c;a.duration=Math.floor(d);a.bufferLength=e;if(a._iO.isMovieStar)a.durationEstimate=a.duration;else if(a.durationEstimate=a._iO.duration?a.duration>a._iO.duration?a.duration:a._iO.duration:parseInt(a.bytesTotal/a.bytesLoaded*a.duration,10),a.durationEstimate===void 0)a.durationEstimate=a.duration;a.readyState!==3&&a._iO.whileloading&&a._iO.whileloading.apply(a)};this._whileplaying=function(b,c,d,e,f){if(isNaN(b)||b===
+null)return!1;a.position=b;a.processOnPosition();if(!a.isHTML5&&g>8){if(a._iO.usePeakData&&typeof c!=="undefined"&&c)a.peakData={left:c.leftPeak,right:c.rightPeak};if(a._iO.useWaveformData&&typeof d!=="undefined"&&d)a.waveformData={left:d.split(","),right:e.split(",")};if(a._iO.useEQData&&typeof f!=="undefined"&&f&&f.leftEQ&&(b=f.leftEQ.split(","),a.eqData=b,a.eqData.left=b,typeof f.rightEQ!=="undefined"&&f.rightEQ))a.eqData.right=f.rightEQ.split(",")}a.playState===1&&(!a.isHTML5&&g===8&&!a.position&&
+a.isBuffering&&a._onbufferchange(0),a._iO.whileplaying&&a._iO.whileplaying.apply(a));return!0};this._onid3=function(b,c){var d=[],e,f;e=0;for(f=b.length;e<f;e++)d[b[e]]=c[e];a.id3=n(a.id3,d);a._iO.onid3&&a._iO.onid3.apply(a)};this._onconnect=function(b){b=b===1;if(a.connected=b)a.failures=0,l(a.sID)&&(a.getAutoPlay()?a.play(void 0,a.getAutoPlay()):a._iO.autoLoad&&a.load()),a._iO.onconnect&&a._iO.onconnect.apply(a,[b])};this._ondataerror=function(){a.playState>0&&a._iO.ondataerror&&a._iO.ondataerror.apply(a)}};
+ea=function(){return h.body||h._docElement||h.getElementsByTagName("div")[0]};N=function(b){return h.getElementById(b)};n=function(b,a){var e={},f,d;for(f in b)b.hasOwnProperty(f)&&(e[f]=b[f]);f=typeof a==="undefined"?c.defaultOptions:a;for(d in f)f.hasOwnProperty(d)&&typeof e[d]==="undefined"&&(e[d]=f[d]);return e};k=function(){function b(a){var a=Ha.call(a),b=a.length;c?(a[1]="on"+a[1],b>3&&a.pop()):b===3&&a.push(!1);return a}function a(a,b){var w=a.shift(),h=[f[b]];if(c)w[h](a[0],a[1]);else w[h].apply(w,
+a)}var c=i.attachEvent,f={add:c?"attachEvent":"addEventListener",remove:c?"detachEvent":"removeEventListener"};return{add:function(){a(b(arguments),"add")},remove:function(){a(b(arguments),"remove")}}}();r={abort:j(function(){}),canplay:j(function(){if(this._t._html5_canplay)return!0;this._t._html5_canplay=!0;this._t._onbufferchange(0);var b=!isNaN(this._t.position)?this._t.position/1E3:null;if(this._t.position&&this.currentTime!==b)try{this.currentTime=b}catch(a){}}),load:j(function(){this._t.loaded||
+(this._t._onbufferchange(0),this._t._whileloading(this._t.bytesTotal,this._t.bytesTotal,this._t._get_html5_duration()),this._t._onload(!0))}),emptied:j(function(){}),ended:j(function(){this._t._onfinish()}),error:j(function(){this._t._onload(!1)}),loadeddata:j(function(){var b=this._t,a=b.bytesTotal||1;if(!b._loaded&&!L)b.duration=b._get_html5_duration(),b._whileloading(a,a,b._get_html5_duration()),b._onload(!0)}),loadedmetadata:j(function(){}),loadstart:j(function(){this._t._onbufferchange(1)}),
+play:j(function(){this._t._onbufferchange(0)}),playing:j(function(){this._t._onbufferchange(0)}),progress:j(function(b){if(this._t.loaded)return!1;var a,c=0,f=b.target.buffered;a=b.loaded||0;var d=b.total||1;if(f&&f.length){for(a=f.length;a--;)c=f.end(a)-f.start(a);a=c/b.target.duration}isNaN(a)||(this._t._onbufferchange(0),this._t._whileloading(a,d,this._t._get_html5_duration()),a&&d&&a===d&&r.load.call(this,b))}),ratechange:j(function(){}),suspend:j(function(b){r.progress.call(this,b)}),stalled:j(function(){}),
+timeupdate:j(function(){this._t._onTimer()}),waiting:j(function(){this._t._onbufferchange(1)})};W=function(b){return!b.serverURL&&(b.type?J({type:b.type}):J({url:b.url})||c.html5Only)};ka=function(b){if(b)b.src=o.match(/gecko/i)?"":"about:blank"};J=function(b){function a(a){return c.preferFlash&&p&&!c.ignoreFlash&&typeof c.flash[a]!=="undefined"&&c.flash[a]}if(!c.useHTML5Audio||!c.hasHTML5)return!1;var e=b.url||null,b=b.type||null,f=c.audioFormats,d;if(b&&c.html5[b]!=="undefined")return c.html5[b]&&
+!a(b);if(!u){u=[];for(d in f)f.hasOwnProperty(d)&&(u.push(d),f[d].related&&(u=u.concat(f[d].related)));u=RegExp("\\.("+u.join("|")+")(\\?.*)?$","i")}d=e?e.toLowerCase().match(u):null;if(!d||!d.length)if(b)e=b.indexOf(";"),d=(e!==-1?b.substr(0,e):b).substr(6);else return!1;else d=d[1];return d&&typeof c.html5[d]!=="undefined"?c.html5[d]&&!a(d):(b="audio/"+d,e=c.html5.canPlayType({type:b}),(c.html5[d]=e)&&c.html5[b]&&!a(b))};za=function(){function b(b){var d,e,f=!1;if(!a||typeof a.canPlayType!=="function")return!1;
+if(b instanceof Array){d=0;for(e=b.length;d<e&&!f;d++)if(c.html5[b[d]]||a.canPlayType(b[d]).match(c.html5Test))f=!0,c.html5[b[d]]=!0,c.flash[b[d]]=!(!c.preferFlash||!p||!b[d].match(Da));return f}else return b=a&&typeof a.canPlayType==="function"?a.canPlayType(b):!1,!(!b||!b.match(c.html5Test))}if(!c.useHTML5Audio||typeof Audio==="undefined")return!1;var a=typeof Audio!=="undefined"?Ka?new Audio(null):new Audio:null,e,f={},d,h;d=c.audioFormats;for(e in d)if(d.hasOwnProperty(e)&&(f[e]=b(d[e].type),
+f["audio/"+e]=f[e],c.flash[e]=c.preferFlash&&!c.ignoreFlash&&e.match(Da)?!0:!1,d[e]&&d[e].related))for(h=d[e].related.length;h--;)f["audio/"+d[e].related[h]]=f[e],c.html5[d[e].related[h]]=f[e],c.flash[d[e].related[h]]=f[e];f.canPlayType=a?b:null;c.html5=n(c.html5,f);return!0};y=function(){};T=function(b){if(g===8&&b.loops>1&&b.stream)b.stream=!1;return b};U=function(b){if(b&&!b.usePolicyFile&&(b.onid3||b.usePeakData||b.useWaveformData||b.useEQData))b.usePolicyFile=!0;return b};ia=function(){};aa=
+function(){return!1};ua=function(b){for(var a in b)b.hasOwnProperty(a)&&typeof b[a]==="function"&&(b[a]=aa)};S=function(b){typeof b==="undefined"&&(b=!1);(t||b)&&c.disable(b)};va=function(b){var a=null;if(b)if(b.match(/\.swf(\?.*)?$/i)){if(a=b.substr(b.toLowerCase().lastIndexOf(".swf?")+4))return b}else b.lastIndexOf("/")!==b.length-1&&(b+="/");return(b&&b.lastIndexOf("/")!==-1?b.substr(0,b.lastIndexOf("/")+1):"./")+c.movieURL};ca=function(){g=parseInt(c.flashVersion,10);if(g!==8&&g!==9)c.flashVersion=
+g=8;var b=c.debugMode||c.debugFlash?"_debug.swf":".swf";if(c.useHTML5Audio&&!c.html5Only&&c.audioFormats.mp4.required&&g<9)c.flashVersion=g=9;c.version=c.versionNumber+(c.html5Only?" (HTML5-only mode)":g===9?" (AS3/Flash 9)":" (AS2/Flash 8)");g>8?(c.defaultOptions=n(c.defaultOptions,c.flash9Options),c.features.buffering=!0,c.defaultOptions=n(c.defaultOptions,c.movieStarOptions),c.filePatterns.flash9=RegExp("\\.(mp3|"+Ga.join("|")+")(\\?.*)?$","i"),c.features.movieStar=!0):c.features.movieStar=!1;
+c.filePattern=c.filePatterns[g!==8?"flash9":"flash8"];c.movieURL=(g===8?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",b);c.features.peakData=c.features.waveformData=c.features.eqData=g>8};ta=function(b,a){if(!c.o)return!1;c.o._setPolling(b,a)};fa=function(){if(c.debugURLParam.test($))c.debugMode=!0};l=this.getSoundById;D=function(){var b=[];c.debugMode&&b.push(c.swfCSS.sm2Debug);c.debugFlash&&b.push(c.swfCSS.flashDebug);c.useHighPerformance&&b.push(c.swfCSS.highPerf);return b.join(" ")};
+ha=function(){y("fbHandler");var b=c.getMoviePercent(),a=c.swfCSS,e={type:"FLASHBLOCK"};if(c.html5Only)return!1;if(c.ok()){if(c.oMC)c.oMC.className=[D(),a.swfDefault,a.swfLoaded+(c.didFlashBlock?" "+a.swfUnblocked:"")].join(" ")}else{if(q)c.oMC.className=D()+" "+a.swfDefault+" "+(b===null?a.swfTimedout:a.swfError);c.didFlashBlock=!0;z({type:"ontimeout",ignoreInit:!0,error:e});C(e)}};ba=function(b,a,c){typeof s[b]==="undefined"&&(s[b]=[]);s[b].push({method:a,scope:c||null,fired:!1})};z=function(b){b||
+(b={type:"onready"});if(!m&&b&&!b.ignoreInit)return!1;if(b.type==="ontimeout"&&c.ok())return!1;var a={success:b&&b.ignoreInit?c.ok():!t},e=b&&b.type?s[b.type]||[]:[],f=[],d,a=[a],h=q&&c.useFlashBlock&&!c.ok();if(b.error)a[0].error=b.error;b=0;for(d=e.length;b<d;b++)e[b].fired!==!0&&f.push(e[b]);if(f.length){b=0;for(d=f.length;b<d;b++)if(f[b].scope?f[b].method.apply(f[b].scope,a):f[b].method.apply(this,a),!h)f[b].fired=!0}return!0};A=function(){i.setTimeout(function(){c.useFlashBlock&&ha();z();c.onload instanceof
+Function&&c.onload.apply(i);c.waitForWindowLoad&&k.add(i,"load",A)},1)};X=function(){if(p!==void 0)return p;var b=!1,a=navigator,c=a.plugins,f,d=i.ActiveXObject;if(c&&c.length)(a=a.mimeTypes)&&a["application/x-shockwave-flash"]&&a["application/x-shockwave-flash"].enabledPlugin&&a["application/x-shockwave-flash"].enabledPlugin.description&&(b=!0);else if(typeof d!=="undefined"){try{f=new d("ShockwaveFlash.ShockwaveFlash")}catch(h){}b=!!f}return p=b};ya=function(){var b,a;if(ma&&o.match(/os (1|2|3_0|3_1)/i)){c.hasHTML5=
+!1;c.html5Only=!0;if(c.oMC)c.oMC.style.display="none";return!1}if(c.useHTML5Audio){if(!c.html5||!c.html5.canPlayType)return c.hasHTML5=!1,!0;else c.hasHTML5=!0;if(na&&X())return!0}else return!0;for(a in c.audioFormats)if(c.audioFormats.hasOwnProperty(a)&&(c.audioFormats[a].required&&!c.html5.canPlayType(c.audioFormats[a].type)||c.flash[a]||c.flash[c.audioFormats[a].type]))b=!0;c.ignoreFlash&&(b=!1);c.html5Only=c.hasHTML5&&c.useHTML5Audio&&!b;return!c.html5Only};wa=function(b){if(!b._hasTimer)b._hasTimer=
+!0};xa=function(b){if(b._hasTimer)b._hasTimer=!1};C=function(b){b=typeof b!=="undefined"?b:{};c.onerror instanceof Function&&c.onerror.apply(i,[{type:typeof b.type!=="undefined"?b.type:null}]);typeof b.fatal!=="undefined"&&b.fatal&&c.disable()};Aa=function(){if(!na||!X())return!1;var b=c.audioFormats,a,e;for(e in b)if(b.hasOwnProperty(e)&&(e==="mp3"||e==="mp4"))if(c.html5[e]=!1,b[e]&&b[e].related)for(a=b[e].related.length;a--;)c.html5[b[e].related[a]]=!1};this._setSandboxType=function(){};this._externalInterfaceOK=
+function(){if(c.swfLoaded)return!1;(new Date).getTime();c.swfLoaded=!0;E=!1;na&&Aa();v?setTimeout(O,100):O()};R=function(b,a){function e(a,b){return'<param name="'+a+'" value="'+b+'" />'}if(F&&G)return!1;if(c.html5Only)return ca(),c.oMC=N(c.movieID),O(),G=F=!0,!1;var f=a||c.url,d=c.altURL||f,g;g=ea();var i,l,j=D(),k,m=null,m=(m=h.getElementsByTagName("html")[0])&&m.dir&&m.dir.match(/rtl/i),b=typeof b==="undefined"?c.id:b;ca();c.url=va(pa?f:d);a=c.url;c.wmode=!c.wmode&&c.useHighPerformance?"transparent":
+c.wmode;if(c.wmode!==null&&(o.match(/msie 8/i)||!v&&!c.useHighPerformance)&&navigator.platform.match(/win32|win64/i))c.specialWmodeCase=!0,c.wmode=null;g={name:b,id:b,src:a,width:"auto",height:"auto",quality:"high",allowScriptAccess:c.allowScriptAccess,bgcolor:c.bgColor,pluginspage:Ea+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:c.wmode,hasPriority:"true"};if(c.debugFlash)g.FlashVars="debug=1";c.wmode||delete g.wmode;
+if(v)f=h.createElement("div"),l=['<object id="'+b+'" data="'+a+'" type="'+g.type+'" title="'+g.title+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+Ea+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="'+g.width+'" height="'+g.height+'">',e("movie",a),e("AllowScriptAccess",c.allowScriptAccess),e("quality",g.quality),c.wmode?e("wmode",c.wmode):"",e("bgcolor",c.bgColor),e("hasPriority","true"),c.debugFlash?e("FlashVars",g.FlashVars):"","</object>"].join("");
+else for(i in f=h.createElement("embed"),g)g.hasOwnProperty(i)&&f.setAttribute(i,g[i]);fa();j=D();if(g=ea())if(c.oMC=N(c.movieID)||h.createElement("div"),c.oMC.id){k=c.oMC.className;c.oMC.className=(k?k+" ":c.swfCSS.swfDefault)+(j?" "+j:"");c.oMC.appendChild(f);if(v)i=c.oMC.appendChild(h.createElement("div")),i.className=c.swfCSS.swfBox,i.innerHTML=l;G=!0}else{c.oMC.id=c.movieID;c.oMC.className=c.swfCSS.swfDefault+" "+j;i=j=null;if(!c.useFlashBlock)if(c.useHighPerformance)j={position:"fixed",width:"8px",
+height:"8px",bottom:"0px",left:"0px",overflow:"hidden"};else if(j={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},m)j.left=Math.abs(parseInt(j.left,10))+"px";if(Ja)c.oMC.style.zIndex=1E4;if(!c.debugFlash)for(k in j)j.hasOwnProperty(k)&&(c.oMC.style[k]=j[k]);try{v||c.oMC.appendChild(f);g.appendChild(c.oMC);if(v)i=c.oMC.appendChild(h.createElement("div")),i.className=c.swfCSS.swfBox,i.innerHTML=l;G=!0}catch(n){throw Error(y("domError")+" \n"+n.toString());}}return F=!0};
+Q=function(){if(c.html5Only)return R(),!1;if(c.o)return!1;c.o=c.getMovie(c.id);if(!c.o)I?(v?c.oMC.innerHTML=ga:c.oMC.appendChild(I),I=null,F=!0):R(c.id,c.url),c.o=c.getMovie(c.id);c.oninitmovie instanceof Function&&setTimeout(c.oninitmovie,1);return!0};P=function(){setTimeout(sa,1E3)};sa=function(){if(V)return!1;V=!0;k.remove(i,"load",P);if(E&&!oa)return!1;var b;m||(b=c.getMoviePercent());setTimeout(function(){b=c.getMoviePercent();!m&&Ca&&(b===null?c.useFlashBlock||c.flashLoadTimeout===0?c.useFlashBlock&&
+ha():S(!0):c.flashLoadTimeout!==0&&S(!0))},c.flashLoadTimeout)};x=function(){function b(){k.remove(i,"focus",x);k.remove(i,"load",x)}if(oa||!E)return b(),!0;oa=Ca=!0;L&&E&&k.remove(i,"mousemove",x);V=!1;b();return!0};Ba=function(){var b,a=[];if(c.useHTML5Audio&&c.hasHTML5)for(b in c.audioFormats)c.audioFormats.hasOwnProperty(b)&&a.push(b+": "+c.html5[b]+(!c.html5[b]&&p&&c.flash[b]?" (using flash)":c.preferFlash&&c.flash[b]&&p?" (preferring flash)":!c.html5[b]?" ("+(c.audioFormats[b].required?"required, ":
+"")+"and no flash support)":""))};H=function(b){if(m)return!1;if(c.html5Only)return m=!0,A(),!0;var a;if(!c.useFlashBlock||!c.flashLoadTimeout||c.getMoviePercent())m=!0,t&&(a={type:!p&&q?"NO_FLASH":"INIT_TIMEOUT"});if(t||b){if(c.useFlashBlock&&c.oMC)c.oMC.className=D()+" "+(c.getMoviePercent()===null?c.swfCSS.swfTimedout:c.swfCSS.swfError);z({type:"ontimeout",error:a});C(a);return!1}if(c.waitForWindowLoad&&!ra)return k.add(i,"load",A),!1;else A();return!0};O=function(){if(m)return!1;if(c.html5Only){if(!m)k.remove(i,
+"load",c.beginDelayedInit),c.enabled=!0,H();return!0}Q();try{c.o._externalInterfaceTest(!1),ta(!0,c.flashPollingInterval||(c.useHighPerformance?10:50)),c.debugMode||c.o._disableDebug(),c.enabled=!0,c.html5Only||k.add(i,"unload",aa)}catch(b){return C({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),S(!0),H(),!1}H();k.remove(i,"load",c.beginDelayedInit);return!0};B=function(){if(da)return!1;da=!0;fa();if(!p&&c.hasHTML5)c.useHTML5Audio=!0,c.preferFlash=!1;za();c.html5.usingFlash=ya();q=c.html5.usingFlash;Ba();
+if(!p&&q)c.flashLoadTimeout=1;h.removeEventListener&&h.removeEventListener("DOMContentLoaded",B,!1);Q();return!0};la=function(){h.readyState==="complete"&&(B(),h.detachEvent("onreadystatechange",la));return!0};X();k.add(i,"focus",x);k.add(i,"load",x);k.add(i,"load",P);L&&E&&k.add(i,"mousemove",x);h.addEventListener?h.addEventListener("DOMContentLoaded",B,!1):h.attachEvent?h.attachEvent("onreadystatechange",la):C({type:"NO_DOM2_EVENTS",fatal:!0});h.readyState==="complete"&&setTimeout(B,100)}var Y=
+null;if(typeof SM2_DEFER==="undefined"||!SM2_DEFER)Y=new M;Z.SoundManager=M;Z.soundManager=Y})(window);
\ No newline at end of file
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/script/soundmanager2-nodebug.js b/fantasmixDjango/django_project/audiofield/static/audiofield/script/soundmanager2-nodebug.js
new file mode 100755
index 0000000000000000000000000000000000000000..10bb20c6396beb04bbe1ccdec5b785e5737648a0
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/static/audiofield/script/soundmanager2-nodebug.js
@@ -0,0 +1,2162 @@
+/** @license
+ *
+ * SoundManager 2: JavaScript Sound for the Web
+ * ----------------------------------------------
+ * http://schillmania.com/projects/soundmanager2/
+ *
+ * Copyright (c) 2007, Scott Schiller. All rights reserved.
+ * Code provided under the BSD License:
+ * http://schillmania.com/projects/soundmanager2/license.txt
+ *
+ * V2.97a.20110918
+ */
+
+/*global window, SM2_DEFER, sm2Debugger, console, document, navigator, setTimeout, setInterval, clearInterval, Audio */
+/* jslint regexp: true, sloppy: true, white: true, nomen: true, plusplus: true */
+
+(function(window) {
+var soundManager = null;
+function SoundManager(smURL, smID) {
+ this.flashVersion = 8;
+ this.debugMode = false;
+ this.debugFlash = false;
+ this.useConsole = true;
+ this.consoleOnly = false;
+ this.waitForWindowLoad = false;
+ this.bgColor = '#ffffff';
+ this.useHighPerformance = false;
+ this.flashPollingInterval = null;
+ this.flashLoadTimeout = 1000;
+ this.wmode = null;
+ this.allowScriptAccess = 'always';
+ this.useFlashBlock = false;
+ this.useHTML5Audio = true;
+ this.html5Test = /^(probably|maybe)$/i;
+ this.preferFlash = true;
+ this.audioFormats = {
+ 'mp3': {
+ 'type': ['audio/mpeg; codecs="mp3"', 'audio/mpeg', 'audio/mp3', 'audio/MPA', 'audio/mpa-robust'],
+ 'required': true
+ },
+ 'mp4': {
+ 'related': ['aac','m4a'],
+ 'type': ['audio/mp4; codecs="mp4a.40.2"', 'audio/aac', 'audio/x-m4a', 'audio/MP4A-LATM', 'audio/mpeg4-generic'],
+ 'required': false
+ },
+ 'ogg': {
+ 'type': ['audio/ogg; codecs=vorbis'],
+ 'required': false
+ },
+ 'wav': {
+ 'type': ['audio/wav; codecs="1"', 'audio/wav', 'audio/wave', 'audio/x-wav'],
+ 'required': false
+ }
+ };
+ this.defaultOptions = {
+ 'autoLoad': false,
+ 'stream': true,
+ 'autoPlay': false,
+ 'loops': 1,
+ 'onid3': null,
+ 'onload': null,
+ 'whileloading': null,
+ 'onplay': null,
+ 'onpause': null,
+ 'onresume': null,
+ 'whileplaying': null,
+ 'onstop': null,
+ 'onfailure': null,
+ 'onfinish': null,
+ 'multiShot': true,
+ 'multiShotEvents': false,
+ 'position': null,
+ 'pan': 0,
+ 'type': null,
+ 'usePolicyFile': false,
+ 'volume': 100
+ };
+ this.flash9Options = {
+ 'isMovieStar': null,
+ 'usePeakData': false,
+ 'useWaveformData': false,
+ 'useEQData': false,
+ 'onbufferchange': null,
+ 'ondataerror': null
+ };
+ this.movieStarOptions = {
+ 'bufferTime': 3,
+ 'serverURL': null,
+ 'onconnect': null,
+ 'duration': null
+ };
+ this.movieID = 'sm2-container';
+ this.id = (smID || 'sm2movie');
+ this.swfCSS = {
+ 'swfBox': 'sm2-object-box',
+ 'swfDefault': 'movieContainer',
+ 'swfError': 'swf_error',
+ 'swfTimedout': 'swf_timedout',
+ 'swfLoaded': 'swf_loaded',
+ 'swfUnblocked': 'swf_unblocked',
+ 'sm2Debug': 'sm2_debug',
+ 'highPerf': 'high_performance',
+ 'flashDebug': 'flash_debug'
+ };
+ this.debugID = 'soundmanager-debug';
+ this.debugURLParam = /([#?&])debug=1/i;
+ this.versionNumber = 'V2.97a.20110918';
+ this.version = null;
+ this.movieURL = null;
+ this.url = (smURL || null);
+ this.altURL = null;
+ this.swfLoaded = false;
+ this.enabled = false;
+ this.o = null;
+ this.oMC = null;
+ this.sounds = {};
+ this.soundIDs = [];
+ this.muted = false;
+ this.specialWmodeCase = false;
+ this.didFlashBlock = false;
+ this.filePattern = null;
+ this.filePatterns = {
+ 'flash8': /\.mp3(\?.*)?$/i,
+ 'flash9': /\.mp3(\?.*)?$/i
+ };
+ this.features = {
+ 'buffering': false,
+ 'peakData': false,
+ 'waveformData': false,
+ 'eqData': false,
+ 'movieStar': false
+ };
+ this.sandbox = {
+ };
+ this.hasHTML5 = (typeof Audio !== 'undefined' && typeof new Audio().canPlayType !== 'undefined');
+ this.html5 = {
+ 'usingFlash': null
+ };
+ this.flash = {};
+ this.html5Only = false;
+ this.ignoreFlash = false;
+ var SMSound,
+ _s = this, _sm = 'soundManager', _smc = _sm+'::', _h5 = 'HTML5::', _id, _ua = navigator.userAgent, _win = window, _wl = _win.location.href.toString(), _doc = document, _doNothing, _init, _fV, _on_queue = [], _debugOpen = true, _debugTS, _didAppend = false, _appendSuccess = false, _didInit = false, _disabled = false, _windowLoaded = false, _wDS, _wdCount = 0, _initComplete, _mixin, _addOnEvent, _processOnEvents, _initUserOnload, _delayWaitForEI, _waitForEI, _setVersionInfo, _handleFocus, _strings, _initMovie, _domContentLoaded, _didDCLoaded, _getDocument, _createMovie, _catchError, _setPolling, _initDebug, _debugLevels = ['log', 'info', 'warn', 'error'], _defaultFlashVersion = 8, _disableObject, _failSafely, _normalizeMovieURL, _oRemoved = null, _oRemovedHTML = null, _str, _flashBlockHandler, _getSWFCSS, _toggleDebug, _loopFix, _policyFix, _complain, _idCheck, _waitingForEI = false, _initPending = false, _smTimer, _onTimer, _startTimer, _stopTimer, _needsFlash = null, _featureCheck, _html5OK, _html5CanPlay, _html5Ext, _html5Unload, _domContentLoadedIE, _testHTML5, _event, _slice = Array.prototype.slice, _useGlobalHTML5Audio = false, _hasFlash, _detectFlash, _badSafariFix, _html5_events, _showSupport,
+ _is_iDevice = _ua.match(/(ipad|iphone|ipod)/i), _likesHTML5 = (_ua.match(/(mobile|pre\/|xoom)/i) || _is_iDevice), _isIE = _ua.match(/msie/i), _isWebkit = _ua.match(/webkit/i), _isSafari = (_ua.match(/safari/i) && !_ua.match(/chrome/i)), _isOpera = (_ua.match(/opera/i)),
+ _isBadSafari = (!_wl.match(/usehtml5audio/i) && !_wl.match(/sm2\-ignorebadua/i) && _isSafari && _ua.match(/OS X 10_6_([3-7])/i)),
+ _hasConsole = (typeof console !== 'undefined' && typeof console.log !== 'undefined'), _isFocused = (typeof _doc.hasFocus !== 'undefined'?_doc.hasFocus():null), _tryInitOnFocus = (_isSafari && typeof _doc.hasFocus === 'undefined'), _okToDisable = !_tryInitOnFocus, _flashMIME = /(mp3|mp4|mpa)/i,
+ _emptyURL = 'about:blank',
+ _overHTTP = (_doc.location?_doc.location.protocol.match(/http/i):null),
+ _http = (!_overHTTP ? 'http:/'+'/' : ''),
+ _netStreamMimeTypes = /^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|mp4v|3gp|3g2)\s*(?:$|;)/i,
+ _netStreamTypes = ['mpeg4', 'aac', 'flv', 'mov', 'mp4', 'm4v', 'f4v', 'm4a', 'mp4v', '3gp', '3g2'],
+ _netStreamPattern = new RegExp('\\.(' + _netStreamTypes.join('|') + ')(\\?.*)?$', 'i');
+ this.mimePattern = /^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i;
+ this.useAltURL = !_overHTTP;
+ this._global_a = null;
+ if (_likesHTML5) {
+ _s.useHTML5Audio = true;
+ _s.preferFlash = false;
+ if (_is_iDevice) {
+ _s.ignoreFlash = true;
+ _useGlobalHTML5Audio = true;
+ }
+ }
+ this.ok = function() {
+ return (_needsFlash?(_didInit && !_disabled):(_s.useHTML5Audio && _s.hasHTML5));
+ };
+ this.supported = this.ok;
+ this.getMovie = function(smID) {
+ return _id(smID) || _doc[smID] || _win[smID];
+ };
+ this.createSound = function(oOptions) {
+ var _cs = _sm+'.createSound(): ',
+ thisOptions = null, oSound = null, _tO = null;
+ if (!_didInit || !_s.ok()) {
+ _complain(_cs + _str(!_didInit?'notReady':'notOK'));
+ return false;
+ }
+ if (arguments.length === 2) {
+ oOptions = {
+ 'id': arguments[0],
+ 'url': arguments[1]
+ };
+ }
+ thisOptions = _mixin(oOptions);
+ _tO = thisOptions;
+ if (_idCheck(_tO.id, true)) {
+ return _s.sounds[_tO.id];
+ }
+ function make() {
+ thisOptions = _loopFix(thisOptions);
+ _s.sounds[_tO.id] = new SMSound(_tO);
+ _s.soundIDs.push(_tO.id);
+ return _s.sounds[_tO.id];
+ }
+ if (_html5OK(_tO)) {
+ oSound = make();
+ oSound._setup_html5(_tO);
+ } else {
+ if (_fV > 8) {
+ if (_tO.isMovieStar === null) {
+ _tO.isMovieStar = (_tO.serverURL || (_tO.type ? _tO.type.match(_netStreamMimeTypes) : false) || _tO.url.match(_netStreamPattern));
+ }
+ if (_tO.isMovieStar) {
+ if (_tO.usePeakData) {
+ _tO.usePeakData = false;
+ }
+ }
+ }
+ _tO = _policyFix(_tO, _cs);
+ oSound = make();
+ if (_fV === 8) {
+ _s.o._createSound(_tO.id, _tO.loops||1, _tO.usePolicyFile);
+ } else {
+ _s.o._createSound(_tO.id, _tO.url, _tO.usePeakData, _tO.useWaveformData, _tO.useEQData, _tO.isMovieStar, (_tO.isMovieStar?_tO.bufferTime:false), _tO.loops||1, _tO.serverURL, _tO.duration||null, _tO.autoPlay, true, _tO.autoLoad, _tO.usePolicyFile);
+ if (!_tO.serverURL) {
+ oSound.connected = true;
+ if (_tO.onconnect) {
+ _tO.onconnect.apply(oSound);
+ }
+ }
+ }
+ if (!_tO.serverURL && (_tO.autoLoad || _tO.autoPlay)) {
+ oSound.load(_tO);
+ }
+ }
+ if (!_tO.serverURL && _tO.autoPlay) {
+ oSound.play();
+ }
+ return oSound;
+ };
+ this.destroySound = function(sID, _bFromSound) {
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ var oS = _s.sounds[sID], i;
+ oS._iO = {};
+ oS.stop();
+ oS.unload();
+ for (i = 0; i < _s.soundIDs.length; i++) {
+ if (_s.soundIDs[i] === sID) {
+ _s.soundIDs.splice(i, 1);
+ break;
+ }
+ }
+ if (!_bFromSound) {
+ oS.destruct(true);
+ }
+ oS = null;
+ delete _s.sounds[sID];
+ return true;
+ };
+ this.load = function(sID, oOptions) {
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ return _s.sounds[sID].load(oOptions);
+ };
+ this.unload = function(sID) {
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ return _s.sounds[sID].unload();
+ };
+ this.onposition = function(sID, nPosition, oMethod, oScope) {
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ return _s.sounds[sID].onposition(nPosition, oMethod, oScope);
+ };
+ this.play = function(sID, oOptions) {
+ var fN = _sm+'.play(): ';
+ if (!_didInit || !_s.ok()) {
+ _complain(fN + _str(!_didInit?'notReady':'notOK'));
+ return false;
+ }
+ if (!_idCheck(sID)) {
+ if (!(oOptions instanceof Object)) {
+ oOptions = {
+ url: oOptions
+ };
+ }
+ if (oOptions && oOptions.url) {
+ oOptions.id = sID;
+ return _s.createSound(oOptions).play();
+ } else {
+ return false;
+ }
+ }
+ return _s.sounds[sID].play(oOptions);
+ };
+ this.start = this.play;
+ this.setPosition = function(sID, nMsecOffset) {
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ return _s.sounds[sID].setPosition(nMsecOffset);
+ };
+ this.stop = function(sID) {
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ return _s.sounds[sID].stop();
+ };
+ this.stopAll = function() {
+ var oSound;
+ for (oSound in _s.sounds) {
+ if (_s.sounds.hasOwnProperty(oSound)) {
+ _s.sounds[oSound].stop();
+ }
+ }
+ };
+ this.pause = function(sID) {
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ return _s.sounds[sID].pause();
+ };
+ this.pauseAll = function() {
+ var i;
+ for (i = _s.soundIDs.length; i--;) {
+ _s.sounds[_s.soundIDs[i]].pause();
+ }
+ };
+ this.resume = function(sID) {
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ return _s.sounds[sID].resume();
+ };
+ this.resumeAll = function() {
+ var i;
+ for (i = _s.soundIDs.length; i--;) {
+ _s.sounds[_s.soundIDs[i]].resume();
+ }
+ };
+ this.togglePause = function(sID) {
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ return _s.sounds[sID].togglePause();
+ };
+ this.setPan = function(sID, nPan) {
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ return _s.sounds[sID].setPan(nPan);
+ };
+ this.setVolume = function(sID, nVol) {
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ return _s.sounds[sID].setVolume(nVol);
+ };
+ this.mute = function(sID) {
+ var fN = _sm+'.mute(): ',
+ i = 0;
+ if (typeof sID !== 'string') {
+ sID = null;
+ }
+ if (!sID) {
+ for (i = _s.soundIDs.length; i--;) {
+ _s.sounds[_s.soundIDs[i]].mute();
+ }
+ _s.muted = true;
+ } else {
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ return _s.sounds[sID].mute();
+ }
+ return true;
+ };
+ this.muteAll = function() {
+ _s.mute();
+ };
+ this.unmute = function(sID) {
+ var fN = _sm+'.unmute(): ', i;
+ if (typeof sID !== 'string') {
+ sID = null;
+ }
+ if (!sID) {
+ for (i = _s.soundIDs.length; i--;) {
+ _s.sounds[_s.soundIDs[i]].unmute();
+ }
+ _s.muted = false;
+ } else {
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ return _s.sounds[sID].unmute();
+ }
+ return true;
+ };
+ this.unmuteAll = function() {
+ _s.unmute();
+ };
+ this.toggleMute = function(sID) {
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ return _s.sounds[sID].toggleMute();
+ };
+ this.getMemoryUse = function() {
+ var ram = 0;
+ if (_s.o && _fV !== 8) {
+ ram = parseInt(_s.o._getMemoryUse(), 10);
+ }
+ return ram;
+ };
+ this.disable = function(bNoDisable) {
+ var i;
+ if (typeof bNoDisable === 'undefined') {
+ bNoDisable = false;
+ }
+ if (_disabled) {
+ return false;
+ }
+ _disabled = true;
+ for (i = _s.soundIDs.length; i--;) {
+ _disableObject(_s.sounds[_s.soundIDs[i]]);
+ }
+ _initComplete(bNoDisable);
+ _event.remove(_win, 'load', _initUserOnload);
+ return true;
+ };
+ this.canPlayMIME = function(sMIME) {
+ var result;
+ if (_s.hasHTML5) {
+ result = _html5CanPlay({type:sMIME});
+ }
+ if (!_needsFlash || result) {
+ return result;
+ } else {
+ return (sMIME ? !!((_fV > 8 ? sMIME.match(_netStreamMimeTypes) : null) || sMIME.match(_s.mimePattern)) : null);
+ }
+ };
+ this.canPlayURL = function(sURL) {
+ var result;
+ if (_s.hasHTML5) {
+ result = _html5CanPlay({url: sURL});
+ }
+ if (!_needsFlash || result) {
+ return result;
+ } else {
+ return (sURL ? !!(sURL.match(_s.filePattern)) : null);
+ }
+ };
+ this.canPlayLink = function(oLink) {
+ if (typeof oLink.type !== 'undefined' && oLink.type) {
+ if (_s.canPlayMIME(oLink.type)) {
+ return true;
+ }
+ }
+ return _s.canPlayURL(oLink.href);
+ };
+ this.getSoundById = function(sID, _suppressDebug) {
+ if (!sID) {
+ throw new Error(_sm+'.getSoundById(): sID is null/undefined');
+ }
+ var result = _s.sounds[sID];
+ return result;
+ };
+ this.onready = function(oMethod, oScope) {
+ var sType = 'onready';
+ if (oMethod && oMethod instanceof Function) {
+ if (!oScope) {
+ oScope = _win;
+ }
+ _addOnEvent(sType, oMethod, oScope);
+ _processOnEvents();
+ return true;
+ } else {
+ throw _str('needFunction', sType);
+ }
+ };
+ this.ontimeout = function(oMethod, oScope) {
+ var sType = 'ontimeout';
+ if (oMethod && oMethod instanceof Function) {
+ if (!oScope) {
+ oScope = _win;
+ }
+ _addOnEvent(sType, oMethod, oScope);
+ _processOnEvents({type:sType});
+ return true;
+ } else {
+ throw _str('needFunction', sType);
+ }
+ };
+ this._writeDebug = function(sText, sType, _bTimestamp) {
+ return true;
+ };
+ this._wD = this._writeDebug;
+ this._debug = function() {
+ };
+ this.reboot = function() {
+ var i, j;
+ for (i = _s.soundIDs.length; i--;) {
+ _s.sounds[_s.soundIDs[i]].destruct();
+ }
+ try {
+ if (_isIE) {
+ _oRemovedHTML = _s.o.innerHTML;
+ }
+ _oRemoved = _s.o.parentNode.removeChild(_s.o);
+ } catch(e) {
+ }
+ _oRemovedHTML = _oRemoved = _needsFlash = null;
+ _s.enabled = _didDCLoaded = _didInit = _waitingForEI = _initPending = _didAppend = _appendSuccess = _disabled = _s.swfLoaded = false;
+ _s.soundIDs = _s.sounds = [];
+ _s.o = null;
+ for (i in _on_queue) {
+ if (_on_queue.hasOwnProperty(i)) {
+ for (j = _on_queue[i].length; j--;) {
+ _on_queue[i][j].fired = false;
+ }
+ }
+ }
+ _win.setTimeout(_s.beginDelayedInit, 20);
+ };
+ this.getMoviePercent = function() {
+ return (_s.o && typeof _s.o.PercentLoaded !== 'undefined' ? _s.o.PercentLoaded() : null);
+ };
+ this.beginDelayedInit = function() {
+ _windowLoaded = true;
+ _domContentLoaded();
+ setTimeout(function() {
+ if (_initPending) {
+ return false;
+ }
+ _createMovie();
+ _initMovie();
+ _initPending = true;
+ return true;
+ }, 20);
+ _delayWaitForEI();
+ };
+ this.destruct = function() {
+ _s.disable(true);
+ };
+ SMSound = function(oOptions) {
+ var _t = this, _resetProperties, _stop_html5_timer, _start_html5_timer;
+ this.sID = oOptions.id;
+ this.url = oOptions.url;
+ this.options = _mixin(oOptions);
+ this.instanceOptions = this.options;
+ this._iO = this.instanceOptions;
+ this.pan = this.options.pan;
+ this.volume = this.options.volume;
+ this._lastURL = null;
+ this.isHTML5 = false;
+ this._a = null;
+ this.id3 = {};
+ this._debug = function() {
+ };
+ this.load = function(oOptions) {
+ var oS = null;
+ if (typeof oOptions !== 'undefined') {
+ _t._iO = _mixin(oOptions, _t.options);
+ _t.instanceOptions = _t._iO;
+ } else {
+ oOptions = _t.options;
+ _t._iO = oOptions;
+ _t.instanceOptions = _t._iO;
+ if (_t._lastURL && _t._lastURL !== _t.url) {
+ _t._iO.url = _t.url;
+ _t.url = null;
+ }
+ }
+ if (!_t._iO.url) {
+ _t._iO.url = _t.url;
+ }
+ if (_t._iO.url === _t.url && _t.readyState !== 0 && _t.readyState !== 2) {
+ return _t;
+ }
+ _t._lastURL = _t.url;
+ _t.loaded = false;
+ _t.readyState = 1;
+ _t.playState = 0;
+ if (_html5OK(_t._iO)) {
+ oS = _t._setup_html5(_t._iO);
+ if (!oS._called_load) {
+ _t._html5_canplay = false;
+ oS.load();
+ oS._called_load = true;
+ if (_t._iO.autoPlay) {
+ _t.play();
+ }
+ } else {
+ }
+ } else {
+ try {
+ _t.isHTML5 = false;
+ _t._iO = _policyFix(_loopFix(_t._iO));
+ if (_fV === 8) {
+ _s.o._load(_t.sID, _t._iO.url, _t._iO.stream, _t._iO.autoPlay, (_t._iO.whileloading?1:0), _t._iO.loops||1, _t._iO.usePolicyFile);
+ } else {
+ _s.o._load(_t.sID, _t._iO.url, !!(_t._iO.stream), !!(_t._iO.autoPlay), _t._iO.loops||1, !!(_t._iO.autoLoad), _t._iO.usePolicyFile);
+ }
+ } catch(e) {
+ _catchError({type:'SMSOUND_LOAD_JS_EXCEPTION', fatal:true});
+ }
+ }
+ return _t;
+ };
+ this.unload = function() {
+ if (_t.readyState !== 0) {
+ if (!_t.isHTML5) {
+ if (_fV === 8) {
+ _s.o._unload(_t.sID, _emptyURL);
+ } else {
+ _s.o._unload(_t.sID);
+ }
+ } else {
+ _stop_html5_timer();
+ if (_t._a) {
+ _t._a.pause();
+ _html5Unload(_t._a);
+ }
+ }
+ _resetProperties();
+ }
+ return _t;
+ };
+ this.destruct = function(_bFromSM) {
+ if (!_t.isHTML5) {
+ _t._iO.onfailure = null;
+ _s.o._destroySound(_t.sID);
+ } else {
+ _stop_html5_timer();
+ if (_t._a) {
+ _t._a.pause();
+ _html5Unload(_t._a);
+ if (!_useGlobalHTML5Audio) {
+ _t._remove_html5_events();
+ }
+ _t._a._t = null;
+ _t._a = null;
+ }
+ }
+ if (!_bFromSM) {
+ _s.destroySound(_t.sID, true);
+ }
+ };
+ this.play = function(oOptions, _updatePlayState) {
+ var fN = 'SMSound.play(): ', allowMulti, a;
+ _updatePlayState = _updatePlayState === undefined ? true : _updatePlayState;
+ if (!oOptions) {
+ oOptions = {};
+ }
+ _t._iO = _mixin(oOptions, _t._iO);
+ _t._iO = _mixin(_t._iO, _t.options);
+ _t.instanceOptions = _t._iO;
+ if (_t._iO.serverURL && !_t.connected) {
+ if (!_t.getAutoPlay()) {
+ _t.setAutoPlay(true);
+ }
+ return _t;
+ }
+ if (_html5OK(_t._iO)) {
+ _t._setup_html5(_t._iO);
+ _start_html5_timer();
+ }
+ if (_t.playState === 1 && !_t.paused) {
+ allowMulti = _t._iO.multiShot;
+ if (!allowMulti) {
+ return _t;
+ } else {
+ }
+ }
+ if (!_t.loaded) {
+ if (_t.readyState === 0) {
+ if (!_t.isHTML5) {
+ _t._iO.autoPlay = true;
+ }
+ _t.load(_t._iO);
+ } else if (_t.readyState === 2) {
+ return _t;
+ } else {
+ }
+ } else {
+ }
+ if (!_t.isHTML5 && _fV === 9 && _t.position > 0 && _t.position === _t.duration) {
+ _t._iO.position = 0;
+ }
+ if (_t.paused && _t.position && _t.position > 0) {
+ _t.resume();
+ } else {
+ _t.playState = 1;
+ _t.paused = false;
+ if (!_t.instanceCount || _t._iO.multiShotEvents || (!_t.isHTML5 && _fV > 8 && !_t.getAutoPlay())) {
+ _t.instanceCount++;
+ }
+ _t.position = (typeof _t._iO.position !== 'undefined' && !isNaN(_t._iO.position)?_t._iO.position:0);
+ if (!_t.isHTML5) {
+ _t._iO = _policyFix(_loopFix(_t._iO));
+ }
+ if (_t._iO.onplay && _updatePlayState) {
+ _t._iO.onplay.apply(_t);
+ _t._onplay_called = true;
+ }
+ _t.setVolume(_t._iO.volume, true);
+ _t.setPan(_t._iO.pan, true);
+ if (!_t.isHTML5) {
+ _s.o._start(_t.sID, _t._iO.loops || 1, (_fV === 9?_t._iO.position:_t._iO.position / 1000));
+ } else {
+ _start_html5_timer();
+ a = _t._setup_html5();
+ _t.setPosition(_t._iO.position);
+ a.play();
+ }
+ }
+ return _t;
+ };
+ this.start = this.play;
+ this.stop = function(bAll) {
+ if (_t.playState === 1) {
+ _t._onbufferchange(0);
+ _t.resetOnPosition(0);
+ _t.paused = false;
+ if (!_t.isHTML5) {
+ _t.playState = 0;
+ }
+ if (_t._iO.onstop) {
+ _t._iO.onstop.apply(_t);
+ }
+ if (!_t.isHTML5) {
+ _s.o._stop(_t.sID, bAll);
+ if (_t._iO.serverURL) {
+ _t.unload();
+ }
+ } else {
+ if (_t._a) {
+ _t.setPosition(0);
+ _t._a.pause();
+ _t.playState = 0;
+ _t._onTimer();
+ _stop_html5_timer();
+ }
+ }
+ _t.instanceCount = 0;
+ _t._iO = {};
+ }
+ return _t;
+ };
+ this.setAutoPlay = function(autoPlay) {
+ _t._iO.autoPlay = autoPlay;
+ if (!_t.isHTML5) {
+ _s.o._setAutoPlay(_t.sID, autoPlay);
+ if (autoPlay) {
+ if (!_t.instanceCount && _t.readyState === 1) {
+ _t.instanceCount++;
+ }
+ }
+ }
+ };
+ this.getAutoPlay = function() {
+ return _t._iO.autoPlay;
+ };
+ this.setPosition = function(nMsecOffset) {
+ if (nMsecOffset === undefined) {
+ nMsecOffset = 0;
+ }
+ var original_pos,
+ position, position1K,
+ offset = (_t.isHTML5 ? Math.max(nMsecOffset,0) : Math.min(_t.duration || _t._iO.duration, Math.max(nMsecOffset, 0)));
+ original_pos = _t.position;
+ _t.position = offset;
+ position1K = _t.position/1000;
+ _t.resetOnPosition(_t.position);
+ _t._iO.position = offset;
+ if (!_t.isHTML5) {
+ position = (_fV === 9 ? _t.position : position1K);
+ if (_t.readyState && _t.readyState !== 2) {
+ _s.o._setPosition(_t.sID, position, (_t.paused || !_t.playState));
+ }
+ } else if (_t._a) {
+ if (_t._html5_canplay) {
+ if (_t._a.currentTime !== position1K) {
+ try {
+ _t._a.currentTime = position1K;
+ if (_t.playState === 0 || _t.paused) {
+ _t._a.pause();
+ }
+ } catch(e) {
+ }
+ }
+ } else {
+ }
+ }
+ if (_t.isHTML5) {
+ if (_t.paused) {
+ _t._onTimer(true);
+ }
+ }
+ return _t;
+ };
+ this.pause = function(_bCallFlash) {
+ if (_t.paused || (_t.playState === 0 && _t.readyState !== 1)) {
+ return _t;
+ }
+ _t.paused = true;
+ if (!_t.isHTML5) {
+ if (_bCallFlash || _bCallFlash === undefined) {
+ _s.o._pause(_t.sID);
+ }
+ } else {
+ _t._setup_html5().pause();
+ _stop_html5_timer();
+ }
+ if (_t._iO.onpause) {
+ _t._iO.onpause.apply(_t);
+ }
+ return _t;
+ };
+ this.resume = function() {
+ if (!_t.paused) {
+ return _t;
+ }
+ _t.paused = false;
+ _t.playState = 1;
+ if (!_t.isHTML5) {
+ if (_t._iO.isMovieStar) {
+ _t.setPosition(_t.position);
+ }
+ _s.o._pause(_t.sID);
+ } else {
+ _t._setup_html5().play();
+ _start_html5_timer();
+ }
+ if (!_t._onplay_called && _t._iO.onplay) {
+ _t._iO.onplay.apply(_t);
+ _t._onplay_called = true;
+ } else if (_t._iO.onresume) {
+ _t._iO.onresume.apply(_t);
+ }
+ return _t;
+ };
+ this.togglePause = function() {
+ if (_t.playState === 0) {
+ _t.play({
+ position: (_fV === 9 && !_t.isHTML5 ? _t.position : _t.position / 1000)
+ });
+ return _t;
+ }
+ if (_t.paused) {
+ _t.resume();
+ } else {
+ _t.pause();
+ }
+ return _t;
+ };
+ this.setPan = function(nPan, bInstanceOnly) {
+ if (typeof nPan === 'undefined') {
+ nPan = 0;
+ }
+ if (typeof bInstanceOnly === 'undefined') {
+ bInstanceOnly = false;
+ }
+ if (!_t.isHTML5) {
+ _s.o._setPan(_t.sID, nPan);
+ }
+ _t._iO.pan = nPan;
+ if (!bInstanceOnly) {
+ _t.pan = nPan;
+ _t.options.pan = nPan;
+ }
+ return _t;
+ };
+ this.setVolume = function(nVol, _bInstanceOnly) {
+ if (typeof nVol === 'undefined') {
+ nVol = 100;
+ }
+ if (typeof _bInstanceOnly === 'undefined') {
+ _bInstanceOnly = false;
+ }
+ if (!_t.isHTML5) {
+ _s.o._setVolume(_t.sID, (_s.muted && !_t.muted) || _t.muted?0:nVol);
+ } else if (_t._a) {
+ _t._a.volume = Math.max(0, Math.min(1, nVol/100));
+ }
+ _t._iO.volume = nVol;
+ if (!_bInstanceOnly) {
+ _t.volume = nVol;
+ _t.options.volume = nVol;
+ }
+ return _t;
+ };
+ this.mute = function() {
+ _t.muted = true;
+ if (!_t.isHTML5) {
+ _s.o._setVolume(_t.sID, 0);
+ } else if (_t._a) {
+ _t._a.muted = true;
+ }
+ return _t;
+ };
+ this.unmute = function() {
+ _t.muted = false;
+ var hasIO = typeof _t._iO.volume !== 'undefined';
+ if (!_t.isHTML5) {
+ _s.o._setVolume(_t.sID, hasIO?_t._iO.volume:_t.options.volume);
+ } else if (_t._a) {
+ _t._a.muted = false;
+ }
+ return _t;
+ };
+ this.toggleMute = function() {
+ return (_t.muted?_t.unmute():_t.mute());
+ };
+ this.onposition = function(nPosition, oMethod, oScope) {
+ _t._onPositionItems.push({
+ position: nPosition,
+ method: oMethod,
+ scope: (typeof oScope !== 'undefined'?oScope:_t),
+ fired: false
+ });
+ return _t;
+ };
+ this.processOnPosition = function() {
+ var i, item, j = _t._onPositionItems.length;
+ if (!j || !_t.playState || _t._onPositionFired >= j) {
+ return false;
+ }
+ for (i=j; i--;) {
+ item = _t._onPositionItems[i];
+ if (!item.fired && _t.position >= item.position) {
+ item.fired = true;
+ _s._onPositionFired++;
+ item.method.apply(item.scope,[item.position]);
+ }
+ }
+ return true;
+ };
+ this.resetOnPosition = function(nPosition) {
+ var i, item, j = _t._onPositionItems.length;
+ if (!j) {
+ return false;
+ }
+ for (i=j; i--;) {
+ item = _t._onPositionItems[i];
+ if (item.fired && nPosition <= item.position) {
+ item.fired = false;
+ _s._onPositionFired--;
+ }
+ }
+ return true;
+ };
+ _start_html5_timer = function() {
+ if (_t.isHTML5) {
+ _startTimer(_t);
+ }
+ };
+ _stop_html5_timer = function() {
+ if (_t.isHTML5) {
+ _stopTimer(_t);
+ }
+ };
+ _resetProperties = function() {
+ _t._onPositionItems = [];
+ _t._onPositionFired = 0;
+ _t._hasTimer = null;
+ _t._onplay_called = false;
+ _t._a = null;
+ _t._html5_canplay = false;
+ _t.bytesLoaded = null;
+ _t.bytesTotal = null;
+ _t.position = null;
+ _t.duration = (_t._iO && _t._iO.duration?_t._iO.duration:null);
+ _t.durationEstimate = null;
+ _t.failures = 0;
+ _t.loaded = false;
+ _t.playState = 0;
+ _t.paused = false;
+ _t.readyState = 0;
+ _t.muted = false;
+ _t.isBuffering = false;
+ _t.instanceOptions = {};
+ _t.instanceCount = 0;
+ _t.peakData = {
+ left: 0,
+ right: 0
+ };
+ _t.waveformData = {
+ left: [],
+ right: []
+ };
+ _t.eqData = [];
+ _t.eqData.left = [];
+ _t.eqData.right = [];
+ };
+ _resetProperties();
+ this._onTimer = function(bForce) {
+ var time, x = {};
+ if (_t._hasTimer || bForce) {
+ if (_t._a && (bForce || ((_t.playState > 0 || _t.readyState === 1) && !_t.paused))) {
+ _t.duration = _t._get_html5_duration();
+ _t.durationEstimate = _t.duration;
+ time = _t._a.currentTime?_t._a.currentTime*1000:0;
+ _t._whileplaying(time,x,x,x,x);
+ return true;
+ } else {
+ return false;
+ }
+ }
+ };
+ this._get_html5_duration = function() {
+ var d = (_t._a ? _t._a.duration*1000 : (_t._iO ? _t._iO.duration : undefined)),
+ result = (d && !isNaN(d) && d !== Infinity ? d : (_t._iO ? _t._iO.duration : null));
+ return result;
+ };
+ this._setup_html5 = function(oOptions) {
+ var _iO = _mixin(_t._iO, oOptions), d = decodeURI,
+ _a = _useGlobalHTML5Audio ? _s._global_a : _t._a,
+ _dURL = d(_iO.url),
+ _oldIO = (_a && _a._t ? _a._t.instanceOptions : null);
+ if (_a) {
+ if (_a._t && _oldIO.url === _iO.url && (!_t._lastURL || (_t._lastURL === _oldIO.url))) {
+ return _a;
+ }
+ if (_useGlobalHTML5Audio && _a._t && _a._t.playState && _iO.url !== _oldIO.url) {
+ _a._t.stop();
+ }
+ _resetProperties();
+ _a.src = _iO.url;
+ _t.url = _iO.url;
+ _t._lastURL = _iO.url;
+ _a._called_load = false;
+ } else {
+ _a = new Audio(_iO.url);
+ _a._called_load = false;
+ if (_useGlobalHTML5Audio) {
+ _s._global_a = _a;
+ }
+ }
+ _t.isHTML5 = true;
+ _t._a = _a;
+ _a._t = _t;
+ _t._add_html5_events();
+ _a.loop = (_iO.loops>1?'loop':'');
+ if (_iO.autoLoad || _iO.autoPlay) {
+ _a.autobuffer = 'auto';
+ _a.preload = 'auto';
+ _t.load();
+ _a._called_load = true;
+ } else {
+ _a.autobuffer = false;
+ _a.preload = 'none';
+ }
+ _a.loop = (_iO.loops>1?'loop':'');
+ return _a;
+ };
+ this._add_html5_events = function() {
+ if (_t._a._added_events) {
+ return false;
+ }
+ var f;
+ function add(oEvt, oFn, bCapture) {
+ return _t._a ? _t._a.addEventListener(oEvt, oFn, bCapture||false) : null;
+ }
+ _t._a._added_events = true;
+ for (f in _html5_events) {
+ if (_html5_events.hasOwnProperty(f)) {
+ add(f, _html5_events[f]);
+ }
+ }
+ return true;
+ };
+ this._remove_html5_events = function() {
+ var f;
+ function remove(oEvt, oFn, bCapture) {
+ return (_t._a ? _t._a.removeEventListener(oEvt, oFn, bCapture||false) : null);
+ }
+ _t._a._added_events = false;
+ for (f in _html5_events) {
+ if (_html5_events.hasOwnProperty(f)) {
+ remove(f, _html5_events[f]);
+ }
+ }
+ };
+ this._onload = function(nSuccess) {
+ var fN = 'SMSound._onload(): ', loadOK = !!(nSuccess);
+ _t.loaded = loadOK;
+ _t.readyState = loadOK?3:2;
+ _t._onbufferchange(0);
+ if (_t._iO.onload) {
+ _t._iO.onload.apply(_t, [loadOK]);
+ }
+ return true;
+ };
+ this._onbufferchange = function(nIsBuffering) {
+ var fN = 'SMSound._onbufferchange()';
+ if (_t.playState === 0) {
+ return false;
+ }
+ if ((nIsBuffering && _t.isBuffering) || (!nIsBuffering && !_t.isBuffering)) {
+ return false;
+ }
+ _t.isBuffering = (nIsBuffering === 1);
+ if (_t._iO.onbufferchange) {
+ _t._iO.onbufferchange.apply(_t);
+ }
+ return true;
+ };
+ this._onfailure = function(msg, level, code) {
+ _t.failures++;
+ if (_t._iO.onfailure && _t.failures === 1) {
+ _t._iO.onfailure(_t, msg, level, code);
+ } else {
+ }
+ };
+ this._onfinish = function() {
+ var _io_onfinish = _t._iO.onfinish;
+ _t._onbufferchange(0);
+ _t.resetOnPosition(0);
+ if (_t.instanceCount) {
+ _t.instanceCount--;
+ if (!_t.instanceCount) {
+ _t.playState = 0;
+ _t.paused = false;
+ _t.instanceCount = 0;
+ _t.instanceOptions = {};
+ _t._iO = {};
+ _stop_html5_timer();
+ }
+ if (!_t.instanceCount || _t._iO.multiShotEvents) {
+ if (_io_onfinish) {
+ _io_onfinish.apply(_t);
+ }
+ }
+ }
+ };
+ this._whileloading = function(nBytesLoaded, nBytesTotal, nDuration, nBufferLength) {
+ _t.bytesLoaded = nBytesLoaded;
+ _t.bytesTotal = nBytesTotal;
+ _t.duration = Math.floor(nDuration);
+ _t.bufferLength = nBufferLength;
+ if (!_t._iO.isMovieStar) {
+ if (_t._iO.duration) {
+ _t.durationEstimate = (_t.duration > _t._iO.duration) ? _t.duration : _t._iO.duration;
+ } else {
+ _t.durationEstimate = parseInt((_t.bytesTotal / _t.bytesLoaded) * _t.duration, 10);
+ }
+ if (_t.durationEstimate === undefined) {
+ _t.durationEstimate = _t.duration;
+ }
+ if (_t.readyState !== 3 && _t._iO.whileloading) {
+ _t._iO.whileloading.apply(_t);
+ }
+ } else {
+ _t.durationEstimate = _t.duration;
+ if (_t.readyState !== 3 && _t._iO.whileloading) {
+ _t._iO.whileloading.apply(_t);
+ }
+ }
+ };
+ this._whileplaying = function(nPosition, oPeakData, oWaveformDataLeft, oWaveformDataRight, oEQData) {
+ if (isNaN(nPosition) || nPosition === null) {
+ return false;
+ }
+ _t.position = nPosition;
+ _t.processOnPosition();
+ if (!_t.isHTML5 && _fV > 8) {
+ if (_t._iO.usePeakData && typeof oPeakData !== 'undefined' && oPeakData) {
+ _t.peakData = {
+ left: oPeakData.leftPeak,
+ right: oPeakData.rightPeak
+ };
+ }
+ if (_t._iO.useWaveformData && typeof oWaveformDataLeft !== 'undefined' && oWaveformDataLeft) {
+ _t.waveformData = {
+ left: oWaveformDataLeft.split(','),
+ right: oWaveformDataRight.split(',')
+ };
+ }
+ if (_t._iO.useEQData) {
+ if (typeof oEQData !== 'undefined' && oEQData && oEQData.leftEQ) {
+ var eqLeft = oEQData.leftEQ.split(',');
+ _t.eqData = eqLeft;
+ _t.eqData.left = eqLeft;
+ if (typeof oEQData.rightEQ !== 'undefined' && oEQData.rightEQ) {
+ _t.eqData.right = oEQData.rightEQ.split(',');
+ }
+ }
+ }
+ }
+ if (_t.playState === 1) {
+ if (!_t.isHTML5 && _fV === 8 && !_t.position && _t.isBuffering) {
+ _t._onbufferchange(0);
+ }
+ if (_t._iO.whileplaying) {
+ _t._iO.whileplaying.apply(_t);
+ }
+ }
+ return true;
+ };
+ this._onid3 = function(oID3PropNames, oID3Data) {
+ var oData = [], i, j;
+ for (i = 0, j = oID3PropNames.length; i < j; i++) {
+ oData[oID3PropNames[i]] = oID3Data[i];
+ }
+ _t.id3 = _mixin(_t.id3, oData);
+ if (_t._iO.onid3) {
+ _t._iO.onid3.apply(_t);
+ }
+ };
+ this._onconnect = function(bSuccess) {
+ var fN = 'SMSound._onconnect(): ';
+ bSuccess = (bSuccess === 1);
+ _t.connected = bSuccess;
+ if (bSuccess) {
+ _t.failures = 0;
+ if (_idCheck(_t.sID)) {
+ if (_t.getAutoPlay()) {
+ _t.play(undefined, _t.getAutoPlay());
+ } else if (_t._iO.autoLoad) {
+ _t.load();
+ }
+ }
+ if (_t._iO.onconnect) {
+ _t._iO.onconnect.apply(_t,[bSuccess]);
+ }
+ }
+ };
+ this._ondataerror = function(sError) {
+ if (_t.playState > 0) {
+ if (_t._iO.ondataerror) {
+ _t._iO.ondataerror.apply(_t);
+ }
+ }
+ };
+ };
+ _getDocument = function() {
+ return (_doc.body || _doc._docElement || _doc.getElementsByTagName('div')[0]);
+ };
+ _id = function(sID) {
+ return _doc.getElementById(sID);
+ };
+ _mixin = function(oMain, oAdd) {
+ var o1 = {}, i, o2, o;
+ for (i in oMain) {
+ if (oMain.hasOwnProperty(i)) {
+ o1[i] = oMain[i];
+ }
+ }
+ o2 = (typeof oAdd === 'undefined'?_s.defaultOptions:oAdd);
+ for (o in o2) {
+ if (o2.hasOwnProperty(o) && typeof o1[o] === 'undefined') {
+ o1[o] = o2[o];
+ }
+ }
+ return o1;
+ };
+ _event = (function() {
+ var old = (_win.attachEvent),
+ evt = {
+ add: (old?'attachEvent':'addEventListener'),
+ remove: (old?'detachEvent':'removeEventListener')
+ };
+ function getArgs(oArgs) {
+ var args = _slice.call(oArgs), len = args.length;
+ if (old) {
+ args[1] = 'on' + args[1];
+ if (len > 3) {
+ args.pop();
+ }
+ } else if (len === 3) {
+ args.push(false);
+ }
+ return args;
+ }
+ function apply(args, sType) {
+ var element = args.shift(),
+ method = [evt[sType]];
+ if (old) {
+ element[method](args[0], args[1]);
+ } else {
+ element[method].apply(element, args);
+ }
+ }
+ function add() {
+ apply(getArgs(arguments), 'add');
+ }
+ function remove() {
+ apply(getArgs(arguments), 'remove');
+ }
+ return {
+ 'add': add,
+ 'remove': remove
+ };
+ }());
+ function _html5_event(oFn) {
+ return function(e) {
+ if (!this._t || !this._t._a) {
+ return null;
+ } else {
+ return oFn.call(this, e);
+ }
+ };
+ }
+ _html5_events = {
+ abort: _html5_event(function(e) {
+ }),
+ canplay: _html5_event(function(e) {
+ if (this._t._html5_canplay) {
+ return true;
+ }
+ this._t._html5_canplay = true;
+ this._t._onbufferchange(0);
+ var position1K = (!isNaN(this._t.position)?this._t.position/1000:null);
+ if (this._t.position && this.currentTime !== position1K) {
+ try {
+ this.currentTime = position1K;
+ } catch(ee) {
+ }
+ }
+ }),
+ load: _html5_event(function(e) {
+ if (!this._t.loaded) {
+ this._t._onbufferchange(0);
+ this._t._whileloading(this._t.bytesTotal, this._t.bytesTotal, this._t._get_html5_duration());
+ this._t._onload(true);
+ }
+ }),
+ emptied: _html5_event(function(e) {
+ }),
+ ended: _html5_event(function(e) {
+ this._t._onfinish();
+ }),
+ error: _html5_event(function(e) {
+ this._t._onload(false);
+ }),
+ loadeddata: _html5_event(function(e) {
+ var t = this._t,
+ bytesTotal = t.bytesTotal || 1;
+ if (!t._loaded && !_isSafari) {
+ t.duration = t._get_html5_duration();
+ t._whileloading(bytesTotal, bytesTotal, t._get_html5_duration());
+ t._onload(true);
+ }
+ }),
+ loadedmetadata: _html5_event(function(e) {
+ }),
+ loadstart: _html5_event(function(e) {
+ this._t._onbufferchange(1);
+ }),
+ play: _html5_event(function(e) {
+ this._t._onbufferchange(0);
+ }),
+ playing: _html5_event(function(e) {
+ this._t._onbufferchange(0);
+ }),
+ progress: _html5_event(function(e) {
+ if (this._t.loaded) {
+ return false;
+ }
+ var i, j, str, buffered = 0,
+ isProgress = (e.type === 'progress'),
+ ranges = e.target.buffered,
+ loaded = (e.loaded||0),
+ total = (e.total||1);
+ if (ranges && ranges.length) {
+ for (i=ranges.length; i--;) {
+ buffered = (ranges.end(i) - ranges.start(i));
+ }
+ loaded = buffered/e.target.duration;
+ }
+ if (!isNaN(loaded)) {
+ this._t._onbufferchange(0);
+ this._t._whileloading(loaded, total, this._t._get_html5_duration());
+ if (loaded && total && loaded === total) {
+ _html5_events.load.call(this, e);
+ }
+ }
+ }),
+ ratechange: _html5_event(function(e) {
+ }),
+ suspend: _html5_event(function(e) {
+ _html5_events.progress.call(this, e);
+ }),
+ stalled: _html5_event(function(e) {
+ }),
+ timeupdate: _html5_event(function(e) {
+ this._t._onTimer();
+ }),
+ waiting: _html5_event(function(e) {
+ this._t._onbufferchange(1);
+ })
+ };
+ _html5OK = function(iO) {
+ return (!iO.serverURL && (iO.type?_html5CanPlay({type:iO.type}):_html5CanPlay({url:iO.url})||_s.html5Only));
+ };
+ _html5Unload = function(oAudio) {
+ if (oAudio) {
+ oAudio.src = (_ua.match(/gecko/i) ? '' : _emptyURL);
+ }
+ };
+ _html5CanPlay = function(o) {
+ if (!_s.useHTML5Audio || !_s.hasHTML5) {
+ return false;
+ }
+ var url = (o.url || null),
+ mime = (o.type || null),
+ aF = _s.audioFormats,
+ result,
+ offset,
+ fileExt,
+ item;
+ function preferFlashCheck(kind) {
+ return (_s.preferFlash && _hasFlash && !_s.ignoreFlash && (typeof _s.flash[kind] !== 'undefined' && _s.flash[kind]));
+ }
+ if (mime && _s.html5[mime] !== 'undefined') {
+ return (_s.html5[mime] && !preferFlashCheck(mime));
+ }
+ if (!_html5Ext) {
+ _html5Ext = [];
+ for (item in aF) {
+ if (aF.hasOwnProperty(item)) {
+ _html5Ext.push(item);
+ if (aF[item].related) {
+ _html5Ext = _html5Ext.concat(aF[item].related);
+ }
+ }
+ }
+ _html5Ext = new RegExp('\\.('+_html5Ext.join('|')+')(\\?.*)?$','i');
+ }
+ fileExt = (url ? url.toLowerCase().match(_html5Ext) : null);
+ if (!fileExt || !fileExt.length) {
+ if (!mime) {
+ return false;
+ } else {
+ offset = mime.indexOf(';');
+ fileExt = (offset !== -1?mime.substr(0,offset):mime).substr(6);
+ }
+ } else {
+ fileExt = fileExt[1];
+ }
+ if (fileExt && typeof _s.html5[fileExt] !== 'undefined') {
+ return (_s.html5[fileExt] && !preferFlashCheck(fileExt));
+ } else {
+ mime = 'audio/'+fileExt;
+ result = _s.html5.canPlayType({type:mime});
+ _s.html5[fileExt] = result;
+ return (result && _s.html5[mime] && !preferFlashCheck(mime));
+ }
+ };
+ _testHTML5 = function() {
+ if (!_s.useHTML5Audio || typeof Audio === 'undefined') {
+ return false;
+ }
+ var a = (typeof Audio !== 'undefined' ? (_isOpera ? new Audio(null) : new Audio()) : null),
+ item, support = {}, aF, i;
+ function _cp(m) {
+ var canPlay, i, j, isOK = false;
+ if (!a || typeof a.canPlayType !== 'function') {
+ return false;
+ }
+ if (m instanceof Array) {
+ for (i=0, j=m.length; i<j && !isOK; i++) {
+ if (_s.html5[m[i]] || a.canPlayType(m[i]).match(_s.html5Test)) {
+ isOK = true;
+ _s.html5[m[i]] = true;
+ _s.flash[m[i]] = !!(_s.preferFlash && _hasFlash && m[i].match(_flashMIME));
+ }
+ }
+ return isOK;
+ } else {
+ canPlay = (a && typeof a.canPlayType === 'function' ? a.canPlayType(m) : false);
+ return !!(canPlay && (canPlay.match(_s.html5Test)));
+ }
+ }
+ aF = _s.audioFormats;
+ for (item in aF) {
+ if (aF.hasOwnProperty(item)) {
+ support[item] = _cp(aF[item].type);
+ support['audio/'+item] = support[item];
+ if (_s.preferFlash && !_s.ignoreFlash && item.match(_flashMIME)) {
+ _s.flash[item] = true;
+ } else {
+ _s.flash[item] = false;
+ }
+ if (aF[item] && aF[item].related) {
+ for (i=aF[item].related.length; i--;) {
+ support['audio/'+aF[item].related[i]] = support[item];
+ _s.html5[aF[item].related[i]] = support[item];
+ _s.flash[aF[item].related[i]] = support[item];
+ }
+ }
+ }
+ }
+ support.canPlayType = (a?_cp:null);
+ _s.html5 = _mixin(_s.html5, support);
+ return true;
+ };
+ _strings = {
+ };
+ _str = function() {
+ };
+ _loopFix = function(sOpt) {
+ if (_fV === 8 && sOpt.loops > 1 && sOpt.stream) {
+ sOpt.stream = false;
+ }
+ return sOpt;
+ };
+ _policyFix = function(sOpt, sPre) {
+ if (sOpt && !sOpt.usePolicyFile && (sOpt.onid3 || sOpt.usePeakData || sOpt.useWaveformData || sOpt.useEQData)) {
+ sOpt.usePolicyFile = true;
+ }
+ return sOpt;
+ };
+ _complain = function(sMsg) {
+ };
+ _doNothing = function() {
+ return false;
+ };
+ _disableObject = function(o) {
+ var oProp;
+ for (oProp in o) {
+ if (o.hasOwnProperty(oProp) && typeof o[oProp] === 'function') {
+ o[oProp] = _doNothing;
+ }
+ }
+ oProp = null;
+ };
+ _failSafely = function(bNoDisable) {
+ if (typeof bNoDisable === 'undefined') {
+ bNoDisable = false;
+ }
+ if (_disabled || bNoDisable) {
+ _s.disable(bNoDisable);
+ }
+ };
+ _normalizeMovieURL = function(smURL) {
+ var urlParams = null;
+ if (smURL) {
+ if (smURL.match(/\.swf(\?.*)?$/i)) {
+ urlParams = smURL.substr(smURL.toLowerCase().lastIndexOf('.swf?') + 4);
+ if (urlParams) {
+ return smURL;
+ }
+ } else if (smURL.lastIndexOf('/') !== smURL.length - 1) {
+ smURL = smURL + '/';
+ }
+ }
+ return (smURL && smURL.lastIndexOf('/') !== - 1?smURL.substr(0, smURL.lastIndexOf('/') + 1):'./') + _s.movieURL;
+ };
+ _setVersionInfo = function() {
+ _fV = parseInt(_s.flashVersion, 10);
+ if (_fV !== 8 && _fV !== 9) {
+ _s.flashVersion = _fV = _defaultFlashVersion;
+ }
+ var isDebug = (_s.debugMode || _s.debugFlash?'_debug.swf':'.swf');
+ if (_s.useHTML5Audio && !_s.html5Only && _s.audioFormats.mp4.required && _fV < 9) {
+ _s.flashVersion = _fV = 9;
+ }
+ _s.version = _s.versionNumber + (_s.html5Only?' (HTML5-only mode)':(_fV === 9?' (AS3/Flash 9)':' (AS2/Flash 8)'));
+ if (_fV > 8) {
+ _s.defaultOptions = _mixin(_s.defaultOptions, _s.flash9Options);
+ _s.features.buffering = true;
+ _s.defaultOptions = _mixin(_s.defaultOptions, _s.movieStarOptions);
+ _s.filePatterns.flash9 = new RegExp('\\.(mp3|' + _netStreamTypes.join('|') + ')(\\?.*)?$', 'i');
+ _s.features.movieStar = true;
+ } else {
+ _s.features.movieStar = false;
+ }
+ _s.filePattern = _s.filePatterns[(_fV !== 8?'flash9':'flash8')];
+ _s.movieURL = (_fV === 8?'soundmanager2.swf':'soundmanager2_flash9.swf').replace('.swf', isDebug);
+ _s.features.peakData = _s.features.waveformData = _s.features.eqData = (_fV > 8);
+ };
+ _setPolling = function(bPolling, bHighPerformance) {
+ if (!_s.o) {
+ return false;
+ }
+ _s.o._setPolling(bPolling, bHighPerformance);
+ };
+ _initDebug = function() {
+ if (_s.debugURLParam.test(_wl)) {
+ _s.debugMode = true;
+ }
+ };
+ _idCheck = this.getSoundById;
+ _getSWFCSS = function() {
+ var css = [];
+ if (_s.debugMode) {
+ css.push(_s.swfCSS.sm2Debug);
+ }
+ if (_s.debugFlash) {
+ css.push(_s.swfCSS.flashDebug);
+ }
+ if (_s.useHighPerformance) {
+ css.push(_s.swfCSS.highPerf);
+ }
+ return css.join(' ');
+ };
+ _flashBlockHandler = function() {
+ var name = _str('fbHandler'),
+ p = _s.getMoviePercent(),
+ css = _s.swfCSS,
+ error = {type:'FLASHBLOCK'};
+ if (_s.html5Only) {
+ return false;
+ }
+ if (!_s.ok()) {
+ if (_needsFlash) {
+ _s.oMC.className = _getSWFCSS() + ' ' + css.swfDefault + ' ' + (p === null?css.swfTimedout:css.swfError);
+ }
+ _s.didFlashBlock = true;
+ _processOnEvents({type:'ontimeout', ignoreInit:true, error:error});
+ _catchError(error);
+ } else {
+ if (_s.didFlashBlock) {
+ }
+ if (_s.oMC) {
+ _s.oMC.className = [_getSWFCSS(), css.swfDefault, css.swfLoaded + (_s.didFlashBlock?' '+css.swfUnblocked:'')].join(' ');
+ }
+ }
+ };
+ _addOnEvent = function(sType, oMethod, oScope) {
+ if (typeof _on_queue[sType] === 'undefined') {
+ _on_queue[sType] = [];
+ }
+ _on_queue[sType].push({
+ 'method': oMethod,
+ 'scope': (oScope || null),
+ 'fired': false
+ });
+ };
+ _processOnEvents = function(oOptions) {
+ if (!oOptions) {
+ oOptions = {
+ type: 'onready'
+ };
+ }
+ if (!_didInit && oOptions && !oOptions.ignoreInit) {
+ return false;
+ }
+ if (oOptions.type === 'ontimeout' && _s.ok()) {
+ return false;
+ }
+ var status = {
+ success: (oOptions && oOptions.ignoreInit?_s.ok():!_disabled)
+ },
+ srcQueue = (oOptions && oOptions.type?_on_queue[oOptions.type]||[]:[]),
+ queue = [], i, j,
+ args = [status],
+ canRetry = (_needsFlash && _s.useFlashBlock && !_s.ok());
+ if (oOptions.error) {
+ args[0].error = oOptions.error;
+ }
+ for (i = 0, j = srcQueue.length; i < j; i++) {
+ if (srcQueue[i].fired !== true) {
+ queue.push(srcQueue[i]);
+ }
+ }
+ if (queue.length) {
+ for (i = 0, j = queue.length; i < j; i++) {
+ if (queue[i].scope) {
+ queue[i].method.apply(queue[i].scope, args);
+ } else {
+ queue[i].method.apply(this, args);
+ }
+ if (!canRetry) {
+ queue[i].fired = true;
+ }
+ }
+ }
+ return true;
+ };
+ _initUserOnload = function() {
+ _win.setTimeout(function() {
+ if (_s.useFlashBlock) {
+ _flashBlockHandler();
+ }
+ _processOnEvents();
+ if (_s.onload instanceof Function) {
+ _s.onload.apply(_win);
+ }
+ if (_s.waitForWindowLoad) {
+ _event.add(_win, 'load', _initUserOnload);
+ }
+ },1);
+ };
+ _detectFlash = function() {
+ if (_hasFlash !== undefined) {
+ return _hasFlash;
+ }
+ var hasPlugin = false, n = navigator, nP = n.plugins, obj, type, types, AX = _win.ActiveXObject;
+ if (nP && nP.length) {
+ type = 'application/x-shockwave-flash';
+ types = n.mimeTypes;
+ if (types && types[type] && types[type].enabledPlugin && types[type].enabledPlugin.description) {
+ hasPlugin = true;
+ }
+ } else if (typeof AX !== 'undefined') {
+ try {
+ obj = new AX('ShockwaveFlash.ShockwaveFlash');
+ } catch(e) {
+ }
+ hasPlugin = (!!obj);
+ }
+ _hasFlash = hasPlugin;
+ return hasPlugin;
+ };
+ _featureCheck = function() {
+ var needsFlash, item,
+ isSpecial = (_is_iDevice && !!(_ua.match(/os (1|2|3_0|3_1)/i)));
+ if (isSpecial) {
+ _s.hasHTML5 = false;
+ _s.html5Only = true;
+ if (_s.oMC) {
+ _s.oMC.style.display = 'none';
+ }
+ return false;
+ }
+ if (_s.useHTML5Audio) {
+ if (!_s.html5 || !_s.html5.canPlayType) {
+ _s.hasHTML5 = false;
+ return true;
+ } else {
+ _s.hasHTML5 = true;
+ }
+ if (_isBadSafari) {
+ if (_detectFlash()) {
+ return true;
+ }
+ }
+ } else {
+ return true;
+ }
+ for (item in _s.audioFormats) {
+ if (_s.audioFormats.hasOwnProperty(item)) {
+ if ((_s.audioFormats[item].required && !_s.html5.canPlayType(_s.audioFormats[item].type)) || _s.flash[item] || _s.flash[_s.audioFormats[item].type]) {
+ needsFlash = true;
+ }
+ }
+ }
+ if (_s.ignoreFlash) {
+ needsFlash = false;
+ }
+ _s.html5Only = (_s.hasHTML5 && _s.useHTML5Audio && !needsFlash);
+ return (!_s.html5Only);
+ };
+ _startTimer = function(oSound) {
+ if (!oSound._hasTimer) {
+ oSound._hasTimer = true;
+ }
+ };
+ _stopTimer = function(oSound) {
+ if (oSound._hasTimer) {
+ oSound._hasTimer = false;
+ }
+ };
+ _catchError = function(options) {
+ options = (typeof options !== 'undefined' ? options : {});
+ if (_s.onerror instanceof Function) {
+ _s.onerror.apply(_win, [{type:(typeof options.type !== 'undefined' ? options.type : null)}]);
+ }
+ if (typeof options.fatal !== 'undefined' && options.fatal) {
+ _s.disable();
+ }
+ };
+ _badSafariFix = function() {
+ if (!_isBadSafari || !_detectFlash()) {
+ return false;
+ }
+ var aF = _s.audioFormats, i, item;
+ for (item in aF) {
+ if (aF.hasOwnProperty(item)) {
+ if (item === 'mp3' || item === 'mp4') {
+ _s.html5[item] = false;
+ if (aF[item] && aF[item].related) {
+ for (i = aF[item].related.length; i--;) {
+ _s.html5[aF[item].related[i]] = false;
+ }
+ }
+ }
+ }
+ }
+ };
+ this._setSandboxType = function(sandboxType) {
+ };
+ this._externalInterfaceOK = function(flashDate) {
+ if (_s.swfLoaded) {
+ return false;
+ }
+ var eiTime = new Date().getTime();
+ _s.swfLoaded = true;
+ _tryInitOnFocus = false;
+ if (_isBadSafari) {
+ _badSafariFix();
+ }
+ if (_isIE) {
+ setTimeout(_init, 100);
+ } else {
+ _init();
+ }
+ };
+ _createMovie = function(smID, smURL) {
+ if (_didAppend && _appendSuccess) {
+ return false;
+ }
+ function _initMsg() {
+ }
+ if (_s.html5Only) {
+ _setVersionInfo();
+ _initMsg();
+ _s.oMC = _id(_s.movieID);
+ _init();
+ _didAppend = true;
+ _appendSuccess = true;
+ return false;
+ }
+ var remoteURL = (smURL || _s.url),
+ localURL = (_s.altURL || remoteURL),
+ swfTitle = 'JS/Flash audio component (SoundManager 2)',
+ oEmbed, oMovie, oTarget = _getDocument(), tmp, movieHTML, oEl, extraClass = _getSWFCSS(),
+ s, x, sClass, side = 'auto', isRTL = null,
+ html = _doc.getElementsByTagName('html')[0];
+ isRTL = (html && html.dir && html.dir.match(/rtl/i));
+ smID = (typeof smID === 'undefined'?_s.id:smID);
+ function param(name, value) {
+ return '<param name="'+name+'" value="'+value+'" />';
+ }
+ _setVersionInfo();
+ _s.url = _normalizeMovieURL(_overHTTP?remoteURL:localURL);
+ smURL = _s.url;
+ _s.wmode = (!_s.wmode && _s.useHighPerformance ? 'transparent' : _s.wmode);
+ if (_s.wmode !== null && (_ua.match(/msie 8/i) || (!_isIE && !_s.useHighPerformance)) && navigator.platform.match(/win32|win64/i)) {
+ _s.specialWmodeCase = true;
+ _s.wmode = null;
+ }
+ oEmbed = {
+ 'name': smID,
+ 'id': smID,
+ 'src': smURL,
+ 'width': side,
+ 'height': side,
+ 'quality': 'high',
+ 'allowScriptAccess': _s.allowScriptAccess,
+ 'bgcolor': _s.bgColor,
+ 'pluginspage': _http+'www.macromedia.com/go/getflashplayer',
+ 'title': swfTitle,
+ 'type': 'application/x-shockwave-flash',
+ 'wmode': _s.wmode,
+ 'hasPriority': 'true'
+ };
+ if (_s.debugFlash) {
+ oEmbed.FlashVars = 'debug=1';
+ }
+ if (!_s.wmode) {
+ delete oEmbed.wmode;
+ }
+ if (_isIE) {
+ oMovie = _doc.createElement('div');
+ movieHTML = [
+ '<object id="' + smID + '" data="' + smURL + '" type="' + oEmbed.type + '" title="' + oEmbed.title +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="' + _http+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="' + oEmbed.width + '" height="' + oEmbed.height + '">',
+ param('movie', smURL),
+ param('AllowScriptAccess', _s.allowScriptAccess),
+ param('quality', oEmbed.quality),
+ (_s.wmode? param('wmode', _s.wmode): ''),
+ param('bgcolor', _s.bgColor),
+ param('hasPriority', 'true'),
+ (_s.debugFlash ? param('FlashVars', oEmbed.FlashVars) : ''),
+ '</object>'
+ ].join('');
+ } else {
+ oMovie = _doc.createElement('embed');
+ for (tmp in oEmbed) {
+ if (oEmbed.hasOwnProperty(tmp)) {
+ oMovie.setAttribute(tmp, oEmbed[tmp]);
+ }
+ }
+ }
+ _initDebug();
+ extraClass = _getSWFCSS();
+ oTarget = _getDocument();
+ if (oTarget) {
+ _s.oMC = (_id(_s.movieID) || _doc.createElement('div'));
+ if (!_s.oMC.id) {
+ _s.oMC.id = _s.movieID;
+ _s.oMC.className = _s.swfCSS.swfDefault + ' ' + extraClass;
+ s = null;
+ oEl = null;
+ if (!_s.useFlashBlock) {
+ if (_s.useHighPerformance) {
+ s = {
+ 'position': 'fixed',
+ 'width': '8px',
+ 'height': '8px',
+ 'bottom': '0px',
+ 'left': '0px',
+ 'overflow': 'hidden'
+ };
+ } else {
+ s = {
+ 'position': 'absolute',
+ 'width': '6px',
+ 'height': '6px',
+ 'top': '-9999px',
+ 'left': '-9999px'
+ };
+ if (isRTL) {
+ s.left = Math.abs(parseInt(s.left,10))+'px';
+ }
+ }
+ }
+ if (_isWebkit) {
+ _s.oMC.style.zIndex = 10000;
+ }
+ if (!_s.debugFlash) {
+ for (x in s) {
+ if (s.hasOwnProperty(x)) {
+ _s.oMC.style[x] = s[x];
+ }
+ }
+ }
+ try {
+ if (!_isIE) {
+ _s.oMC.appendChild(oMovie);
+ }
+ oTarget.appendChild(_s.oMC);
+ if (_isIE) {
+ oEl = _s.oMC.appendChild(_doc.createElement('div'));
+ oEl.className = _s.swfCSS.swfBox;
+ oEl.innerHTML = movieHTML;
+ }
+ _appendSuccess = true;
+ } catch(e) {
+ throw new Error(_str('domError')+' \n'+e.toString());
+ }
+ } else {
+ sClass = _s.oMC.className;
+ _s.oMC.className = (sClass?sClass+' ':_s.swfCSS.swfDefault) + (extraClass?' '+extraClass:'');
+ _s.oMC.appendChild(oMovie);
+ if (_isIE) {
+ oEl = _s.oMC.appendChild(_doc.createElement('div'));
+ oEl.className = _s.swfCSS.swfBox;
+ oEl.innerHTML = movieHTML;
+ }
+ _appendSuccess = true;
+ }
+ }
+ _didAppend = true;
+ _initMsg();
+ return true;
+ };
+ _initMovie = function() {
+ if (_s.html5Only) {
+ _createMovie();
+ return false;
+ }
+ if (_s.o) {
+ return false;
+ }
+ _s.o = _s.getMovie(_s.id);
+ if (!_s.o) {
+ if (!_oRemoved) {
+ _createMovie(_s.id, _s.url);
+ } else {
+ if (!_isIE) {
+ _s.oMC.appendChild(_oRemoved);
+ } else {
+ _s.oMC.innerHTML = _oRemovedHTML;
+ }
+ _oRemoved = null;
+ _didAppend = true;
+ }
+ _s.o = _s.getMovie(_s.id);
+ }
+ if (_s.oninitmovie instanceof Function) {
+ setTimeout(_s.oninitmovie, 1);
+ }
+ return true;
+ };
+ _delayWaitForEI = function() {
+ setTimeout(_waitForEI, 1000);
+ };
+ _waitForEI = function() {
+ if (_waitingForEI) {
+ return false;
+ }
+ _waitingForEI = true;
+ _event.remove(_win, 'load', _delayWaitForEI);
+ if (_tryInitOnFocus && !_isFocused) {
+ return false;
+ }
+ var p;
+ if (!_didInit) {
+ p = _s.getMoviePercent();
+ }
+ setTimeout(function() {
+ p = _s.getMoviePercent();
+ if (!_didInit && _okToDisable) {
+ if (p === null) {
+ if (_s.useFlashBlock || _s.flashLoadTimeout === 0) {
+ if (_s.useFlashBlock) {
+ _flashBlockHandler();
+ }
+ } else {
+ _failSafely(true);
+ }
+ } else {
+ if (_s.flashLoadTimeout === 0) {
+ } else {
+ _failSafely(true);
+ }
+ }
+ }
+ }, _s.flashLoadTimeout);
+ };
+ _handleFocus = function() {
+ function cleanup() {
+ _event.remove(_win, 'focus', _handleFocus);
+ _event.remove(_win, 'load', _handleFocus);
+ }
+ if (_isFocused || !_tryInitOnFocus) {
+ cleanup();
+ return true;
+ }
+ _okToDisable = true;
+ _isFocused = true;
+ if (_isSafari && _tryInitOnFocus) {
+ _event.remove(_win, 'mousemove', _handleFocus);
+ }
+ _waitingForEI = false;
+ cleanup();
+ return true;
+ };
+ _showSupport = function() {
+ var item, tests = [];
+ if (_s.useHTML5Audio && _s.hasHTML5) {
+ for (item in _s.audioFormats) {
+ if (_s.audioFormats.hasOwnProperty(item)) {
+ tests.push(item + ': ' + _s.html5[item] + (!_s.html5[item] && _hasFlash && _s.flash[item] ? ' (using flash)' : (_s.preferFlash && _s.flash[item] && _hasFlash ? ' (preferring flash)': (!_s.html5[item] ? ' (' + (_s.audioFormats[item].required ? 'required, ':'') + 'and no flash support)' : ''))));
+ }
+ }
+ }
+ };
+ _initComplete = function(bNoDisable) {
+ if (_didInit) {
+ return false;
+ }
+ if (_s.html5Only) {
+ _didInit = true;
+ _initUserOnload();
+ return true;
+ }
+ var wasTimeout = (_s.useFlashBlock && _s.flashLoadTimeout && !_s.getMoviePercent()),
+ error;
+ if (!wasTimeout) {
+ _didInit = true;
+ if (_disabled) {
+ error = {type: (!_hasFlash && _needsFlash ? 'NO_FLASH' : 'INIT_TIMEOUT')};
+ }
+ }
+ if (_disabled || bNoDisable) {
+ if (_s.useFlashBlock && _s.oMC) {
+ _s.oMC.className = _getSWFCSS() + ' ' + (_s.getMoviePercent() === null?_s.swfCSS.swfTimedout:_s.swfCSS.swfError);
+ }
+ _processOnEvents({type:'ontimeout', error:error});
+ _catchError(error);
+ return false;
+ } else {
+ }
+ if (_s.waitForWindowLoad && !_windowLoaded) {
+ _event.add(_win, 'load', _initUserOnload);
+ return false;
+ } else {
+ _initUserOnload();
+ }
+ return true;
+ };
+ _init = function() {
+ if (_didInit) {
+ return false;
+ }
+ function _cleanup() {
+ _event.remove(_win, 'load', _s.beginDelayedInit);
+ }
+ if (_s.html5Only) {
+ if (!_didInit) {
+ _cleanup();
+ _s.enabled = true;
+ _initComplete();
+ }
+ return true;
+ }
+ _initMovie();
+ try {
+ _s.o._externalInterfaceTest(false);
+ _setPolling(true, (_s.flashPollingInterval || (_s.useHighPerformance ? 10 : 50)));
+ if (!_s.debugMode) {
+ _s.o._disableDebug();
+ }
+ _s.enabled = true;
+ if (!_s.html5Only) {
+ _event.add(_win, 'unload', _doNothing);
+ }
+ } catch(e) {
+ _catchError({type:'JS_TO_FLASH_EXCEPTION', fatal:true});
+ _failSafely(true);
+ _initComplete();
+ return false;
+ }
+ _initComplete();
+ _cleanup();
+ return true;
+ };
+ _domContentLoaded = function() {
+ if (_didDCLoaded) {
+ return false;
+ }
+ _didDCLoaded = true;
+ _initDebug();
+ if (!_hasFlash && _s.hasHTML5) {
+ _s.useHTML5Audio = true;
+ _s.preferFlash = false;
+ }
+ _testHTML5();
+ _s.html5.usingFlash = _featureCheck();
+ _needsFlash = _s.html5.usingFlash;
+ _showSupport();
+ if (!_hasFlash && _needsFlash) {
+ _s.flashLoadTimeout = 1;
+ }
+ if (_doc.removeEventListener) {
+ _doc.removeEventListener('DOMContentLoaded', _domContentLoaded, false);
+ }
+ _initMovie();
+ return true;
+ };
+ _domContentLoadedIE = function() {
+ if (_doc.readyState === 'complete') {
+ _domContentLoaded();
+ _doc.detachEvent('onreadystatechange', _domContentLoadedIE);
+ }
+ return true;
+ };
+ _detectFlash();
+ _event.add(_win, 'focus', _handleFocus);
+ _event.add(_win, 'load', _handleFocus);
+ _event.add(_win, 'load', _delayWaitForEI);
+ if (_isSafari && _tryInitOnFocus) {
+ _event.add(_win, 'mousemove', _handleFocus);
+ }
+ if (_doc.addEventListener) {
+ _doc.addEventListener('DOMContentLoaded', _domContentLoaded, false);
+ } else if (_doc.attachEvent) {
+ _doc.attachEvent('onreadystatechange', _domContentLoadedIE);
+ } else {
+ _catchError({type:'NO_DOM2_EVENTS', fatal:true});
+ }
+ if (_doc.readyState === 'complete') {
+ setTimeout(_domContentLoaded,100);
+ }
+}
+// SM2_DEFER details: http://www.schillmania.com/projects/soundmanager2/doc/getstarted/#lazy-loading
+if (typeof SM2_DEFER === 'undefined' || !SM2_DEFER) {
+ soundManager = new SoundManager();
+}
+window.SoundManager = SoundManager;
+window.soundManager = soundManager;
+}(window));
\ No newline at end of file
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/script/soundmanager2.js b/fantasmixDjango/django_project/audiofield/static/audiofield/script/soundmanager2.js
new file mode 100755
index 0000000000000000000000000000000000000000..23b3dcc3ecfb11c9df4ccd2f2e94e07f5172812a
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/static/audiofield/script/soundmanager2.js
@@ -0,0 +1,4475 @@
+/** @license
+ *
+ * SoundManager 2: JavaScript Sound for the Web
+ * ----------------------------------------------
+ * http://schillmania.com/projects/soundmanager2/
+ *
+ * Copyright (c) 2007, Scott Schiller. All rights reserved.
+ * Code provided under the BSD License:
+ * http://schillmania.com/projects/soundmanager2/license.txt
+ *
+ * V2.97a.20110918
+ */
+
+/*global window, SM2_DEFER, sm2Debugger, console, document, navigator, setTimeout, setInterval, clearInterval, Audio */
+/* jslint regexp: true, sloppy: true, white: true, nomen: true, plusplus: true */
+
+/**
+ * About this file
+ * ---------------
+ * This is the fully-commented source version of the SoundManager 2 API,
+ * recommended for use during development and testing.
+ *
+ * See soundmanager2-nodebug-jsmin.js for an optimized build (~10KB with gzip.)
+ * http://schillmania.com/projects/soundmanager2/doc/getstarted/#basic-inclusion
+ * Alternately, serve this file with gzip for 75% compression savings (~30KB over HTTP.)
+ *
+ * You may notice <d> and </d> comments in this source; these are delimiters for
+ * debug blocks which are removed in the -nodebug builds, further optimizing code size.
+ */
+
+(function(window) {
+
+var soundManager = null;
+
+/**
+ * The SoundManager constructor.
+ *
+ * @constructor
+ * @param {string} smURL Optional: Path to SWF files
+ * @param {string} smID Optional: The ID to use for the SWF container element
+ * @this {SoundManager}
+ * @return {SoundManager} The new SoundManager instance
+ */
+
+function SoundManager(smURL, smID) {
+
+ // Top-level configuration options
+
+ this.flashVersion = 8; // version of flash to require, either 8 or 9. Some API features require Flash 9.
+ this.debugMode = true; // enable debugging output (div#soundmanager-debug, OR console if available+configured)
+ this.debugFlash = false; // enable debugging output inside SWF, troubleshoot Flash/browser issues
+ this.useConsole = true; // use firebug/safari console.log()-type debug console if available
+ this.consoleOnly = false; // if console is being used, do not create/write to #soundmanager-debug
+ this.waitForWindowLoad = false; // force SM2 to wait for window.onload() before trying to call soundManager.onload()
+ this.bgColor = '#ffffff'; // movie (.swf) background color, eg. '#000000'
+ this.useHighPerformance = false; // position:fixed flash movie can help increase js/flash speed, minimize lag
+ this.flashPollingInterval = null; // msec affecting whileplaying/loading callback frequency. If null, default of 50 msec is used.
+ this.flashLoadTimeout = 1000; // msec to wait for flash movie to load before failing (0 = infinity)
+ this.wmode = null; // string: flash rendering mode - null, transparent, opaque (last two allow layering of HTML on top)
+ this.allowScriptAccess = 'always'; // for scripting the SWF (object/embed property), either 'always' or 'sameDomain'
+ this.useFlashBlock = false; // *requires flashblock.css, see demos* - allow recovery from flash blockers. Wait indefinitely and apply timeout CSS to SWF, if applicable.
+ this.useHTML5Audio = true; // beta feature: Use HTML5 Audio() where API is supported (most Safari, Chrome versions), Firefox (no MP3/MP4.) Ideally, transparent vs. Flash API where possible.
+ this.html5Test = /^(probably|maybe)$/i; // HTML5 Audio() format support test. Use /^probably$/i; if you want to be more conservative.
+ this.preferFlash = true; // (experimental) if true and flash support present, will try to use flash for MP3/MP4 as needed since HTML5 audio support is still quirky in browsers.
+
+ this.audioFormats = {
+
+ /**
+ * determines HTML5 support + flash requirements.
+ * if no support (via flash and/or HTML5) for a "required" format, SM2 will fail to start.
+ * flash fallback is used for MP3 or MP4 if HTML5 can't play it (or if preferFlash = true)
+ * multiple MIME types may be tested while trying to get a positive canPlayType() response.
+ */
+
+ 'mp3': {
+ 'type': ['audio/mpeg; codecs="mp3"', 'audio/mpeg', 'audio/mp3', 'audio/MPA', 'audio/mpa-robust'],
+ 'required': true
+ },
+
+ 'mp4': {
+ 'related': ['aac','m4a'], // additional formats under the MP4 container
+ 'type': ['audio/mp4; codecs="mp4a.40.2"', 'audio/aac', 'audio/x-m4a', 'audio/MP4A-LATM', 'audio/mpeg4-generic'],
+ 'required': false
+
+ },
+
+ 'ogg': {
+ 'type': ['audio/ogg; codecs=vorbis'],
+ 'required': false
+ },
+
+ 'wav': {
+ 'type': ['audio/wav; codecs="1"', 'audio/wav', 'audio/wave', 'audio/x-wav'],
+ 'required': false
+ }
+
+ };
+
+ this.defaultOptions = {
+
+ /**
+ * the default configuration for sound objects made with createSound() and related methods
+ * eg., volume, auto-load behaviour and so forth
+ */
+
+ 'autoLoad': false, // enable automatic loading (otherwise .load() will be called on demand with .play(), the latter being nicer on bandwidth - if you want to .load yourself, you also can)
+ 'stream': true, // allows playing before entire file has loaded (recommended)
+ 'autoPlay': false, // enable playing of file as soon as possible (much faster if "stream" is true)
+ 'loops': 1, // how many times to repeat the sound (position will wrap around to 0, setPosition() will break out of loop when >0)
+ 'onid3': null, // callback function for "ID3 data is added/available"
+ 'onload': null, // callback function for "load finished"
+ 'whileloading': null, // callback function for "download progress update" (X of Y bytes received)
+ 'onplay': null, // callback for "play" start
+ 'onpause': null, // callback for "pause"
+ 'onresume': null, // callback for "resume" (pause toggle)
+ 'whileplaying': null, // callback during play (position update)
+ 'onstop': null, // callback for "user stop"
+ 'onfailure': null, // callback function for when playing fails
+ 'onfinish': null, // callback function for "sound finished playing"
+ 'multiShot': true, // let sounds "restart" or layer on top of each other when played multiple times, rather than one-shot/one at a time
+ 'multiShotEvents': false, // fire multiple sound events (currently onfinish() only) when multiShot is enabled
+ 'position': null, // offset (milliseconds) to seek to within loaded sound data.
+ 'pan': 0, // "pan" settings, left-to-right, -100 to 100
+ 'type': null, // MIME-like hint for file pattern / canPlay() tests, eg. audio/mp3
+ 'usePolicyFile': false, // enable crossdomain.xml request for audio on remote domains (for ID3/waveform access)
+ 'volume': 100 // self-explanatory. 0-100, the latter being the max.
+
+ };
+
+ this.flash9Options = {
+
+ /**
+ * flash 9-only options,
+ * merged into defaultOptions if flash 9 is being used
+ */
+
+ 'isMovieStar': null, // "MovieStar" MPEG4 audio mode. Null (default) = auto detect MP4, AAC etc. based on URL. true = force on, ignore URL
+ 'usePeakData': false, // enable left/right channel peak (level) data
+ 'useWaveformData': false, // enable sound spectrum (raw waveform data) - NOTE: May increase CPU load.
+ 'useEQData': false, // enable sound EQ (frequency spectrum data) - NOTE: May increase CPU load.
+ 'onbufferchange': null, // callback for "isBuffering" property change
+ 'ondataerror': null // callback for waveform/eq data access error (flash playing audio in other tabs/domains)
+
+ };
+
+ this.movieStarOptions = {
+
+ /**
+ * flash 9.0r115+ MPEG4 audio options,
+ * merged into defaultOptions if flash 9+movieStar mode is enabled
+ */
+
+ 'bufferTime': 3, // seconds of data to buffer before playback begins (null = flash default of 0.1 seconds - if AAC playback is gappy, try increasing.)
+ 'serverURL': null, // rtmp: FMS or FMIS server to connect to, required when requesting media via RTMP or one of its variants
+ 'onconnect': null, // rtmp: callback for connection to flash media server
+ 'duration': null // rtmp: song duration (msec)
+
+ };
+
+ // HTML attributes (id + class names) for the SWF container
+
+ this.movieID = 'sm2-container';
+ this.id = (smID || 'sm2movie');
+
+ this.swfCSS = {
+
+ 'swfBox': 'sm2-object-box',
+ 'swfDefault': 'movieContainer',
+ 'swfError': 'swf_error', // SWF loaded, but SM2 couldn't start (other error)
+ 'swfTimedout': 'swf_timedout',
+ 'swfLoaded': 'swf_loaded',
+ 'swfUnblocked': 'swf_unblocked', // or loaded OK
+ 'sm2Debug': 'sm2_debug',
+ 'highPerf': 'high_performance',
+ 'flashDebug': 'flash_debug'
+
+ };
+
+ this.debugID = 'soundmanager-debug';
+ this.debugURLParam = /([#?&])debug=1/i;
+
+ // dynamic attributes
+
+ this.versionNumber = 'V2.97a.20110918';
+ this.version = null;
+ this.movieURL = null;
+ this.url = (smURL || null);
+ this.altURL = null;
+ this.swfLoaded = false;
+ this.enabled = false;
+ this.o = null;
+ this.oMC = null;
+ this.sounds = {};
+ this.soundIDs = [];
+ this.muted = false;
+ this.specialWmodeCase = false;
+ this.didFlashBlock = false;
+ this.filePattern = null;
+
+ this.filePatterns = {
+
+ 'flash8': /\.mp3(\?.*)?$/i,
+ 'flash9': /\.mp3(\?.*)?$/i
+
+ };
+
+ // support indicators, set at init
+
+ this.features = {
+
+ 'buffering': false,
+ 'peakData': false,
+ 'waveformData': false,
+ 'eqData': false,
+ 'movieStar': false
+
+ };
+
+ // flash sandbox info, used primarily in troubleshooting
+
+ this.sandbox = {
+
+ // <d>
+ 'type': null,
+ 'types': {
+ 'remote': 'remote (domain-based) rules',
+ 'localWithFile': 'local with file access (no internet access)',
+ 'localWithNetwork': 'local with network (internet access only, no local access)',
+ 'localTrusted': 'local, trusted (local+internet access)'
+ },
+ 'description': null,
+ 'noRemote': null,
+ 'noLocal': null
+ // </d>
+
+ };
+
+ // do we have HTML5 audio?
+ this.hasHTML5 = (typeof Audio !== 'undefined' && typeof new Audio().canPlayType !== 'undefined');
+
+ /**
+ * format support (html5/flash)
+ * stores canPlayType() results based on audioFormats.
+ * eg. { mp3: boolean, mp4: boolean }
+ * treat as read-only.
+ */
+
+ this.html5 = {
+ 'usingFlash': null // set if/when flash fallback is needed
+ };
+
+ this.flash = {};
+
+ this.html5Only = false; // determined at init time
+ this.ignoreFlash = false; // used for special cases (eg. iPad/iPhone/palm OS?)
+
+ /**
+ * a few private internals (OK, a lot. :D)
+ */
+
+ var SMSound,
+ _s = this, _sm = 'soundManager', _smc = _sm+'::', _h5 = 'HTML5::', _id, _ua = navigator.userAgent, _win = window, _wl = _win.location.href.toString(), _doc = document, _doNothing, _init, _fV, _on_queue = [], _debugOpen = true, _debugTS, _didAppend = false, _appendSuccess = false, _didInit = false, _disabled = false, _windowLoaded = false, _wDS, _wdCount = 0, _initComplete, _mixin, _addOnEvent, _processOnEvents, _initUserOnload, _delayWaitForEI, _waitForEI, _setVersionInfo, _handleFocus, _strings, _initMovie, _domContentLoaded, _didDCLoaded, _getDocument, _createMovie, _catchError, _setPolling, _initDebug, _debugLevels = ['log', 'info', 'warn', 'error'], _defaultFlashVersion = 8, _disableObject, _failSafely, _normalizeMovieURL, _oRemoved = null, _oRemovedHTML = null, _str, _flashBlockHandler, _getSWFCSS, _toggleDebug, _loopFix, _policyFix, _complain, _idCheck, _waitingForEI = false, _initPending = false, _smTimer, _onTimer, _startTimer, _stopTimer, _needsFlash = null, _featureCheck, _html5OK, _html5CanPlay, _html5Ext, _html5Unload, _domContentLoadedIE, _testHTML5, _event, _slice = Array.prototype.slice, _useGlobalHTML5Audio = false, _hasFlash, _detectFlash, _badSafariFix, _html5_events, _showSupport,
+ _is_iDevice = _ua.match(/(ipad|iphone|ipod)/i), _likesHTML5 = (_ua.match(/(mobile|pre\/|xoom)/i) || _is_iDevice), _isIE = _ua.match(/msie/i), _isWebkit = _ua.match(/webkit/i), _isSafari = (_ua.match(/safari/i) && !_ua.match(/chrome/i)), _isOpera = (_ua.match(/opera/i)),
+ _isBadSafari = (!_wl.match(/usehtml5audio/i) && !_wl.match(/sm2\-ignorebadua/i) && _isSafari && _ua.match(/OS X 10_6_([3-7])/i)), // Safari 4 and 5 occasionally fail to load/play HTML5 audio on Snow Leopard 10.6.3 through 10.6.7 due to bug(s) in QuickTime X and/or other underlying frameworks. :/ Confirmed bug. https://bugs.webkit.org/show_bug.cgi?id=32159
+ _hasConsole = (typeof console !== 'undefined' && typeof console.log !== 'undefined'), _isFocused = (typeof _doc.hasFocus !== 'undefined'?_doc.hasFocus():null), _tryInitOnFocus = (_isSafari && typeof _doc.hasFocus === 'undefined'), _okToDisable = !_tryInitOnFocus, _flashMIME = /(mp3|mp4|mpa)/i,
+ _emptyURL = 'about:blank', // safe URL to unload, or load nothing from (flash 8 + most HTML5 UAs)
+ _overHTTP = (_doc.location?_doc.location.protocol.match(/http/i):null),
+ _http = (!_overHTTP ? 'http:/'+'/' : ''),
+ // mp3, mp4, aac etc.
+ _netStreamMimeTypes = /^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|mp4v|3gp|3g2)\s*(?:$|;)/i,
+ // Flash v9.0r115+ "moviestar" formats
+ _netStreamTypes = ['mpeg4', 'aac', 'flv', 'mov', 'mp4', 'm4v', 'f4v', 'm4a', 'mp4v', '3gp', '3g2'],
+ _netStreamPattern = new RegExp('\\.(' + _netStreamTypes.join('|') + ')(\\?.*)?$', 'i');
+ this.mimePattern = /^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i; // default mp3 set
+
+ // use altURL if not "online"
+ this.useAltURL = !_overHTTP;
+ this._global_a = null;
+
+ if (_likesHTML5) {
+
+ // prefer HTML5 for mobile + tablet-like devices, probably more reliable vs. flash at this point.
+ _s.useHTML5Audio = true;
+ _s.preferFlash = false;
+
+ if (_is_iDevice) {
+ // by default, use global feature. iOS onfinish() -> next may fail otherwise.
+ _s.ignoreFlash = true;
+ _useGlobalHTML5Audio = true;
+ }
+
+ }
+
+ /**
+ * Public SoundManager API
+ * -----------------------
+ */
+
+ this.ok = function() {
+
+ return (_needsFlash?(_didInit && !_disabled):(_s.useHTML5Audio && _s.hasHTML5));
+
+ };
+
+ this.supported = this.ok; // legacy
+
+ this.getMovie = function(smID) {
+
+ // safety net: some old browsers differ on SWF references, possibly related to ExternalInterface / flash version
+ return _id(smID) || _doc[smID] || _win[smID];
+
+ };
+
+ /**
+ * Creates a SMSound sound object instance.
+ *
+ * @param {object} oOptions Sound options (at minimum, id and url are required.)
+ * @return {object} SMSound The new SMSound object.
+ */
+
+ this.createSound = function(oOptions) {
+
+ var _cs = _sm+'.createSound(): ',
+ thisOptions = null, oSound = null, _tO = null;
+
+ if (!_didInit || !_s.ok()) {
+ _complain(_cs + _str(!_didInit?'notReady':'notOK'));
+ return false;
+ }
+
+ if (arguments.length === 2) {
+ // function overloading in JS! :) ..assume simple createSound(id,url) use case
+ oOptions = {
+ 'id': arguments[0],
+ 'url': arguments[1]
+ };
+ }
+
+ // inherit from defaultOptions
+ thisOptions = _mixin(oOptions);
+
+ // alias
+ _tO = thisOptions;
+
+ // <d>
+ if (_tO.id.toString().charAt(0).match(/^[0-9]$/)) {
+ _s._wD(_cs + _str('badID', _tO.id), 2);
+ }
+
+ _s._wD(_cs + _tO.id + ' (' + _tO.url + ')', 1);
+ // </d>
+
+ if (_idCheck(_tO.id, true)) {
+ _s._wD(_cs + _tO.id + ' exists', 1);
+ return _s.sounds[_tO.id];
+ }
+
+ function make() {
+
+ thisOptions = _loopFix(thisOptions);
+ _s.sounds[_tO.id] = new SMSound(_tO);
+ _s.soundIDs.push(_tO.id);
+ return _s.sounds[_tO.id];
+
+ }
+
+ if (_html5OK(_tO)) {
+
+ oSound = make();
+ _s._wD('Loading sound '+_tO.id+' via HTML5');
+ oSound._setup_html5(_tO);
+
+ } else {
+
+ if (_fV > 8) {
+ if (_tO.isMovieStar === null) {
+ // attempt to detect MPEG-4 formats
+ _tO.isMovieStar = (_tO.serverURL || (_tO.type ? _tO.type.match(_netStreamMimeTypes) : false) || _tO.url.match(_netStreamPattern));
+ }
+ // <d>
+ if (_tO.isMovieStar) {
+ _s._wD(_cs + 'using MovieStar handling');
+ }
+ // </d>
+ if (_tO.isMovieStar) {
+ if (_tO.usePeakData) {
+ _wDS('noPeak');
+ _tO.usePeakData = false;
+ }
+ // <d>
+ if (_tO.loops > 1) {
+ _wDS('noNSLoop');
+ }
+ // </d>
+ }
+ }
+
+ _tO = _policyFix(_tO, _cs);
+ oSound = make();
+
+ if (_fV === 8) {
+ _s.o._createSound(_tO.id, _tO.loops||1, _tO.usePolicyFile);
+ } else {
+ _s.o._createSound(_tO.id, _tO.url, _tO.usePeakData, _tO.useWaveformData, _tO.useEQData, _tO.isMovieStar, (_tO.isMovieStar?_tO.bufferTime:false), _tO.loops||1, _tO.serverURL, _tO.duration||null, _tO.autoPlay, true, _tO.autoLoad, _tO.usePolicyFile);
+ if (!_tO.serverURL) {
+ // We are connected immediately
+ oSound.connected = true;
+ if (_tO.onconnect) {
+ _tO.onconnect.apply(oSound);
+ }
+ }
+ }
+
+ if (!_tO.serverURL && (_tO.autoLoad || _tO.autoPlay)) {
+ // call load for non-rtmp streams
+ oSound.load(_tO);
+ }
+
+ }
+
+ // rtmp will play in onconnect
+ if (!_tO.serverURL && _tO.autoPlay) {
+ oSound.play();
+ }
+
+ return oSound;
+
+ };
+
+ /**
+ * Destroys a SMSound sound object instance.
+ *
+ * @param {string} sID The ID of the sound to destroy
+ */
+
+ this.destroySound = function(sID, _bFromSound) {
+
+ // explicitly destroy a sound before normal page unload, etc.
+
+ if (!_idCheck(sID)) {
+ return false;
+ }
+
+ var oS = _s.sounds[sID], i;
+
+ // Disable all callbacks while the sound is being destroyed
+ oS._iO = {};
+
+ oS.stop();
+ oS.unload();
+
+ for (i = 0; i < _s.soundIDs.length; i++) {
+ if (_s.soundIDs[i] === sID) {
+ _s.soundIDs.splice(i, 1);
+ break;
+ }
+ }
+
+ if (!_bFromSound) {
+ // ignore if being called from SMSound instance
+ oS.destruct(true);
+ }
+
+ oS = null;
+ delete _s.sounds[sID];
+
+ return true;
+
+ };
+
+ /**
+ * Calls the load() method of a SMSound object by ID.
+ *
+ * @param {string} sID The ID of the sound
+ * @param {object} oOptions Optional: Sound options
+ */
+
+ this.load = function(sID, oOptions) {
+
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ return _s.sounds[sID].load(oOptions);
+
+ };
+
+ /**
+ * Calls the unload() method of a SMSound object by ID.
+ *
+ * @param {string} sID The ID of the sound
+ */
+
+ this.unload = function(sID) {
+
+ if (!_idCheck(sID)) {
+ return false;
+ }
+
+ return _s.sounds[sID].unload();
+
+ };
+
+ /**
+ * Calls the onposition() method of a SMSound object by ID.
+ *
+ * @param {string} sID The ID of the sound
+ * @param {number} nPosition The position to watch for
+ * @param {function} oMethod The relevant callback to fire
+ * @param {object} oScope Optional: The scope to apply the callback to
+ * @return {SMSound} The SMSound object
+ */
+
+ this.onposition = function(sID, nPosition, oMethod, oScope) {
+
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ return _s.sounds[sID].onposition(nPosition, oMethod, oScope);
+
+ };
+
+ /**
+ * Calls the play() method of a SMSound object by ID.
+ *
+ * @param {string} sID The ID of the sound
+ * @param {object} oOptions Optional: Sound options
+ * @return {SMSound} The SMSound object
+ */
+
+ this.play = function(sID, oOptions) {
+
+ var fN = _sm+'.play(): ';
+
+ if (!_didInit || !_s.ok()) {
+ _complain(fN + _str(!_didInit?'notReady':'notOK'));
+ return false;
+ }
+
+ if (!_idCheck(sID)) {
+ if (!(oOptions instanceof Object)) {
+ oOptions = {
+ url: oOptions
+ }; // overloading use case: play('mySound','/path/to/some.mp3');
+ }
+ if (oOptions && oOptions.url) {
+ // overloading use case, create+play: .play('someID',{url:'/path/to.mp3'});
+ _s._wD(fN + 'attempting to create "' + sID + '"', 1);
+ oOptions.id = sID;
+ return _s.createSound(oOptions).play();
+ } else {
+ return false;
+ }
+ }
+
+ return _s.sounds[sID].play(oOptions);
+
+ };
+
+ this.start = this.play; // just for convenience
+
+ /**
+ * Calls the setPosition() method of a SMSound object by ID.
+ *
+ * @param {string} sID The ID of the sound
+ * @param {number} nMsecOffset Position (milliseconds)
+ * @return {SMSound} The SMSound object
+ */
+
+ this.setPosition = function(sID, nMsecOffset) {
+
+ if (!_idCheck(sID)) {
+ return false;
+
+ }
+ return _s.sounds[sID].setPosition(nMsecOffset);
+
+ };
+
+ /**
+ * Calls the stop() method of a SMSound object by ID.
+ *
+ * @param {string} sID The ID of the sound
+ * @return {SMSound} The SMSound object
+ */
+
+ this.stop = function(sID) {
+
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ _s._wD(_sm+'.stop(' + sID + ')', 1);
+ return _s.sounds[sID].stop();
+
+ };
+
+ /**
+ * Stops all currently-playing sounds.
+ */
+
+ this.stopAll = function() {
+
+ var oSound;
+ _s._wD(_sm+'.stopAll()', 1);
+
+ for (oSound in _s.sounds) {
+ if (_s.sounds.hasOwnProperty(oSound)) {
+ // apply only to sound objects
+ _s.sounds[oSound].stop();
+ }
+ }
+
+ };
+
+ /**
+ * Calls the pause() method of a SMSound object by ID.
+ *
+ * @param {string} sID The ID of the sound
+ * @return {SMSound} The SMSound object
+ */
+
+ this.pause = function(sID) {
+
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ return _s.sounds[sID].pause();
+
+ };
+
+ /**
+ * Pauses all currently-playing sounds.
+ */
+
+ this.pauseAll = function() {
+
+ var i;
+ for (i = _s.soundIDs.length; i--;) {
+ _s.sounds[_s.soundIDs[i]].pause();
+ }
+
+ };
+
+ /**
+ * Calls the resume() method of a SMSound object by ID.
+ *
+ * @param {string} sID The ID of the sound
+ * @return {SMSound} The SMSound object
+ */
+
+ this.resume = function(sID) {
+
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ return _s.sounds[sID].resume();
+
+ };
+
+ /**
+ * Resumes all currently-paused sounds.
+ */
+
+ this.resumeAll = function() {
+
+ var i;
+ for (i = _s.soundIDs.length; i--;) {
+ _s.sounds[_s.soundIDs[i]].resume();
+ }
+
+ };
+
+ /**
+ * Calls the togglePause() method of a SMSound object by ID.
+ *
+ * @param {string} sID The ID of the sound
+ * @return {SMSound} The SMSound object
+ */
+
+ this.togglePause = function(sID) {
+
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ return _s.sounds[sID].togglePause();
+
+ };
+
+ /**
+ * Calls the setPan() method of a SMSound object by ID.
+ *
+ * @param {string} sID The ID of the sound
+ * @param {number} nPan The pan value (-100 to 100)
+ * @return {SMSound} The SMSound object
+ */
+
+ this.setPan = function(sID, nPan) {
+
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ return _s.sounds[sID].setPan(nPan);
+
+ };
+
+ /**
+ * Calls the setVolume() method of a SMSound object by ID.
+ *
+ * @param {string} sID The ID of the sound
+ * @param {number} nVol The volume value (0 to 100)
+ * @return {SMSound} The SMSound object
+ */
+
+ this.setVolume = function(sID, nVol) {
+
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ return _s.sounds[sID].setVolume(nVol);
+
+ };
+
+ /**
+ * Calls the mute() method of either a single SMSound object by ID, or all sound objects.
+ *
+ * @param {string} sID Optional: The ID of the sound (if omitted, all sounds will be used.)
+ */
+
+ this.mute = function(sID) {
+
+ var fN = _sm+'.mute(): ',
+ i = 0;
+
+ if (typeof sID !== 'string') {
+ sID = null;
+ }
+
+ if (!sID) {
+ _s._wD(fN + 'Muting all sounds');
+ for (i = _s.soundIDs.length; i--;) {
+ _s.sounds[_s.soundIDs[i]].mute();
+ }
+ _s.muted = true;
+ } else {
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ _s._wD(fN + 'Muting "' + sID + '"');
+ return _s.sounds[sID].mute();
+ }
+
+ return true;
+
+ };
+
+ /**
+ * Mutes all sounds.
+ */
+
+ this.muteAll = function() {
+
+ _s.mute();
+
+ };
+
+ /**
+ * Calls the unmute() method of either a single SMSound object by ID, or all sound objects.
+ *
+ * @param {string} sID Optional: The ID of the sound (if omitted, all sounds will be used.)
+ */
+
+ this.unmute = function(sID) {
+
+ var fN = _sm+'.unmute(): ', i;
+
+ if (typeof sID !== 'string') {
+ sID = null;
+ }
+
+ if (!sID) {
+
+ _s._wD(fN + 'Unmuting all sounds');
+ for (i = _s.soundIDs.length; i--;) {
+ _s.sounds[_s.soundIDs[i]].unmute();
+ }
+ _s.muted = false;
+
+ } else {
+
+ if (!_idCheck(sID)) {
+ return false;
+ }
+ _s._wD(fN + 'Unmuting "' + sID + '"');
+ return _s.sounds[sID].unmute();
+
+ }
+
+ return true;
+
+ };
+
+ /**
+ * Unmutes all sounds.
+ */
+
+ this.unmuteAll = function() {
+
+ _s.unmute();
+
+ };
+
+ /**
+ * Calls the toggleMute() method of a SMSound object by ID.
+ *
+ * @param {string} sID The ID of the sound
+ * @return {SMSound} The SMSound object
+ */
+
+ this.toggleMute = function(sID) {
+
+ if (!_idCheck(sID)) {
+ return false;
+ }
+
+ return _s.sounds[sID].toggleMute();
+
+ };
+
+ /**
+ * Retrieves the memory used by the flash plugin.
+ *
+ * @return {number} The amount of memory in use
+ */
+
+ this.getMemoryUse = function() {
+
+ // flash-only
+ var ram = 0;
+
+ if (_s.o && _fV !== 8) {
+ ram = parseInt(_s.o._getMemoryUse(), 10);
+ }
+
+ return ram;
+
+ };
+
+ /**
+ * Undocumented: NOPs soundManager and all SMSound objects.
+ */
+
+ this.disable = function(bNoDisable) {
+
+ // destroy all functions
+ var i;
+
+ if (typeof bNoDisable === 'undefined') {
+ bNoDisable = false;
+ }
+
+ if (_disabled) {
+ return false;
+ }
+
+ _disabled = true;
+ _wDS('shutdown', 1);
+
+ for (i = _s.soundIDs.length; i--;) {
+ _disableObject(_s.sounds[_s.soundIDs[i]]);
+ }
+
+ // fire "complete", despite fail
+ _initComplete(bNoDisable);
+ _event.remove(_win, 'load', _initUserOnload);
+
+ return true;
+
+ };
+
+ /**
+ * Determines playability of a MIME type, eg. 'audio/mp3'.
+ */
+
+ this.canPlayMIME = function(sMIME) {
+
+ var result;
+
+ if (_s.hasHTML5) {
+ result = _html5CanPlay({type:sMIME});
+ }
+
+ if (!_needsFlash || result) {
+ // no flash, or OK
+ return result;
+ } else {
+ // if flash 9, test netStream (movieStar) types as well.
+ return (sMIME ? !!((_fV > 8 ? sMIME.match(_netStreamMimeTypes) : null) || sMIME.match(_s.mimePattern)) : null);
+ }
+
+ };
+
+ /**
+ * Determines playability of a URL based on audio support.
+ *
+ * @param {string} sURL The URL to test
+ * @return {boolean} URL playability
+ */
+
+ this.canPlayURL = function(sURL) {
+
+ var result;
+
+ if (_s.hasHTML5) {
+ result = _html5CanPlay({url: sURL});
+ }
+
+ if (!_needsFlash || result) {
+ // no flash, or OK
+ return result;
+ } else {
+ return (sURL ? !!(sURL.match(_s.filePattern)) : null);
+ }
+
+ };
+
+ /**
+ * Determines playability of an HTML DOM <a> object (or similar object literal) based on audio support.
+ *
+ * @param {object} oLink an HTML DOM <a> object or object literal including href and/or type attributes
+ * @return {boolean} URL playability
+ */
+
+ this.canPlayLink = function(oLink) {
+
+ if (typeof oLink.type !== 'undefined' && oLink.type) {
+ if (_s.canPlayMIME(oLink.type)) {
+ return true;
+ }
+ }
+
+ return _s.canPlayURL(oLink.href);
+
+ };
+
+ /**
+ * Retrieves a SMSound object by ID.
+ *
+ * @param {string} sID The ID of the sound
+ * @return {SMSound} The SMSound object
+ */
+
+ this.getSoundById = function(sID, _suppressDebug) {
+
+ if (!sID) {
+ throw new Error(_sm+'.getSoundById(): sID is null/undefined');
+ }
+
+ var result = _s.sounds[sID];
+
+ // <d>
+ if (!result && !_suppressDebug) {
+ _s._wD('"' + sID + '" is an invalid sound ID.', 2);
+ }
+ // </d>
+
+ return result;
+
+ };
+
+ /**
+ * Queues a callback for execution when SoundManager has successfully initialized.
+ *
+ * @param {function} oMethod The callback method to fire
+ * @param {object} oScope Optional: The scope to apply to the callback
+ */
+
+ this.onready = function(oMethod, oScope) {
+
+ var sType = 'onready';
+
+ if (oMethod && oMethod instanceof Function) {
+
+ // <d>
+ if (_didInit) {
+ _s._wD(_str('queue', sType));
+ }
+ // </d>
+
+ if (!oScope) {
+ oScope = _win;
+ }
+
+ _addOnEvent(sType, oMethod, oScope);
+ _processOnEvents();
+
+ return true;
+
+ } else {
+
+ throw _str('needFunction', sType);
+
+ }
+
+ };
+
+ /**
+ * Queues a callback for execution when SoundManager has failed to initialize.
+ *
+ * @param {function} oMethod The callback method to fire
+ * @param {object} oScope Optional: The scope to apply to the callback
+ */
+
+ this.ontimeout = function(oMethod, oScope) {
+
+ var sType = 'ontimeout';
+
+ if (oMethod && oMethod instanceof Function) {
+
+ // <d>
+ if (_didInit) {
+ _s._wD(_str('queue', sType));
+ }
+ // </d>
+
+ if (!oScope) {
+ oScope = _win;
+ }
+
+ _addOnEvent(sType, oMethod, oScope);
+ _processOnEvents({type:sType});
+
+ return true;
+
+ } else {
+
+ throw _str('needFunction', sType);
+
+ }
+
+ };
+
+ /**
+ * Writes console.log()-style debug output to a console or in-browser element.
+ * Applies when SoundManager.debugMode = true
+ *
+ * @param {string} sText The console message
+ * @param {string} sType Optional: Log type of 'info', 'warn' or 'error'
+ * @param {object} Optional: The scope to apply to the callback
+ */
+
+ this._writeDebug = function(sText, sType, _bTimestamp) {
+
+ // pseudo-private console.log()-style output
+ // <d>
+
+ var sDID = 'soundmanager-debug', o, oItem, sMethod;
+
+ if (!_s.debugMode) {
+ return false;
+ }
+
+ if (typeof _bTimestamp !== 'undefined' && _bTimestamp) {
+ sText = sText + ' | ' + new Date().getTime();
+ }
+
+ if (_hasConsole && _s.useConsole) {
+ sMethod = _debugLevels[sType];
+ if (typeof console[sMethod] !== 'undefined') {
+ console[sMethod](sText);
+ } else {
+ console.log(sText);
+ }
+ if (_s.useConsoleOnly) {
+ return true;
+ }
+ }
+
+ try {
+
+ o = _id(sDID);
+
+ if (!o) {
+ return false;
+ }
+
+ oItem = _doc.createElement('div');
+
+ if (++_wdCount % 2 === 0) {
+ oItem.className = 'sm2-alt';
+ }
+
+ if (typeof sType === 'undefined') {
+ sType = 0;
+ } else {
+ sType = parseInt(sType, 10);
+ }
+
+ oItem.appendChild(_doc.createTextNode(sText));
+
+ if (sType) {
+ if (sType >= 2) {
+ oItem.style.fontWeight = 'bold';
+ }
+ if (sType === 3) {
+ oItem.style.color = '#ff3333';
+ }
+ }
+
+ // top-to-bottom
+ // o.appendChild(oItem);
+
+ // bottom-to-top
+ o.insertBefore(oItem, o.firstChild);
+
+ } catch(e) {
+ // oh well
+ }
+
+ o = null;
+ // </d>
+
+ return true;
+
+ };
+
+ // alias
+ this._wD = this._writeDebug;
+
+ /**
+ * Provides debug / state information on all SMSound objects.
+ */
+
+ this._debug = function() {
+
+ // <d>
+ var i, j;
+ _wDS('currentObj', 1);
+
+ for (i = 0, j = _s.soundIDs.length; i < j; i++) {
+ _s.sounds[_s.soundIDs[i]]._debug();
+ }
+ // </d>
+
+ };
+
+ /**
+ * Restarts and re-initializes the SoundManager instance.
+ */
+
+ this.reboot = function() {
+
+ // attempt to reset and init SM2
+ _s._wD(_sm+'.reboot()');
+
+ // <d>
+ if (_s.soundIDs.length) {
+ _s._wD('Destroying ' + _s.soundIDs.length + ' SMSound objects...');
+ }
+ // </d>
+
+ var i, j;
+
+ for (i = _s.soundIDs.length; i--;) {
+ _s.sounds[_s.soundIDs[i]].destruct();
+ }
+
+ // trash ze flash
+
+ try {
+ if (_isIE) {
+ _oRemovedHTML = _s.o.innerHTML;
+ }
+ _oRemoved = _s.o.parentNode.removeChild(_s.o);
+ _s._wD('Flash movie removed.');
+ } catch(e) {
+ // uh-oh.
+ _wDS('badRemove', 2);
+ }
+
+ // actually, force recreate of movie.
+ _oRemovedHTML = _oRemoved = _needsFlash = null;
+
+ _s.enabled = _didDCLoaded = _didInit = _waitingForEI = _initPending = _didAppend = _appendSuccess = _disabled = _s.swfLoaded = false;
+ _s.soundIDs = _s.sounds = [];
+ _s.o = null;
+
+ for (i in _on_queue) {
+ if (_on_queue.hasOwnProperty(i)) {
+ for (j = _on_queue[i].length; j--;) {
+ _on_queue[i][j].fired = false;
+ }
+ }
+ }
+
+ _s._wD(_sm + ': Rebooting...');
+ _win.setTimeout(_s.beginDelayedInit, 20);
+
+ };
+
+ /**
+ * Undocumented: Determines the SM2 flash movie's load progress.
+ *
+ * @return {number or null} Percent loaded, or if invalid/unsupported, null.
+ */
+
+ this.getMoviePercent = function() {
+
+ return (_s.o && typeof _s.o.PercentLoaded !== 'undefined' ? _s.o.PercentLoaded() : null);
+
+ };
+
+ /**
+ * Additional helper for manually invoking SM2's init process after DOM Ready / window.onload().
+ */
+
+ this.beginDelayedInit = function() {
+
+ _windowLoaded = true;
+ _domContentLoaded();
+
+ setTimeout(function() {
+
+ if (_initPending) {
+ return false;
+ }
+
+ _createMovie();
+ _initMovie();
+ _initPending = true;
+
+ return true;
+
+ }, 20);
+
+ _delayWaitForEI();
+
+ };
+
+ /**
+ * Destroys the SoundManager instance and all SMSound instances.
+ */
+
+ this.destruct = function() {
+
+ _s._wD(_sm+'.destruct()');
+ _s.disable(true);
+
+ };
+
+ /**
+ * SMSound() (sound object) constructor
+ * ------------------------------------
+ *
+ * @param {object} oOptions Sound options (id and url are required attributes)
+ * @return {SMSound} The new SMSound object
+ */
+
+ SMSound = function(oOptions) {
+
+ var _t = this, _resetProperties, _stop_html5_timer, _start_html5_timer;
+ this.sID = oOptions.id;
+ this.url = oOptions.url;
+ this.options = _mixin(oOptions);
+
+ // per-play-instance-specific options
+ this.instanceOptions = this.options;
+
+ // short alias
+ this._iO = this.instanceOptions;
+
+ // assign property defaults
+ this.pan = this.options.pan;
+ this.volume = this.options.volume;
+ this._lastURL = null;
+ this.isHTML5 = false;
+ this._a = null;
+
+ /**
+ * SMSound() public methods
+ * ------------------------
+ */
+
+ this.id3 = {};
+
+ /**
+ * Writes SMSound object parameters to debug console
+ */
+
+ this._debug = function() {
+
+ // <d>
+ // pseudo-private console.log()-style output
+
+ if (_s.debugMode) {
+
+ var stuff = null, msg = [], sF, sfBracket, maxLength = 64;
+
+ for (stuff in _t.options) {
+ if (_t.options[stuff] !== null) {
+ if (_t.options[stuff] instanceof Function) {
+ // handle functions specially
+ sF = _t.options[stuff].toString();
+ // normalize spaces
+ sF = sF.replace(/\s\s+/g, ' ');
+ sfBracket = sF.indexOf('{');
+ msg.push(' ' + stuff + ': {' + sF.substr(sfBracket + 1, (Math.min(Math.max(sF.indexOf('\n') - 1, maxLength), maxLength))).replace(/\n/g, '') + '... }');
+ } else {
+ msg.push(' ' + stuff + ': ' + _t.options[stuff]);
+ }
+ }
+ }
+
+ _s._wD('SMSound() merged options: {\n' + msg.join(', \n') + '\n}');
+
+ }
+ // </d>
+
+ };
+
+ // <d>
+ this._debug();
+ // </d>
+
+ /**
+ * Begins loading a sound per its *url*.
+ *
+ * @param {object} oOptions Optional: Sound options
+ * @return {SMSound} The SMSound object
+ */
+
+ this.load = function(oOptions) {
+
+ var oS = null;
+
+ if (typeof oOptions !== 'undefined') {
+ _t._iO = _mixin(oOptions, _t.options);
+ _t.instanceOptions = _t._iO;
+ } else {
+ oOptions = _t.options;
+ _t._iO = oOptions;
+ _t.instanceOptions = _t._iO;
+ if (_t._lastURL && _t._lastURL !== _t.url) {
+ _wDS('manURL');
+ _t._iO.url = _t.url;
+ _t.url = null;
+ }
+ }
+
+ if (!_t._iO.url) {
+ _t._iO.url = _t.url;
+ }
+
+ _s._wD('SMSound.load(): ' + _t._iO.url, 1);
+
+ if (_t._iO.url === _t.url && _t.readyState !== 0 && _t.readyState !== 2) {
+ _wDS('onURL', 1);
+ return _t;
+ }
+
+ _t._lastURL = _t.url;
+ _t.loaded = false;
+ _t.readyState = 1;
+ _t.playState = 0;
+
+ // TODO: If switching from HTML5 -> flash (or vice versa), stop currently-playing audio.
+
+ if (_html5OK(_t._iO)) {
+
+ oS = _t._setup_html5(_t._iO);
+ if (!oS._called_load) {
+ _s._wD(_h5+'load: '+_t.sID);
+ _t._html5_canplay = false;
+ oS.load();
+ oS._called_load = true;
+ if (_t._iO.autoPlay) {
+ _t.play();
+ }
+ } else {
+ _s._wD(_h5+'ignoring request to load again: '+_t.sID);
+ }
+
+ } else {
+
+ try {
+ _t.isHTML5 = false;
+ _t._iO = _policyFix(_loopFix(_t._iO));
+ if (_fV === 8) {
+ _s.o._load(_t.sID, _t._iO.url, _t._iO.stream, _t._iO.autoPlay, (_t._iO.whileloading?1:0), _t._iO.loops||1, _t._iO.usePolicyFile);
+ } else {
+ _s.o._load(_t.sID, _t._iO.url, !!(_t._iO.stream), !!(_t._iO.autoPlay), _t._iO.loops||1, !!(_t._iO.autoLoad), _t._iO.usePolicyFile);
+ }
+ } catch(e) {
+ _wDS('smError', 2);
+ _debugTS('onload', false);
+ _catchError({type:'SMSOUND_LOAD_JS_EXCEPTION', fatal:true});
+
+ }
+
+ }
+
+ return _t;
+
+ };
+
+ /**
+ * Unloads a sound, canceling any open HTTP requests.
+ *
+ * @return {SMSound} The SMSound object
+ */
+
+ this.unload = function() {
+
+ // Flash 8/AS2 can't "close" a stream - fake it by loading an empty URL
+ // Flash 9/AS3: Close stream, preventing further load
+ // HTML5: Most UAs will use empty URL
+
+ if (_t.readyState !== 0) {
+
+ _s._wD('SMSound.unload(): "' + _t.sID + '"');
+
+ if (!_t.isHTML5) {
+ if (_fV === 8) {
+ _s.o._unload(_t.sID, _emptyURL);
+ } else {
+ _s.o._unload(_t.sID);
+ }
+ } else {
+ _stop_html5_timer();
+ if (_t._a) {
+ _t._a.pause();
+ _html5Unload(_t._a);
+ }
+ }
+
+ // reset load/status flags
+ _resetProperties();
+
+ }
+
+ return _t;
+
+ };
+
+ /**
+ * Unloads and destroys a sound.
+ */
+
+ this.destruct = function(_bFromSM) {
+
+ _s._wD('SMSound.destruct(): "' + _t.sID + '"');
+
+ if (!_t.isHTML5) {
+
+ // kill sound within Flash
+ // Disable the onfailure handler
+ _t._iO.onfailure = null;
+ _s.o._destroySound(_t.sID);
+
+ } else {
+
+ _stop_html5_timer();
+
+ if (_t._a) {
+ _t._a.pause();
+ _html5Unload(_t._a);
+ if (!_useGlobalHTML5Audio) {
+ _t._remove_html5_events();
+ }
+ // break obvious circular reference
+ _t._a._t = null;
+ _t._a = null;
+ }
+
+ }
+
+ if (!_bFromSM) {
+ // ensure deletion from controller
+ _s.destroySound(_t.sID, true);
+
+ }
+
+ };
+
+ /**
+ * Begins playing a sound.
+ *
+ * @param {object} oOptions Optional: Sound options
+ * @return {SMSound} The SMSound object
+ */
+
+ this.play = function(oOptions, _updatePlayState) {
+
+ var fN = 'SMSound.play(): ', allowMulti, a;
+
+ _updatePlayState = _updatePlayState === undefined ? true : _updatePlayState; // default to true
+
+ if (!oOptions) {
+ oOptions = {};
+ }
+
+ _t._iO = _mixin(oOptions, _t._iO);
+ _t._iO = _mixin(_t._iO, _t.options);
+ _t.instanceOptions = _t._iO;
+
+ // RTMP-only
+ if (_t._iO.serverURL && !_t.connected) {
+ if (!_t.getAutoPlay()) {
+ _s._wD(fN+' Netstream not connected yet - setting autoPlay');
+ _t.setAutoPlay(true);
+ }
+ // play will be called in _onconnect()
+ return _t;
+ }
+
+ if (_html5OK(_t._iO)) {
+ _t._setup_html5(_t._iO);
+ _start_html5_timer();
+ }
+
+ if (_t.playState === 1 && !_t.paused) {
+ allowMulti = _t._iO.multiShot;
+ if (!allowMulti) {
+ _s._wD(fN + '"' + _t.sID + '" already playing (one-shot)', 1);
+ return _t;
+ } else {
+ _s._wD(fN + '"' + _t.sID + '" already playing (multi-shot)', 1);
+ }
+ }
+
+ if (!_t.loaded) {
+
+ if (_t.readyState === 0) {
+
+ _s._wD(fN + 'Attempting to load "' + _t.sID + '"', 1);
+ // try to get this sound playing ASAP
+ if (!_t.isHTML5) {
+ // assign directly because setAutoPlay() increments the instanceCount
+ _t._iO.autoPlay = true;
+ }
+ _t.load(_t._iO);
+
+ } else if (_t.readyState === 2) {
+
+ _s._wD(fN + 'Could not load "' + _t.sID + '" - exiting', 2);
+ return _t;
+
+ } else {
+
+ _s._wD(fN + '"' + _t.sID + '" is loading - attempting to play..', 1);
+
+ }
+
+ } else {
+
+ _s._wD(fN + '"' + _t.sID + '"');
+
+ }
+
+ if (!_t.isHTML5 && _fV === 9 && _t.position > 0 && _t.position === _t.duration) {
+ // flash 9 needs a position reset if play() is called while at the end of a sound.
+ _s._wD(fN + '"' + _t.sID + '": Sound at end, resetting to position:0');
+ _t._iO.position = 0;
+ }
+
+ /**
+ * Streams will pause when their buffer is full if they are being loaded.
+ * In this case paused is true, but the song hasn't started playing yet.
+ * If we just call resume() the onplay() callback will never be called.
+ * So only call resume() if the position is > 0.
+ * Another reason is because options like volume won't have been applied yet.
+ */
+
+ if (_t.paused && _t.position && _t.position > 0) {
+
+ // https://gist.github.com/37b17df75cc4d7a90bf6
+ _s._wD(fN + '"' + _t.sID + '" is resuming from paused state',1);
+ _t.resume();
+
+ } else {
+
+ _s._wD(fN+'"'+ _t.sID+'" is starting to play');
+ _t.playState = 1;
+ _t.paused = false;
+
+ if (!_t.instanceCount || _t._iO.multiShotEvents || (!_t.isHTML5 && _fV > 8 && !_t.getAutoPlay())) {
+ _t.instanceCount++;
+ }
+
+ _t.position = (typeof _t._iO.position !== 'undefined' && !isNaN(_t._iO.position)?_t._iO.position:0);
+
+ if (!_t.isHTML5) {
+ _t._iO = _policyFix(_loopFix(_t._iO));
+ }
+
+ if (_t._iO.onplay && _updatePlayState) {
+ _t._iO.onplay.apply(_t);
+ _t._onplay_called = true;
+ }
+
+ _t.setVolume(_t._iO.volume, true);
+ _t.setPan(_t._iO.pan, true);
+
+ if (!_t.isHTML5) {
+ _s.o._start(_t.sID, _t._iO.loops || 1, (_fV === 9?_t._iO.position:_t._iO.position / 1000));
+ } else {
+ _start_html5_timer();
+ a = _t._setup_html5();
+ _t.setPosition(_t._iO.position);
+ a.play();
+ }
+
+ }
+
+ return _t;
+
+ };
+
+ // just for convenience
+ this.start = this.play;
+
+ /**
+ * Stops playing a sound (and optionally, all sounds)
+ *
+ * @param {boolean} bAll Optional: Whether to stop all sounds
+ * @return {SMSound} The SMSound object
+ */
+
+ this.stop = function(bAll) {
+
+ if (_t.playState === 1) {
+
+ _t._onbufferchange(0);
+ _t.resetOnPosition(0);
+ _t.paused = false;
+
+ if (!_t.isHTML5) {
+ _t.playState = 0;
+ }
+
+ if (_t._iO.onstop) {
+ _t._iO.onstop.apply(_t);
+ }
+
+ if (!_t.isHTML5) {
+
+ _s.o._stop(_t.sID, bAll);
+ // hack for netStream: just unload
+ if (_t._iO.serverURL) {
+ _t.unload();
+ }
+
+ } else {
+
+ if (_t._a) {
+
+ // act like Flash, though
+ _t.setPosition(0);
+
+ // html5 has no stop()
+ _t._a.pause();
+
+ _t.playState = 0;
+
+ // and update UI
+ _t._onTimer();
+
+ _stop_html5_timer();
+
+ }
+
+ }
+
+ _t.instanceCount = 0;
+ _t._iO = {};
+
+ }
+
+ return _t;
+
+ };
+
+ /**
+ * Undocumented/internal: Sets autoPlay for RTMP.
+ *
+ * @param {boolean} autoPlay state
+ */
+
+ this.setAutoPlay = function(autoPlay) {
+
+ _s._wD('sound '+_t.sID+' turned autoplay ' + (autoPlay ? 'on' : 'off'));
+ _t._iO.autoPlay = autoPlay;
+
+ if (!_t.isHTML5) {
+ _s.o._setAutoPlay(_t.sID, autoPlay);
+ if (autoPlay) {
+ // only increment the instanceCount if the sound isn't loaded (TODO: verify RTMP)
+ if (!_t.instanceCount && _t.readyState === 1) {
+ _t.instanceCount++;
+ _s._wD('sound '+_t.sID+' incremented instance count to '+_t.instanceCount);
+ }
+ }
+ }
+
+ };
+
+ /**
+ * Undocumented/internal: Returns the autoPlay boolean.
+ *
+ * @return {boolean} The current autoPlay value
+ */
+
+ this.getAutoPlay = function() {
+
+ return _t._iO.autoPlay;
+
+ };
+
+ /**
+ * Sets the position of a sound.
+ *
+ * @param {number} nMsecOffset Position (milliseconds)
+ * @return {SMSound} The SMSound object
+ */
+
+ this.setPosition = function(nMsecOffset) {
+
+ if (nMsecOffset === undefined) {
+ nMsecOffset = 0;
+ }
+
+ var original_pos,
+ position, position1K,
+ // Use the duration from the instance options, if we don't have a track duration yet.
+ // position >= 0 and <= current available (loaded) duration
+ offset = (_t.isHTML5 ? Math.max(nMsecOffset,0) : Math.min(_t.duration || _t._iO.duration, Math.max(nMsecOffset, 0)));
+
+ original_pos = _t.position;
+ _t.position = offset;
+ position1K = _t.position/1000;
+ _t.resetOnPosition(_t.position);
+ _t._iO.position = offset;
+
+ if (!_t.isHTML5) {
+
+ position = (_fV === 9 ? _t.position : position1K);
+ if (_t.readyState && _t.readyState !== 2) {
+ // if paused or not playing, will not resume (by playing)
+ _s.o._setPosition(_t.sID, position, (_t.paused || !_t.playState));
+ }
+
+ } else if (_t._a) {
+
+ // Set the position in the canplay handler if the sound is not ready yet
+ if (_t._html5_canplay) {
+ if (_t._a.currentTime !== position1K) {
+ /*
+ * DOM/JS errors/exceptions to watch out for:
+ * if seek is beyond (loaded?) position, "DOM exception 11"
+ * "INDEX_SIZE_ERR": DOM exception 1
+ */
+ _s._wD('setPosition('+position1K+'): setting position');
+ try {
+ _t._a.currentTime = position1K;
+ if (_t.playState === 0 || _t.paused) {
+ // allow seek without auto-play/resume
+ _t._a.pause();
+ }
+ } catch(e) {
+ _s._wD('setPosition('+position1K+'): setting position failed: '+e.message, 2);
+ }
+ }
+ } else {
+ _s._wD('setPosition('+position1K+'): delaying, sound not ready');
+ }
+
+ }
+
+ if (_t.isHTML5) {
+ if (_t.paused) {
+ // if paused, refresh UI right away
+ // force update
+ _t._onTimer(true);
+ }
+ }
+
+ return _t;
+
+ };
+
+ /**
+ * Pauses sound playback.
+ *
+ * @return {SMSound} The SMSound object
+ */
+
+ this.pause = function(_bCallFlash) {
+
+ if (_t.paused || (_t.playState === 0 && _t.readyState !== 1)) {
+ return _t;
+ }
+
+ _s._wD('SMSound.pause()');
+ _t.paused = true;
+
+ if (!_t.isHTML5) {
+ if (_bCallFlash || _bCallFlash === undefined) {
+ _s.o._pause(_t.sID);
+ }
+ } else {
+ _t._setup_html5().pause();
+ _stop_html5_timer();
+ }
+
+ if (_t._iO.onpause) {
+ _t._iO.onpause.apply(_t);
+ }
+
+ return _t;
+
+ };
+
+ /**
+ * Resumes sound playback.
+ *
+ * @return {SMSound} The SMSound object
+ */
+
+ /**
+ * When auto-loaded streams pause on buffer full they have a playState of 0.
+ * We need to make sure that the playState is set to 1 when these streams "resume".
+ * When a paused stream is resumed, we need to trigger the onplay() callback if it
+ * hasn't been called already. In this case since the sound is being played for the
+ * first time, I think it's more appropriate to call onplay() rather than onresume().
+ */
+
+ this.resume = function() {
+
+ if (!_t.paused) {
+ return _t;
+ }
+
+ _s._wD('SMSound.resume()');
+ _t.paused = false;
+ _t.playState = 1;
+
+ if (!_t.isHTML5) {
+ if (_t._iO.isMovieStar) {
+ // Bizarre Webkit bug (Chrome reported via 8tracks.com dudes): AAC content paused for 30+ seconds(?) will not resume without a reposition.
+ _t.setPosition(_t.position);
+ }
+ // flash method is toggle-based (pause/resume)
+ _s.o._pause(_t.sID);
+ } else {
+ _t._setup_html5().play();
+ _start_html5_timer();
+ }
+
+ if (!_t._onplay_called && _t._iO.onplay) {
+ _t._iO.onplay.apply(_t);
+ _t._onplay_called = true;
+ } else if (_t._iO.onresume) {
+ _t._iO.onresume.apply(_t);
+ }
+
+ return _t;
+
+ };
+
+ /**
+ * Toggles sound playback.
+ *
+ * @return {SMSound} The SMSound object
+ */
+
+ this.togglePause = function() {
+
+ _s._wD('SMSound.togglePause()');
+
+ if (_t.playState === 0) {
+ _t.play({
+ position: (_fV === 9 && !_t.isHTML5 ? _t.position : _t.position / 1000)
+ });
+ return _t;
+ }
+
+ if (_t.paused) {
+ _t.resume();
+ } else {
+ _t.pause();
+ }
+
+ return _t;
+
+ };
+
+ /**
+ * Sets the panning (L-R) effect.
+ *
+ * @param {number} nPan The pan value (-100 to 100)
+ * @return {SMSound} The SMSound object
+ */
+
+ this.setPan = function(nPan, bInstanceOnly) {
+
+ if (typeof nPan === 'undefined') {
+ nPan = 0;
+ }
+
+ if (typeof bInstanceOnly === 'undefined') {
+ bInstanceOnly = false;
+ }
+
+ if (!_t.isHTML5) {
+ _s.o._setPan(_t.sID, nPan);
+ } // else { no HTML5 pan? }
+
+ _t._iO.pan = nPan;
+
+ if (!bInstanceOnly) {
+ _t.pan = nPan;
+ _t.options.pan = nPan;
+ }
+
+ return _t;
+
+ };
+
+ /**
+ * Sets the volume.
+ *
+ * @param {number} nVol The volume value (0 to 100)
+ * @return {SMSound} The SMSound object
+ */
+
+ this.setVolume = function(nVol, _bInstanceOnly) {
+
+ if (typeof nVol === 'undefined') {
+ nVol = 100;
+ }
+
+ if (typeof _bInstanceOnly === 'undefined') {
+ _bInstanceOnly = false;
+ }
+
+ if (!_t.isHTML5) {
+ _s.o._setVolume(_t.sID, (_s.muted && !_t.muted) || _t.muted?0:nVol);
+ } else if (_t._a) {
+ _t._a.volume = Math.max(0, Math.min(1, nVol/100)); // valid range: 0-1
+ }
+
+ _t._iO.volume = nVol;
+
+ if (!_bInstanceOnly) {
+ _t.volume = nVol;
+ _t.options.volume = nVol;
+ }
+
+ return _t;
+
+ };
+
+ /**
+ * Mutes the sound.
+ *
+ * @return {SMSound} The SMSound object
+ */
+
+ this.mute = function() {
+
+ _t.muted = true;
+
+ if (!_t.isHTML5) {
+ _s.o._setVolume(_t.sID, 0);
+ } else if (_t._a) {
+ _t._a.muted = true;
+ }
+
+ return _t;
+
+ };
+
+ /**
+ * Unmutes the sound.
+ *
+ * @return {SMSound} The SMSound object
+ */
+
+ this.unmute = function() {
+
+ _t.muted = false;
+ var hasIO = typeof _t._iO.volume !== 'undefined';
+
+ if (!_t.isHTML5) {
+ _s.o._setVolume(_t.sID, hasIO?_t._iO.volume:_t.options.volume);
+ } else if (_t._a) {
+ _t._a.muted = false;
+ }
+
+ return _t;
+
+ };
+
+ /**
+ * Toggles the muted state of a sound.
+ *
+ * @return {SMSound} The SMSound object
+ */
+
+ this.toggleMute = function() {
+
+ return (_t.muted?_t.unmute():_t.mute());
+
+ };
+
+ /**
+ * Calls the onposition() method of a SMSound object.
+ *
+ * @param {number} nPosition The position to watch for
+ * @param {function} oMethod The relevant callback to fire
+ * @param {object} oScope Optional: The scope to apply the callback to
+ * @return {SMSound} The SMSound object
+ */
+
+ this.onposition = function(nPosition, oMethod, oScope) {
+
+ // TODO: allow for ranges, too? eg. (nPosition instanceof Array)
+
+ _t._onPositionItems.push({
+ position: nPosition,
+ method: oMethod,
+ scope: (typeof oScope !== 'undefined'?oScope:_t),
+ fired: false
+ });
+
+ return _t;
+
+ };
+
+ /**
+ * TODO: This should be marked as pseudo-private.
+ */
+
+ this.processOnPosition = function() {
+
+ var i, item, j = _t._onPositionItems.length;
+
+ if (!j || !_t.playState || _t._onPositionFired >= j) {
+ return false;
+ }
+
+ for (i=j; i--;) {
+ item = _t._onPositionItems[i];
+ if (!item.fired && _t.position >= item.position) {
+ item.fired = true;
+ _s._onPositionFired++;
+ item.method.apply(item.scope,[item.position]);
+ }
+ }
+
+ return true;
+
+ };
+
+ this.resetOnPosition = function(nPosition) {
+
+ // reset "fired" for items interested in this position
+ var i, item, j = _t._onPositionItems.length;
+
+ if (!j) {
+ return false;
+ }
+
+ for (i=j; i--;) {
+ item = _t._onPositionItems[i];
+ if (item.fired && nPosition <= item.position) {
+ item.fired = false;
+ _s._onPositionFired--;
+ }
+ }
+
+ return true;
+
+ };
+
+ /**
+ * SoundManager() private internals
+ * --------------------------------
+ */
+
+ _start_html5_timer = function() {
+
+ if (_t.isHTML5) {
+ _startTimer(_t);
+ }
+
+ };
+
+ _stop_html5_timer = function() {
+
+ if (_t.isHTML5) {
+ _stopTimer(_t);
+ }
+
+ };
+
+ _resetProperties = function() {
+
+ _t._onPositionItems = [];
+ _t._onPositionFired = 0;
+ _t._hasTimer = null;
+ _t._onplay_called = false;
+ _t._a = null;
+ _t._html5_canplay = false;
+ _t.bytesLoaded = null;
+ _t.bytesTotal = null;
+ _t.position = null;
+ _t.duration = (_t._iO && _t._iO.duration?_t._iO.duration:null);
+ _t.durationEstimate = null;
+ _t.failures = 0;
+ _t.loaded = false;
+ _t.playState = 0;
+ _t.paused = false;
+
+ // 0 = uninitialised, 1 = loading, 2 = failed/error, 3 = loaded/success
+ _t.readyState = 0;
+
+ _t.muted = false;
+ _t.isBuffering = false;
+ _t.instanceOptions = {};
+ _t.instanceCount = 0;
+
+ _t.peakData = {
+ left: 0,
+ right: 0
+ };
+
+ _t.waveformData = {
+ left: [],
+ right: []
+ };
+
+ // legacy: 1D array
+ _t.eqData = [];
+
+ _t.eqData.left = [];
+ _t.eqData.right = [];
+
+ };
+
+ _resetProperties();
+
+ /**
+ * Pseudo-private SMSound internals
+ * --------------------------------
+ */
+
+ this._onTimer = function(bForce) {
+
+ // HTML5-only _whileplaying() etc.
+
+ var time, x = {};
+
+ if (_t._hasTimer || bForce) {
+
+ // TODO: May not need to track readyState (1 = loading)
+
+ if (_t._a && (bForce || ((_t.playState > 0 || _t.readyState === 1) && !_t.paused))) {
+
+ _t.duration = _t._get_html5_duration();
+ _t.durationEstimate = _t.duration;
+ time = _t._a.currentTime?_t._a.currentTime*1000:0;
+ _t._whileplaying(time,x,x,x,x);
+ return true;
+
+ } else {
+
+ _s._wD('_onTimer: Warn for "'+_t.sID+'": '+(!_t._a?'Could not find element. ':'')+(_t.playState === 0?'playState bad, 0?':'playState = '+_t.playState+', OK'));
+ return false;
+
+ }
+
+ }
+
+ };
+
+ this._get_html5_duration = function() {
+
+ var d = (_t._a ? _t._a.duration*1000 : (_t._iO ? _t._iO.duration : undefined)),
+ result = (d && !isNaN(d) && d !== Infinity ? d : (_t._iO ? _t._iO.duration : null));
+
+ return result;
+
+ };
+
+ this._setup_html5 = function(oOptions) {
+
+ var _iO = _mixin(_t._iO, oOptions), d = decodeURI,
+ _a = _useGlobalHTML5Audio ? _s._global_a : _t._a,
+ _dURL = d(_iO.url),
+ _oldIO = (_a && _a._t ? _a._t.instanceOptions : null);
+
+ if (_a) {
+
+ if (_a._t && _oldIO.url === _iO.url && (!_t._lastURL || (_t._lastURL === _oldIO.url))) {
+ // same url, ignore request
+ return _a;
+ }
+
+ _s._wD('setting new URL on existing object: ' + _dURL + (_t._lastURL ? ', old URL: ' + _t._lastURL : ''));
+
+ /**
+ * "First things first, I, Poppa.." (reset the previous state of the old sound, if playing)
+ * Fixes case with devices that can only play one sound at a time
+ * Otherwise, other sounds in mid-play will be terminated without warning and in a stuck state
+ */
+
+ if (_useGlobalHTML5Audio && _a._t && _a._t.playState && _iO.url !== _oldIO.url) {
+ _a._t.stop();
+ }
+
+ // new URL, so reset load/playstate and so on
+ _resetProperties();
+
+ _a.src = _iO.url;
+ _t.url = _iO.url;
+ _t._lastURL = _iO.url;
+ _a._called_load = false;
+
+ } else {
+
+ _s._wD('creating HTML5 Audio() element with URL: '+_dURL);
+ _a = new Audio(_iO.url);
+ _a._called_load = false;
+
+ if (_useGlobalHTML5Audio) {
+ _s._global_a = _a;
+ }
+
+ }
+ _t.isHTML5 = true;
+
+ // store a ref on the track
+ _t._a = _a;
+
+ // store a ref on the audio
+ _a._t = _t;
+
+ _t._add_html5_events();
+ _a.loop = (_iO.loops>1?'loop':'');
+
+ if (_iO.autoLoad || _iO.autoPlay) {
+
+ // early HTML5 implementation (non-standard)
+ _a.autobuffer = 'auto';
+
+ // standard
+ _a.preload = 'auto';
+
+ _t.load();
+ _a._called_load = true;
+
+ } else {
+
+ // early HTML5 implementation (non-standard)
+ _a.autobuffer = false;
+
+ // standard
+ _a.preload = 'none';
+
+ }
+
+ // boolean instead of "loop", for webkit? - spec says string. http://www.w3.org/TR/html-markup/audio.html#audio.attrs.loop
+ _a.loop = (_iO.loops>1?'loop':'');
+
+ return _a;
+
+ };
+
+ this._add_html5_events = function() {
+
+ if (_t._a._added_events) {
+ return false;
+ }
+
+ var f;
+
+ function add(oEvt, oFn, bCapture) {
+ return _t._a ? _t._a.addEventListener(oEvt, oFn, bCapture||false) : null;
+ }
+
+ _s._wD(_h5+'adding event listeners: '+_t.sID);
+ _t._a._added_events = true;
+
+ for (f in _html5_events) {
+ if (_html5_events.hasOwnProperty(f)) {
+ add(f, _html5_events[f]);
+ }
+ }
+
+ return true;
+
+ };
+
+ this._remove_html5_events = function() {
+
+ // Remove event listeners
+
+ var f;
+
+ function remove(oEvt, oFn, bCapture) {
+ return (_t._a ? _t._a.removeEventListener(oEvt, oFn, bCapture||false) : null);
+ }
+
+ _s._wD(_h5+'removing event listeners: '+_t.sID);
+ _t._a._added_events = false;
+
+ for (f in _html5_events) {
+ if (_html5_events.hasOwnProperty(f)) {
+ remove(f, _html5_events[f]);
+ }
+ }
+
+ };
+
+ /**
+ * Pseudo-private event internals
+ * ------------------------------
+ */
+
+ this._onload = function(nSuccess) {
+
+
+ var fN = 'SMSound._onload(): ', loadOK = !!(nSuccess);
+ _s._wD(fN + '"' + _t.sID + '"' + (loadOK?' loaded.':' failed to load? - ' + _t.url), (loadOK?1:2));
+ // <d>
+
+ if (!loadOK && !_t.isHTML5) {
+ if (_s.sandbox.noRemote === true) {
+ _s._wD(fN + _str('noNet'), 1);
+ }
+ if (_s.sandbox.noLocal === true) {
+ _s._wD(fN + _str('noLocal'), 1);
+ }
+ }
+ // </d>
+
+ _t.loaded = loadOK;
+ _t.readyState = loadOK?3:2;
+ _t._onbufferchange(0);
+
+ if (_t._iO.onload) {
+ _t._iO.onload.apply(_t, [loadOK]);
+ }
+
+ return true;
+
+ };
+
+ this._onbufferchange = function(nIsBuffering) {
+
+ var fN = 'SMSound._onbufferchange()';
+
+ if (_t.playState === 0) {
+ // ignore if not playing
+ return false;
+ }
+
+ if ((nIsBuffering && _t.isBuffering) || (!nIsBuffering && !_t.isBuffering)) {
+ return false;
+ }
+
+ _t.isBuffering = (nIsBuffering === 1);
+ if (_t._iO.onbufferchange) {
+ _s._wD(fN + ': ' + nIsBuffering);
+ _t._iO.onbufferchange.apply(_t);
+ }
+
+ return true;
+
+ };
+
+ /**
+ * flash 9/movieStar + RTMP-only method, should fire only once at most
+ * at this point we just recreate failed sounds rather than trying to reconnect
+ */
+
+ this._onfailure = function(msg, level, code) {
+
+ _t.failures++;
+ _s._wD('SMSound._onfailure(): "'+_t.sID+'" count '+_t.failures);
+ if (_t._iO.onfailure && _t.failures === 1) {
+ _t._iO.onfailure(_t, msg, level, code);
+ } else {
+ _s._wD('SMSound._onfailure(): ignoring');
+ }
+
+ };
+
+ this._onfinish = function() {
+
+ // store local copy before it gets trashed..
+ var _io_onfinish = _t._iO.onfinish;
+ _t._onbufferchange(0);
+ _t.resetOnPosition(0);
+
+ // reset some state items
+ if (_t.instanceCount) {
+
+ _t.instanceCount--;
+ if (!_t.instanceCount) {
+ // reset instance options
+ _t.playState = 0;
+ _t.paused = false;
+ _t.instanceCount = 0;
+ _t.instanceOptions = {};
+ _t._iO = {};
+ _stop_html5_timer();
+ }
+
+ if (!_t.instanceCount || _t._iO.multiShotEvents) {
+ // fire onfinish for last, or every instance
+ if (_io_onfinish) {
+ _s._wD('SMSound._onfinish(): "' + _t.sID + '"');
+ _io_onfinish.apply(_t);
+ }
+ }
+
+ }
+
+ };
+
+ this._whileloading = function(nBytesLoaded, nBytesTotal, nDuration, nBufferLength) {
+
+ _t.bytesLoaded = nBytesLoaded;
+ _t.bytesTotal = nBytesTotal;
+ _t.duration = Math.floor(nDuration);
+ _t.bufferLength = nBufferLength;
+
+ if (!_t._iO.isMovieStar) {
+
+ if (_t._iO.duration) {
+ // use options, if specified and larger
+ _t.durationEstimate = (_t.duration > _t._iO.duration) ? _t.duration : _t._iO.duration;
+ } else {
+ _t.durationEstimate = parseInt((_t.bytesTotal / _t.bytesLoaded) * _t.duration, 10);
+
+ }
+
+ if (_t.durationEstimate === undefined) {
+ _t.durationEstimate = _t.duration;
+ }
+
+ if (_t.readyState !== 3 && _t._iO.whileloading) {
+ _t._iO.whileloading.apply(_t);
+ }
+
+ } else {
+
+ _t.durationEstimate = _t.duration;
+ if (_t.readyState !== 3 && _t._iO.whileloading) {
+ _t._iO.whileloading.apply(_t);
+ }
+
+ }
+
+ };
+
+ this._whileplaying = function(nPosition, oPeakData, oWaveformDataLeft, oWaveformDataRight, oEQData) {
+
+ if (isNaN(nPosition) || nPosition === null) {
+ // flash safety net
+ return false;
+ }
+
+ _t.position = nPosition;
+ _t.processOnPosition();
+
+ if (!_t.isHTML5 && _fV > 8) {
+
+ if (_t._iO.usePeakData && typeof oPeakData !== 'undefined' && oPeakData) {
+ _t.peakData = {
+ left: oPeakData.leftPeak,
+ right: oPeakData.rightPeak
+ };
+ }
+
+ if (_t._iO.useWaveformData && typeof oWaveformDataLeft !== 'undefined' && oWaveformDataLeft) {
+ _t.waveformData = {
+ left: oWaveformDataLeft.split(','),
+ right: oWaveformDataRight.split(',')
+ };
+ }
+
+ if (_t._iO.useEQData) {
+ if (typeof oEQData !== 'undefined' && oEQData && oEQData.leftEQ) {
+ var eqLeft = oEQData.leftEQ.split(',');
+ _t.eqData = eqLeft;
+ _t.eqData.left = eqLeft;
+ if (typeof oEQData.rightEQ !== 'undefined' && oEQData.rightEQ) {
+ _t.eqData.right = oEQData.rightEQ.split(',');
+ }
+ }
+ }
+
+ }
+
+ if (_t.playState === 1) {
+
+ // special case/hack: ensure buffering is false if loading from cache (and not yet started)
+ if (!_t.isHTML5 && _fV === 8 && !_t.position && _t.isBuffering) {
+ _t._onbufferchange(0);
+ }
+
+ if (_t._iO.whileplaying) {
+ // flash may call after actual finish
+ _t._iO.whileplaying.apply(_t);
+ }
+
+ }
+
+ return true;
+
+ };
+
+ this._onid3 = function(oID3PropNames, oID3Data) {
+
+ // oID3PropNames: string array (names)
+ // ID3Data: string array (data)
+ _s._wD('SMSound._onid3(): "' + this.sID + '" ID3 data received.');
+
+ var oData = [], i, j;
+
+ for (i = 0, j = oID3PropNames.length; i < j; i++) {
+ oData[oID3PropNames[i]] = oID3Data[i];
+ }
+ _t.id3 = _mixin(_t.id3, oData);
+
+ if (_t._iO.onid3) {
+ _t._iO.onid3.apply(_t);
+ }
+
+ };
+
+ // flash/RTMP-only
+
+ this._onconnect = function(bSuccess) {
+
+ var fN = 'SMSound._onconnect(): ';
+ bSuccess = (bSuccess === 1);
+ _s._wD(fN+'"'+_t.sID+'"'+(bSuccess?' connected.':' failed to connect? - '+_t.url), (bSuccess?1:2));
+ _t.connected = bSuccess;
+
+ if (bSuccess) {
+
+ _t.failures = 0;
+
+ if (_idCheck(_t.sID)) {
+ if (_t.getAutoPlay()) {
+ // only update the play state if auto playing
+ _t.play(undefined, _t.getAutoPlay());
+ } else if (_t._iO.autoLoad) {
+ _t.load();
+ }
+ }
+
+ if (_t._iO.onconnect) {
+ _t._iO.onconnect.apply(_t,[bSuccess]);
+ }
+
+ }
+
+ };
+
+ this._ondataerror = function(sError) {
+
+ // flash 9 wave/eq data handler
+ // hack: called at start, and end from flash at/after onfinish()
+ if (_t.playState > 0) {
+ _s._wD('SMSound._ondataerror(): ' + sError);
+ if (_t._iO.ondataerror) {
+ _t._iO.ondataerror.apply(_t);
+ }
+ }
+
+ };
+
+ }; // SMSound()
+
+ /**
+ * Private SoundManager internals
+ * ------------------------------
+ */
+
+ _getDocument = function() {
+
+ return (_doc.body || _doc._docElement || _doc.getElementsByTagName('div')[0]);
+
+ };
+
+ _id = function(sID) {
+
+ return _doc.getElementById(sID);
+
+ };
+
+ _mixin = function(oMain, oAdd) {
+
+ // non-destructive merge
+ var o1 = {}, i, o2, o;
+
+ // clone c1
+ for (i in oMain) {
+ if (oMain.hasOwnProperty(i)) {
+ o1[i] = oMain[i];
+ }
+ }
+
+ o2 = (typeof oAdd === 'undefined'?_s.defaultOptions:oAdd);
+ for (o in o2) {
+ if (o2.hasOwnProperty(o) && typeof o1[o] === 'undefined') {
+ o1[o] = o2[o];
+ }
+ }
+ return o1;
+
+ };
+
+ _event = (function() {
+
+ var old = (_win.attachEvent),
+ evt = {
+ add: (old?'attachEvent':'addEventListener'),
+ remove: (old?'detachEvent':'removeEventListener')
+ };
+
+ function getArgs(oArgs) {
+
+ var args = _slice.call(oArgs), len = args.length;
+
+ if (old) {
+ // prefix
+ args[1] = 'on' + args[1];
+ if (len > 3) {
+ // no capture
+ args.pop();
+ }
+ } else if (len === 3) {
+ args.push(false);
+ }
+ return args;
+
+ }
+
+ function apply(args, sType) {
+
+ var element = args.shift(),
+ method = [evt[sType]];
+
+ if (old) {
+ element[method](args[0], args[1]);
+ } else {
+ element[method].apply(element, args);
+ }
+
+ }
+
+ function add() {
+
+ apply(getArgs(arguments), 'add');
+
+ }
+
+ function remove() {
+
+ apply(getArgs(arguments), 'remove');
+
+ }
+
+ return {
+ 'add': add,
+ 'remove': remove
+ };
+
+ }());
+
+ /**
+ * Internal HTML5 event handling
+ * -----------------------------
+ */
+
+ function _html5_event(oFn) {
+
+ // wrap html5 event handlers so we don't call them on destroyed sounds
+
+ return function(e) {
+
+ if (!this._t || !this._t._a) {
+ // <d>
+ if (this._t && this._t.sID) {
+ _s._wD(_h5+'ignoring '+e.type+': '+this._t.sID);
+ } else {
+ _s._wD(_h5+'ignoring '+e.type);
+ }
+ // </d>
+ return null;
+ } else {
+ return oFn.call(this, e);
+ }
+
+ };
+
+ }
+
+ _html5_events = {
+
+ // HTML5 event-name-to-handler map
+
+ abort: _html5_event(function(e) {
+
+ _s._wD(_h5+'abort: '+this._t.sID);
+
+ }),
+
+ // enough has loaded to play
+
+ canplay: _html5_event(function(e) {
+
+ if (this._t._html5_canplay) {
+ // this event has already fired. ignore.
+ return true;
+ }
+
+ this._t._html5_canplay = true;
+ _s._wD(_h5+'canplay: '+this._t.sID+', '+this._t.url);
+ this._t._onbufferchange(0);
+ var position1K = (!isNaN(this._t.position)?this._t.position/1000:null);
+
+ // set the position if position was set before the sound loaded
+ if (this._t.position && this.currentTime !== position1K) {
+ _s._wD(_h5+'canplay: setting position to '+position1K);
+ try {
+ this.currentTime = position1K;
+ } catch(ee) {
+ _s._wD(_h5+'setting position failed: '+ee.message, 2);
+ }
+ }
+
+ }),
+
+ load: _html5_event(function(e) {
+
+ if (!this._t.loaded) {
+ this._t._onbufferchange(0);
+ // should be 1, and the same
+ this._t._whileloading(this._t.bytesTotal, this._t.bytesTotal, this._t._get_html5_duration());
+ this._t._onload(true);
+ }
+
+ }),
+
+ emptied: _html5_event(function(e) {
+
+ _s._wD(_h5+'emptied: '+this._t.sID);
+
+ }),
+
+ ended: _html5_event(function(e) {
+
+ _s._wD(_h5+'ended: '+this._t.sID);
+ this._t._onfinish();
+
+ }),
+
+ error: _html5_event(function(e) {
+
+ _s._wD(_h5+'error: '+this.error.code);
+ // call load with error state?
+ this._t._onload(false);
+
+ }),
+
+ loadeddata: _html5_event(function(e) {
+
+ var t = this._t,
+ // at least 1 byte, so math works
+ bytesTotal = t.bytesTotal || 1;
+
+ _s._wD(_h5+'loadeddata: '+this._t.sID);
+
+ // safari seems to nicely report progress events, eventually totalling 100%
+ if (!t._loaded && !_isSafari) {
+ t.duration = t._get_html5_duration();
+ // fire whileloading() with 100% values
+ t._whileloading(bytesTotal, bytesTotal, t._get_html5_duration());
+ t._onload(true);
+ }
+
+ }),
+
+ loadedmetadata: _html5_event(function(e) {
+
+ _s._wD(_h5+'loadedmetadata: '+this._t.sID);
+
+ }),
+
+ loadstart: _html5_event(function(e) {
+
+ _s._wD(_h5+'loadstart: '+this._t.sID);
+ // assume buffering at first
+ this._t._onbufferchange(1);
+
+ }),
+
+ play: _html5_event(function(e) {
+
+ _s._wD(_h5+'play: '+this._t.sID+', '+this._t.url);
+ // once play starts, no buffering
+ this._t._onbufferchange(0);
+
+ }),
+
+ // TODO: verify if this is actually implemented anywhere yet.
+ playing: _html5_event(function(e) {
+
+ _s._wD(_h5+'playing: '+this._t.sID+', '+this._t.url);
+
+ // once play starts, no buffering
+ this._t._onbufferchange(0);
+
+ }),
+
+ progress: _html5_event(function(e) {
+
+ if (this._t.loaded) {
+ return false;
+ }
+
+ var i, j, str, buffered = 0,
+ isProgress = (e.type === 'progress'),
+ ranges = e.target.buffered,
+
+ // firefox 3.6 implements e.loaded/total (bytes)
+ loaded = (e.loaded||0),
+
+ total = (e.total||1);
+
+ if (ranges && ranges.length) {
+
+ // if loaded is 0, try TimeRanges implementation as % of load
+ // https://developer.mozilla.org/en/DOM/TimeRanges
+
+ for (i=ranges.length; i--;) {
+ buffered = (ranges.end(i) - ranges.start(i));
+ }
+
+ // linear case, buffer sum; does not account for seeking and HTTP partials / byte ranges
+ loaded = buffered/e.target.duration;
+
+ // <d>
+ if (isProgress && ranges.length > 1) {
+ str = [];
+ j = ranges.length;
+ for (i=0; i<j; i++) {
+ str.push(e.target.buffered.start(i) +'-'+ e.target.buffered.end(i));
+ }
+ _s._wD(_h5+'progress: timeRanges: '+str.join(', '));
+ }
+
+ if (isProgress && !isNaN(loaded)) {
+ _s._wD(_h5+'progress: '+this._t.sID+': ' + Math.floor(loaded*100)+'% loaded');
+ }
+ // </d>
+
+ }
+
+ if (!isNaN(loaded)) {
+
+ // if progress, likely not buffering
+ this._t._onbufferchange(0);
+ this._t._whileloading(loaded, total, this._t._get_html5_duration());
+ if (loaded && total && loaded === total) {
+ // in case "onload" doesn't fire (eg. gecko 1.9.2)
+ _html5_events.load.call(this, e);
+ }
+
+ }
+
+ }),
+
+ ratechange: _html5_event(function(e) {
+
+ _s._wD(_h5+'ratechange: '+this._t.sID);
+
+ }),
+
+ suspend: _html5_event(function(e) {
+
+ // download paused/stopped, may have finished (eg. onload)
+
+ _s._wD(_h5+'suspend: '+this._t.sID);
+ _html5_events.progress.call(this, e);
+
+ }),
+
+ stalled: _html5_event(function(e) {
+
+ _s._wD(_h5+'stalled: '+this._t.sID);
+
+ }),
+
+ timeupdate: _html5_event(function(e) {
+
+ this._t._onTimer();
+
+ }),
+
+ waiting: _html5_event(function(e) {
+
+ // see also: seeking
+ _s._wD(_h5+'waiting: '+this._t.sID);
+
+ // playback faster than download rate, etc.
+ this._t._onbufferchange(1);
+
+ })
+
+ };
+
+ _html5OK = function(iO) {
+
+ // Use type, if specified. If HTML5-only mode, no other options, so just give 'er
+ return (!iO.serverURL && (iO.type?_html5CanPlay({type:iO.type}):_html5CanPlay({url:iO.url})||_s.html5Only));
+
+ };
+
+ _html5Unload = function(oAudio) {
+
+ /**
+ * Internal method: Unload media, and cancel any current/pending network requests.
+ * Firefox can load an empty URL, which allegedly destroys the decoder and stops the download.
+ * https://developer.mozilla.org/En/Using_audio_and_video_in_Firefox#Stopping_the_download_of_media
+ * Other UA behaviour is unclear, so everyone else gets an about:blank-style URL.
+ */
+
+ if (oAudio) {
+ oAudio.src = (_ua.match(/gecko/i) ? '' : _emptyURL);
+ }
+
+ };
+
+ _html5CanPlay = function(o) {
+
+ /**
+ * Try to find MIME, test and return truthiness
+ * o = {
+ * url: '/path/to/an.mp3',
+ * type: 'audio/mp3'
+ * }
+ */
+
+ if (!_s.useHTML5Audio || !_s.hasHTML5) {
+ return false;
+ }
+
+ var url = (o.url || null),
+ mime = (o.type || null),
+ aF = _s.audioFormats,
+ result,
+ offset,
+ fileExt,
+ item;
+
+ function preferFlashCheck(kind) {
+
+ // whether flash should play a given type
+ return (_s.preferFlash && _hasFlash && !_s.ignoreFlash && (typeof _s.flash[kind] !== 'undefined' && _s.flash[kind]));
+
+ }
+
+ // account for known cases like audio/mp3
+
+ if (mime && _s.html5[mime] !== 'undefined') {
+ return (_s.html5[mime] && !preferFlashCheck(mime));
+ }
+
+ if (!_html5Ext) {
+ _html5Ext = [];
+ for (item in aF) {
+ if (aF.hasOwnProperty(item)) {
+ _html5Ext.push(item);
+ if (aF[item].related) {
+ _html5Ext = _html5Ext.concat(aF[item].related);
+ }
+ }
+ }
+ _html5Ext = new RegExp('\\.('+_html5Ext.join('|')+')(\\?.*)?$','i');
+ }
+
+ // TODO: Strip URL queries, etc.
+ fileExt = (url ? url.toLowerCase().match(_html5Ext) : null);
+
+ if (!fileExt || !fileExt.length) {
+ if (!mime) {
+ return false;
+ } else {
+ // audio/mp3 -> mp3, result should be known
+ offset = mime.indexOf(';');
+ // strip "audio/X; codecs.."
+ fileExt = (offset !== -1?mime.substr(0,offset):mime).substr(6);
+ }
+ } else {
+ // match the raw extension name - "mp3", for example
+ fileExt = fileExt[1];
+ }
+
+ if (fileExt && typeof _s.html5[fileExt] !== 'undefined') {
+ // result known
+ return (_s.html5[fileExt] && !preferFlashCheck(fileExt));
+ } else {
+ mime = 'audio/'+fileExt;
+ result = _s.html5.canPlayType({type:mime});
+ _s.html5[fileExt] = result;
+ // _s._wD('canPlayType, found result: '+result);
+ return (result && _s.html5[mime] && !preferFlashCheck(mime));
+ }
+
+ };
+
+ _testHTML5 = function() {
+
+ if (!_s.useHTML5Audio || typeof Audio === 'undefined') {
+ return false;
+ }
+
+ // double-whammy: Opera 9.64 throws WRONG_ARGUMENTS_ERR if no parameter passed to Audio(), and Webkit + iOS happily tries to load "null" as a URL. :/
+ var a = (typeof Audio !== 'undefined' ? (_isOpera ? new Audio(null) : new Audio()) : null),
+ item, support = {}, aF, i;
+
+ function _cp(m) {
+
+ var canPlay, i, j, isOK = false;
+
+ if (!a || typeof a.canPlayType !== 'function') {
+ return false;
+ }
+
+ if (m instanceof Array) {
+ // iterate through all mime types, return any successes
+ for (i=0, j=m.length; i<j && !isOK; i++) {
+ if (_s.html5[m[i]] || a.canPlayType(m[i]).match(_s.html5Test)) {
+ isOK = true;
+ _s.html5[m[i]] = true;
+
+ // if flash can play and preferred, also mark it for use.
+ _s.flash[m[i]] = !!(_s.preferFlash && _hasFlash && m[i].match(_flashMIME));
+
+ }
+ }
+ return isOK;
+ } else {
+ canPlay = (a && typeof a.canPlayType === 'function' ? a.canPlayType(m) : false);
+ return !!(canPlay && (canPlay.match(_s.html5Test)));
+ }
+
+ }
+
+ // test all registered formats + codecs
+
+ aF = _s.audioFormats;
+
+ for (item in aF) {
+ if (aF.hasOwnProperty(item)) {
+ support[item] = _cp(aF[item].type);
+
+ // write back generic type too, eg. audio/mp3
+ support['audio/'+item] = support[item];
+
+ // assign flash
+ if (_s.preferFlash && !_s.ignoreFlash && item.match(_flashMIME)) {
+ _s.flash[item] = true;
+ } else {
+ _s.flash[item] = false;
+ }
+
+ // assign result to related formats, too
+ if (aF[item] && aF[item].related) {
+ for (i=aF[item].related.length; i--;) {
+ // eg. audio/m4a
+ support['audio/'+aF[item].related[i]] = support[item];
+ _s.html5[aF[item].related[i]] = support[item];
+ _s.flash[aF[item].related[i]] = support[item];
+
+ }
+ }
+ }
+ }
+
+ support.canPlayType = (a?_cp:null);
+ _s.html5 = _mixin(_s.html5, support);
+
+ return true;
+
+ };
+
+ _strings = {
+
+ // <d>
+ notReady: 'Not loaded yet - wait for soundManager.onload()/onready()',
+ notOK: 'Audio support is not available.',
+ domError: _smc + 'createMovie(): appendChild/innerHTML call failed. DOM not ready or other error.',
+ spcWmode: _smc + 'createMovie(): Removing wmode, preventing known SWF loading issue(s)',
+ swf404: _sm + ': Verify that %s is a valid path.',
+ tryDebug: 'Try ' + _sm + '.debugFlash = true for more security details (output goes to SWF.)',
+ checkSWF: 'See SWF output for more debug info.',
+ localFail: _sm + ': Non-HTTP page (' + _doc.location.protocol + ' URL?) Review Flash player security settings for this special case:\nhttp://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html\nMay need to add/allow path, eg. c:/sm2/ or /users/me/sm2/',
+ waitFocus: _sm + ': Special case: Waiting for focus-related event..',
+ waitImpatient: _sm + ': Getting impatient, still waiting for Flash%s...',
+ waitForever: _sm + ': Waiting indefinitely for Flash (will recover if unblocked)...',
+ needFunction: _sm + ': Function object expected for %s',
+ badID: 'Warning: Sound ID "%s" should be a string, starting with a non-numeric character',
+ currentObj: '--- ' + _sm + '._debug(): Current sound objects ---',
+ waitEI: _smc + 'initMovie(): Waiting for ExternalInterface call from Flash..',
+ waitOnload: _sm + ': Waiting for window.onload()',
+ docLoaded: _sm + ': Document already loaded',
+ onload: _smc + 'initComplete(): calling soundManager.onload()',
+ onloadOK: _sm + '.onload() complete',
+ init: _smc + 'init()',
+ didInit: _smc + 'init(): Already called?',
+ flashJS: _sm + ': Attempting to call Flash from JS..',
+ secNote: 'Flash security note: Network/internet URLs will not load due to security restrictions. Access can be configured via Flash Player Global Security Settings Page: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html',
+ badRemove: 'Warning: Failed to remove flash movie.',
+ noPeak: 'Warning: peakData features unsupported for movieStar formats',
+ shutdown: _sm + '.disable(): Shutting down',
+ queue: _sm + ': Queueing %s handler',
+ smFail: _sm + ': Failed to initialise.',
+ smError: 'SMSound.load(): Exception: JS-Flash communication failed, or JS error.',
+ fbTimeout: 'No flash response, applying .'+_s.swfCSS.swfTimedout+' CSS..',
+ fbLoaded: 'Flash loaded',
+ fbHandler: _smc+'flashBlockHandler()',
+ manURL: 'SMSound.load(): Using manually-assigned URL',
+ onURL: _sm + '.load(): current URL already assigned.',
+ badFV: _sm + '.flashVersion must be 8 or 9. "%s" is invalid. Reverting to %s.',
+ as2loop: 'Note: Setting stream:false so looping can work (flash 8 limitation)',
+ noNSLoop: 'Note: Looping not implemented for MovieStar formats',
+ needfl9: 'Note: Switching to flash 9, required for MP4 formats.',
+ mfTimeout: 'Setting flashLoadTimeout = 0 (infinite) for off-screen, mobile flash case',
+ mfOn: 'mobileFlash::enabling on-screen flash repositioning',
+ policy: 'Enabling usePolicyFile for data access'
+ // </d>
+
+ };
+
+ _str = function() {
+
+ // internal string replace helper.
+ // arguments: o [,items to replace]
+ // <d>
+
+ // real array, please
+ var args = _slice.call(arguments),
+
+ // first arg
+ o = args.shift(),
+
+ str = (_strings && _strings[o]?_strings[o]:''), i, j;
+ if (str && args && args.length) {
+ for (i = 0, j = args.length; i < j; i++) {
+ str = str.replace('%s', args[i]);
+ }
+ }
+
+ return str;
+ // </d>
+
+ };
+
+ _loopFix = function(sOpt) {
+
+ // flash 8 requires stream = false for looping to work
+ if (_fV === 8 && sOpt.loops > 1 && sOpt.stream) {
+ _wDS('as2loop');
+ sOpt.stream = false;
+ }
+
+ return sOpt;
+
+ };
+
+ _policyFix = function(sOpt, sPre) {
+
+ if (sOpt && !sOpt.usePolicyFile && (sOpt.onid3 || sOpt.usePeakData || sOpt.useWaveformData || sOpt.useEQData)) {
+ _s._wD((sPre || '') + _str('policy'));
+ sOpt.usePolicyFile = true;
+ }
+
+ return sOpt;
+
+ };
+
+ _complain = function(sMsg) {
+
+ // <d>
+ if (typeof console !== 'undefined' && typeof console.warn !== 'undefined') {
+ console.warn(sMsg);
+ } else {
+ _s._wD(sMsg);
+ }
+ // </d>
+
+ };
+
+ _doNothing = function() {
+
+ return false;
+
+ };
+
+ _disableObject = function(o) {
+
+ var oProp;
+
+ for (oProp in o) {
+ if (o.hasOwnProperty(oProp) && typeof o[oProp] === 'function') {
+ o[oProp] = _doNothing;
+ }
+ }
+
+ oProp = null;
+
+ };
+
+ _failSafely = function(bNoDisable) {
+
+ // general failure exception handler
+
+ if (typeof bNoDisable === 'undefined') {
+ bNoDisable = false;
+ }
+
+ if (_disabled || bNoDisable) {
+ _wDS('smFail', 2);
+ _s.disable(bNoDisable);
+ }
+
+ };
+
+ _normalizeMovieURL = function(smURL) {
+
+ var urlParams = null;
+
+ if (smURL) {
+ if (smURL.match(/\.swf(\?.*)?$/i)) {
+ urlParams = smURL.substr(smURL.toLowerCase().lastIndexOf('.swf?') + 4);
+ if (urlParams) {
+ // assume user knows what they're doing
+ return smURL;
+ }
+ } else if (smURL.lastIndexOf('/') !== smURL.length - 1) {
+ smURL = smURL + '/';
+ }
+ }
+
+ return (smURL && smURL.lastIndexOf('/') !== - 1?smURL.substr(0, smURL.lastIndexOf('/') + 1):'./') + _s.movieURL;
+
+ };
+
+ _setVersionInfo = function() {
+
+ // short-hand for internal use
+
+ _fV = parseInt(_s.flashVersion, 10);
+
+ if (_fV !== 8 && _fV !== 9) {
+ _s._wD(_str('badFV', _fV, _defaultFlashVersion));
+ _s.flashVersion = _fV = _defaultFlashVersion;
+ }
+
+ // debug flash movie, if applicable
+
+ var isDebug = (_s.debugMode || _s.debugFlash?'_debug.swf':'.swf');
+
+ if (_s.useHTML5Audio && !_s.html5Only && _s.audioFormats.mp4.required && _fV < 9) {
+ _s._wD(_str('needfl9'));
+ _s.flashVersion = _fV = 9;
+ }
+
+ _s.version = _s.versionNumber + (_s.html5Only?' (HTML5-only mode)':(_fV === 9?' (AS3/Flash 9)':' (AS2/Flash 8)'));
+
+ // set up default options
+ if (_fV > 8) {
+ // +flash 9 base options
+ _s.defaultOptions = _mixin(_s.defaultOptions, _s.flash9Options);
+ _s.features.buffering = true;
+ // +moviestar support
+ _s.defaultOptions = _mixin(_s.defaultOptions, _s.movieStarOptions);
+ _s.filePatterns.flash9 = new RegExp('\\.(mp3|' + _netStreamTypes.join('|') + ')(\\?.*)?$', 'i');
+ _s.features.movieStar = true;
+ } else {
+ _s.features.movieStar = false;
+ }
+
+ // regExp for flash canPlay(), etc.
+ _s.filePattern = _s.filePatterns[(_fV !== 8?'flash9':'flash8')];
+
+ // if applicable, use _debug versions of SWFs
+ _s.movieURL = (_fV === 8?'soundmanager2.swf':'soundmanager2_flash9.swf').replace('.swf', isDebug);
+
+ _s.features.peakData = _s.features.waveformData = _s.features.eqData = (_fV > 8);
+
+ };
+
+ _setPolling = function(bPolling, bHighPerformance) {
+
+ if (!_s.o) {
+ return false;
+ }
+
+ _s.o._setPolling(bPolling, bHighPerformance);
+
+ };
+
+ _initDebug = function() {
+
+ // starts debug mode, creating output <div> for UAs without console object
+
+ // allow force of debug mode via URL
+ if (_s.debugURLParam.test(_wl)) {
+ _s.debugMode = true;
+ }
+
+ // <d>
+ if (_id(_s.debugID)) {
+ return false;
+ }
+
+ var oD, oDebug, oTarget, oToggle, tmp;
+
+ if (_s.debugMode && !_id(_s.debugID) && ((!_hasConsole || !_s.useConsole) || (_s.useConsole && _hasConsole && !_s.consoleOnly))) {
+
+ oD = _doc.createElement('div');
+ oD.id = _s.debugID + '-toggle';
+
+ oToggle = {
+ 'position': 'fixed',
+ 'bottom': '0px',
+ 'right': '0px',
+ 'width': '1.2em',
+ 'height': '1.2em',
+ 'lineHeight': '1.2em',
+ 'margin': '2px',
+ 'textAlign': 'center',
+ 'border': '1px solid #999',
+ 'cursor': 'pointer',
+ 'background': '#fff',
+ 'color': '#333',
+ 'zIndex': 10001
+ };
+
+ oD.appendChild(_doc.createTextNode('-'));
+ oD.onclick = _toggleDebug;
+ oD.title = 'Toggle SM2 debug console';
+
+ if (_ua.match(/msie 6/i)) {
+ oD.style.position = 'absolute';
+ oD.style.cursor = 'hand';
+ }
+
+ for (tmp in oToggle) {
+ if (oToggle.hasOwnProperty(tmp)) {
+ oD.style[tmp] = oToggle[tmp];
+ }
+ }
+
+ oDebug = _doc.createElement('div');
+ oDebug.id = _s.debugID;
+ oDebug.style.display = (_s.debugMode?'block':'none');
+
+ if (_s.debugMode && !_id(oD.id)) {
+ try {
+ oTarget = _getDocument();
+ oTarget.appendChild(oD);
+ } catch(e2) {
+ throw new Error(_str('domError')+' \n'+e2.toString());
+ }
+ oTarget.appendChild(oDebug);
+ }
+
+ }
+
+ oTarget = null;
+ // </d>
+
+ };
+
+ _idCheck = this.getSoundById;
+
+ // <d>
+ _wDS = function(o, errorLevel) {
+
+ if (!o) {
+ return '';
+ } else {
+ return _s._wD(_str(o), errorLevel);
+ }
+
+ };
+
+ // last-resort debugging option
+
+ if (_wl.indexOf('sm2-debug=alert') + 1 && _s.debugMode) {
+ _s._wD = function(sText) {window.alert(sText);};
+ }
+
+ _toggleDebug = function() {
+
+ var o = _id(_s.debugID),
+ oT = _id(_s.debugID + '-toggle');
+
+ if (!o) {
+ return false;
+ }
+
+ if (_debugOpen) {
+ // minimize
+ oT.innerHTML = '+';
+ o.style.display = 'none';
+ } else {
+ oT.innerHTML = '-';
+ o.style.display = 'block';
+ }
+
+ _debugOpen = !_debugOpen;
+
+ };
+
+ _debugTS = function(sEventType, bSuccess, sMessage) {
+
+ // troubleshooter debug hooks
+
+ if (typeof sm2Debugger !== 'undefined') {
+ try {
+ sm2Debugger.handleEvent(sEventType, bSuccess, sMessage);
+ } catch(e) {
+ // oh well
+ }
+ }
+
+ return true;
+
+ };
+ // </d>
+
+ _getSWFCSS = function() {
+
+ var css = [];
+
+ if (_s.debugMode) {
+ css.push(_s.swfCSS.sm2Debug);
+ }
+
+ if (_s.debugFlash) {
+ css.push(_s.swfCSS.flashDebug);
+ }
+
+ if (_s.useHighPerformance) {
+ css.push(_s.swfCSS.highPerf);
+ }
+
+ return css.join(' ');
+
+ };
+
+ _flashBlockHandler = function() {
+
+ // *possible* flash block situation.
+
+ var name = _str('fbHandler'),
+ p = _s.getMoviePercent(),
+ css = _s.swfCSS,
+ error = {type:'FLASHBLOCK'};
+
+ if (_s.html5Only) {
+ return false;
+ }
+
+ if (!_s.ok()) {
+
+ if (_needsFlash) {
+ // make the movie more visible, so user can fix
+ _s.oMC.className = _getSWFCSS() + ' ' + css.swfDefault + ' ' + (p === null?css.swfTimedout:css.swfError);
+ _s._wD(name+': '+_str('fbTimeout')+(p?' ('+_str('fbLoaded')+')':''));
+ }
+
+ _s.didFlashBlock = true;
+
+ // fire onready(), complain lightly
+ _processOnEvents({type:'ontimeout', ignoreInit:true, error:error});
+ _catchError(error);
+
+ } else {
+
+ // SM2 loaded OK (or recovered)
+
+ if (_s.didFlashBlock) {
+ _s._wD(name+': Unblocked');
+ }
+
+ if (_s.oMC) {
+ _s.oMC.className = [_getSWFCSS(), css.swfDefault, css.swfLoaded + (_s.didFlashBlock?' '+css.swfUnblocked:'')].join(' ');
+ }
+
+ }
+
+ };
+
+ _addOnEvent = function(sType, oMethod, oScope) {
+
+ if (typeof _on_queue[sType] === 'undefined') {
+ _on_queue[sType] = [];
+ }
+
+ _on_queue[sType].push({
+ 'method': oMethod,
+ 'scope': (oScope || null),
+ 'fired': false
+ });
+
+ };
+
+ _processOnEvents = function(oOptions) {
+
+ // assume onready, if unspecified
+
+ if (!oOptions) {
+ oOptions = {
+ type: 'onready'
+ };
+ }
+
+ if (!_didInit && oOptions && !oOptions.ignoreInit) {
+ // not ready yet.
+ return false;
+ }
+
+ if (oOptions.type === 'ontimeout' && _s.ok()) {
+ // invalid case
+ return false;
+ }
+
+ var status = {
+ success: (oOptions && oOptions.ignoreInit?_s.ok():!_disabled)
+ },
+
+ // queue specified by type, or none
+ srcQueue = (oOptions && oOptions.type?_on_queue[oOptions.type]||[]:[]),
+
+ queue = [], i, j,
+ args = [status],
+ canRetry = (_needsFlash && _s.useFlashBlock && !_s.ok());
+
+ if (oOptions.error) {
+ args[0].error = oOptions.error;
+ }
+
+ for (i = 0, j = srcQueue.length; i < j; i++) {
+ if (srcQueue[i].fired !== true) {
+ queue.push(srcQueue[i]);
+ }
+ }
+
+ if (queue.length) {
+ _s._wD(_sm + ': Firing ' + queue.length + ' '+oOptions.type+'() item' + (queue.length === 1?'':'s'));
+ for (i = 0, j = queue.length; i < j; i++) {
+ if (queue[i].scope) {
+ queue[i].method.apply(queue[i].scope, args);
+ } else {
+ queue[i].method.apply(this, args);
+ }
+ if (!canRetry) {
+ // flashblock case doesn't count here
+ queue[i].fired = true;
+ }
+ }
+ }
+
+ return true;
+
+ };
+
+ _initUserOnload = function() {
+
+ _win.setTimeout(function() {
+
+ if (_s.useFlashBlock) {
+ _flashBlockHandler();
+ }
+
+ _processOnEvents();
+
+ // call user-defined "onload", scoped to window
+
+ if (_s.onload instanceof Function) {
+ _wDS('onload', 1);
+ _s.onload.apply(_win);
+ _wDS('onloadOK', 1);
+ }
+
+ if (_s.waitForWindowLoad) {
+ _event.add(_win, 'load', _initUserOnload);
+ }
+
+ },1);
+
+ };
+
+ _detectFlash = function() {
+
+ // hat tip: Flash Detect library (BSD, (C) 2007) by Carl "DocYes" S. Yestrau - http://featureblend.com/javascript-flash-detection-library.html / http://featureblend.com/license.txt
+
+ if (_hasFlash !== undefined) {
+ // this work has already been done.
+ return _hasFlash;
+ }
+
+ var hasPlugin = false, n = navigator, nP = n.plugins, obj, type, types, AX = _win.ActiveXObject;
+
+ if (nP && nP.length) {
+ type = 'application/x-shockwave-flash';
+ types = n.mimeTypes;
+ if (types && types[type] && types[type].enabledPlugin && types[type].enabledPlugin.description) {
+ hasPlugin = true;
+ }
+ } else if (typeof AX !== 'undefined') {
+ try {
+ obj = new AX('ShockwaveFlash.ShockwaveFlash');
+ } catch(e) {
+ // oh well
+ }
+ hasPlugin = (!!obj);
+ }
+
+ _hasFlash = hasPlugin;
+
+ return hasPlugin;
+
+ };
+
+ _featureCheck = function() {
+
+ var needsFlash, item,
+
+ // iPhone <= 3.1 has broken HTML5 audio(), but firmware 3.2 (iPad) + iOS4 works.
+ isSpecial = (_is_iDevice && !!(_ua.match(/os (1|2|3_0|3_1)/i)));
+
+ if (isSpecial) {
+
+ // has Audio(), but is broken; let it load links directly.
+ _s.hasHTML5 = false;
+
+ // ignore flash case, however
+ _s.html5Only = true;
+
+ if (_s.oMC) {
+ _s.oMC.style.display = 'none';
+ }
+
+ return false;
+
+ }
+
+ if (_s.useHTML5Audio) {
+
+ if (!_s.html5 || !_s.html5.canPlayType) {
+ _s._wD('SoundManager: No HTML5 Audio() support detected.');
+ _s.hasHTML5 = false;
+ return true;
+ } else {
+ _s.hasHTML5 = true;
+ }
+ if (_isBadSafari) {
+ _s._wD(_smc+'Note: Buggy HTML5 Audio in Safari on this OS X release, see https://bugs.webkit.org/show_bug.cgi?id=32159 - '+(!_hasFlash?' would use flash fallback for MP3/MP4, but none detected.':'will use flash fallback for MP3/MP4, if available'),1);
+ if (_detectFlash()) {
+ return true;
+ }
+ }
+ } else {
+
+ // flash needed (or, HTML5 needs enabling.)
+ return true;
+
+ }
+
+ for (item in _s.audioFormats) {
+ if (_s.audioFormats.hasOwnProperty(item)) {
+ if ((_s.audioFormats[item].required && !_s.html5.canPlayType(_s.audioFormats[item].type)) || _s.flash[item] || _s.flash[_s.audioFormats[item].type]) {
+ // flash may be required, or preferred for this format
+ needsFlash = true;
+ }
+ }
+ }
+
+ // sanity check..
+ if (_s.ignoreFlash) {
+ needsFlash = false;
+ }
+
+ _s.html5Only = (_s.hasHTML5 && _s.useHTML5Audio && !needsFlash);
+
+ return (!_s.html5Only);
+
+ };
+
+ _startTimer = function(oSound) {
+
+ if (!oSound._hasTimer) {
+ oSound._hasTimer = true;
+ }
+
+ };
+
+ _stopTimer = function(oSound) {
+
+ if (oSound._hasTimer) {
+ oSound._hasTimer = false;
+ }
+
+ };
+
+ _catchError = function(options) {
+
+ options = (typeof options !== 'undefined' ? options : {});
+
+ if (_s.onerror instanceof Function) {
+ _s.onerror.apply(_win, [{type:(typeof options.type !== 'undefined' ? options.type : null)}]);
+ }
+
+ if (typeof options.fatal !== 'undefined' && options.fatal) {
+ _s.disable();
+ }
+
+ };
+
+ _badSafariFix = function() {
+
+ // special case: "bad" Safari (OS X 10.3 - 10.7) must fall back to flash for MP3/MP4
+ if (!_isBadSafari || !_detectFlash()) {
+ // doesn't apply
+ return false;
+ }
+
+ var aF = _s.audioFormats, i, item;
+
+ for (item in aF) {
+ if (aF.hasOwnProperty(item)) {
+ if (item === 'mp3' || item === 'mp4') {
+ _s._wD(_sm+': Using flash fallback for '+item+' format');
+ _s.html5[item] = false;
+ // assign result to related formats, too
+ if (aF[item] && aF[item].related) {
+ for (i = aF[item].related.length; i--;) {
+ _s.html5[aF[item].related[i]] = false;
+ }
+ }
+ }
+ }
+ }
+
+ };
+
+ /**
+ * Pseudo-private flash/ExternalInterface methods
+ * ----------------------------------------------
+ */
+
+ this._setSandboxType = function(sandboxType) {
+
+ // <d>
+ var sb = _s.sandbox;
+
+ sb.type = sandboxType;
+ sb.description = sb.types[(typeof sb.types[sandboxType] !== 'undefined'?sandboxType:'unknown')];
+
+ _s._wD('Flash security sandbox type: ' + sb.type);
+
+ if (sb.type === 'localWithFile') {
+
+ sb.noRemote = true;
+ sb.noLocal = false;
+ _wDS('secNote', 2);
+
+ } else if (sb.type === 'localWithNetwork') {
+
+ sb.noRemote = false;
+ sb.noLocal = true;
+
+ } else if (sb.type === 'localTrusted') {
+
+ sb.noRemote = false;
+ sb.noLocal = false;
+
+ }
+ // </d>
+
+ };
+
+ this._externalInterfaceOK = function(flashDate) {
+
+ // flash callback confirming flash loaded, EI working etc.
+ // flashDate = approx. timing/delay info for JS/flash bridge
+
+ if (_s.swfLoaded) {
+ return false;
+ }
+
+ var eiTime = new Date().getTime();
+
+ _s._wD(_smc+'externalInterfaceOK()' + (flashDate?' (~' + (eiTime - flashDate) + ' ms)':''));
+ _debugTS('swf', true);
+ _debugTS('flashtojs', true);
+ _s.swfLoaded = true;
+ _tryInitOnFocus = false;
+
+ if (_isBadSafari) {
+ _badSafariFix();
+ }
+
+ if (_isIE) {
+ // IE needs a timeout OR delay until window.onload - may need TODO: investigating
+ setTimeout(_init, 100);
+ } else {
+ _init();
+ }
+
+ };
+
+ /**
+ * Private initialization helpers
+ * ------------------------------
+ */
+
+ _createMovie = function(smID, smURL) {
+
+ if (_didAppend && _appendSuccess) {
+ // ignore if already succeeded
+ return false;
+ }
+
+ function _initMsg() {
+ _s._wD('-- SoundManager 2 ' + _s.version + (!_s.html5Only && _s.useHTML5Audio?(_s.hasHTML5?' + HTML5 audio':', no HTML5 audio support'):'') + (!_s.html5Only ? (_s.useHighPerformance?', high performance mode, ':', ') + (( _s.flashPollingInterval ? 'custom (' + _s.flashPollingInterval + 'ms)' : 'normal') + ' polling') + (_s.wmode?', wmode: ' + _s.wmode:'') + (_s.debugFlash?', flash debug mode':'') + (_s.useFlashBlock?', flashBlock mode':'') : '') + ' --', 1);
+ }
+
+ if (_s.html5Only) {
+
+ // 100% HTML5 mode
+ _setVersionInfo();
+
+ _initMsg();
+ _s.oMC = _id(_s.movieID);
+ _init();
+
+ // prevent multiple init attempts
+ _didAppend = true;
+
+ _appendSuccess = true;
+
+ return false;
+
+ }
+
+ // flash path
+ var remoteURL = (smURL || _s.url),
+ localURL = (_s.altURL || remoteURL),
+ swfTitle = 'JS/Flash audio component (SoundManager 2)',
+ oEmbed, oMovie, oTarget = _getDocument(), tmp, movieHTML, oEl, extraClass = _getSWFCSS(),
+ s, x, sClass, side = 'auto', isRTL = null,
+ html = _doc.getElementsByTagName('html')[0];
+
+ isRTL = (html && html.dir && html.dir.match(/rtl/i));
+ smID = (typeof smID === 'undefined'?_s.id:smID);
+
+ function param(name, value) {
+ return '<param name="'+name+'" value="'+value+'" />';
+ }
+
+ // safety check for legacy (change to Flash 9 URL)
+ _setVersionInfo();
+ _s.url = _normalizeMovieURL(_overHTTP?remoteURL:localURL);
+ smURL = _s.url;
+
+ _s.wmode = (!_s.wmode && _s.useHighPerformance ? 'transparent' : _s.wmode);
+
+ if (_s.wmode !== null && (_ua.match(/msie 8/i) || (!_isIE && !_s.useHighPerformance)) && navigator.platform.match(/win32|win64/i)) {
+ /**
+ * extra-special case: movie doesn't load until scrolled into view when using wmode = anything but 'window' here
+ * does not apply when using high performance (position:fixed means on-screen), OR infinite flash load timeout
+ * wmode breaks IE 8 on Vista + Win7 too in some cases, as of January 2011 (?)
+ */
+ _s.specialWmodeCase = true;
+ _wDS('spcWmode');
+ _s.wmode = null;
+ }
+
+ oEmbed = {
+ 'name': smID,
+ 'id': smID,
+ 'src': smURL,
+ 'width': side,
+ 'height': side,
+ 'quality': 'high',
+ 'allowScriptAccess': _s.allowScriptAccess,
+ 'bgcolor': _s.bgColor,
+ 'pluginspage': _http+'www.macromedia.com/go/getflashplayer',
+ 'title': swfTitle,
+ 'type': 'application/x-shockwave-flash',
+ 'wmode': _s.wmode,
+ // http://help.adobe.com/en_US/as3/mobile/WS4bebcd66a74275c36cfb8137124318eebc6-7ffd.html
+ 'hasPriority': 'true'
+ };
+
+ if (_s.debugFlash) {
+ oEmbed.FlashVars = 'debug=1';
+ }
+
+ if (!_s.wmode) {
+ // don't write empty attribute
+ delete oEmbed.wmode;
+ }
+
+ if (_isIE) {
+
+ // IE is "special".
+ oMovie = _doc.createElement('div');
+ movieHTML = [
+ '<object id="' + smID + '" data="' + smURL + '" type="' + oEmbed.type + '" title="' + oEmbed.title +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="' + _http+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="' + oEmbed.width + '" height="' + oEmbed.height + '">',
+ param('movie', smURL),
+ param('AllowScriptAccess', _s.allowScriptAccess),
+ param('quality', oEmbed.quality),
+ (_s.wmode? param('wmode', _s.wmode): ''),
+ param('bgcolor', _s.bgColor),
+ param('hasPriority', 'true'),
+ (_s.debugFlash ? param('FlashVars', oEmbed.FlashVars) : ''),
+ '</object>'
+ ].join('');
+
+ } else {
+
+ oMovie = _doc.createElement('embed');
+ for (tmp in oEmbed) {
+ if (oEmbed.hasOwnProperty(tmp)) {
+ oMovie.setAttribute(tmp, oEmbed[tmp]);
+ }
+ }
+
+ }
+
+ _initDebug();
+ extraClass = _getSWFCSS();
+ oTarget = _getDocument();
+
+ if (oTarget) {
+
+ _s.oMC = (_id(_s.movieID) || _doc.createElement('div'));
+
+ if (!_s.oMC.id) {
+
+ _s.oMC.id = _s.movieID;
+ _s.oMC.className = _s.swfCSS.swfDefault + ' ' + extraClass;
+ s = null;
+ oEl = null;
+
+ if (!_s.useFlashBlock) {
+ if (_s.useHighPerformance) {
+ // on-screen at all times
+ s = {
+ 'position': 'fixed',
+ 'width': '8px',
+ 'height': '8px',
+ // >= 6px for flash to run fast, >= 8px to start up under Firefox/win32 in some cases. odd? yes.
+ 'bottom': '0px',
+ 'left': '0px',
+ 'overflow': 'hidden'
+ };
+ } else {
+ // hide off-screen, lower priority
+ s = {
+ 'position': 'absolute',
+ 'width': '6px',
+ 'height': '6px',
+ 'top': '-9999px',
+ 'left': '-9999px'
+ };
+ if (isRTL) {
+ s.left = Math.abs(parseInt(s.left,10))+'px';
+ }
+ }
+ }
+
+ if (_isWebkit) {
+ // soundcloud-reported render/crash fix, safari 5
+ _s.oMC.style.zIndex = 10000;
+ }
+
+ if (!_s.debugFlash) {
+ for (x in s) {
+ if (s.hasOwnProperty(x)) {
+ _s.oMC.style[x] = s[x];
+ }
+ }
+ }
+
+ try {
+ if (!_isIE) {
+ _s.oMC.appendChild(oMovie);
+ }
+ oTarget.appendChild(_s.oMC);
+ if (_isIE) {
+ oEl = _s.oMC.appendChild(_doc.createElement('div'));
+ oEl.className = _s.swfCSS.swfBox;
+ oEl.innerHTML = movieHTML;
+ }
+ _appendSuccess = true;
+ } catch(e) {
+ throw new Error(_str('domError')+' \n'+e.toString());
+ }
+
+ } else {
+
+ // SM2 container is already in the document (eg. flashblock use case)
+ sClass = _s.oMC.className;
+ _s.oMC.className = (sClass?sClass+' ':_s.swfCSS.swfDefault) + (extraClass?' '+extraClass:'');
+ _s.oMC.appendChild(oMovie);
+ if (_isIE) {
+ oEl = _s.oMC.appendChild(_doc.createElement('div'));
+ oEl.className = _s.swfCSS.swfBox;
+ oEl.innerHTML = movieHTML;
+ }
+ _appendSuccess = true;
+
+ }
+
+ }
+
+ _didAppend = true;
+ _initMsg();
+ _s._wD(_smc+'createMovie(): Trying to load ' + smURL + (!_overHTTP && _s.altURL?' (alternate URL)':''), 1);
+
+ return true;
+
+ };
+
+ _initMovie = function() {
+
+ if (_s.html5Only) {
+ _createMovie();
+ return false;
+ }
+
+ // attempt to get, or create, movie
+ // may already exist
+ if (_s.o) {
+ return false;
+ }
+
+ // inline markup case
+ _s.o = _s.getMovie(_s.id);
+
+ if (!_s.o) {
+ if (!_oRemoved) {
+ // try to create
+ _createMovie(_s.id, _s.url);
+ } else {
+ // try to re-append removed movie after reboot()
+ if (!_isIE) {
+ _s.oMC.appendChild(_oRemoved);
+ } else {
+ _s.oMC.innerHTML = _oRemovedHTML;
+ }
+ _oRemoved = null;
+ _didAppend = true;
+ }
+ _s.o = _s.getMovie(_s.id);
+ }
+
+ // <d>
+ if (_s.o) {
+ _wDS('waitEI');
+ }
+ // </d>
+
+ if (_s.oninitmovie instanceof Function) {
+ setTimeout(_s.oninitmovie, 1);
+ }
+
+ return true;
+
+ };
+
+ _delayWaitForEI = function() {
+
+ setTimeout(_waitForEI, 1000);
+
+ };
+
+ _waitForEI = function() {
+
+ if (_waitingForEI) {
+ return false;
+ }
+
+ _waitingForEI = true;
+ _event.remove(_win, 'load', _delayWaitForEI);
+
+ if (_tryInitOnFocus && !_isFocused) {
+ // giant Safari 3.1 hack - assume mousemove = focus given lack of focus event
+ _wDS('waitFocus');
+ return false;
+ }
+
+ var p;
+ if (!_didInit) {
+ p = _s.getMoviePercent();
+ _s._wD(_str('waitImpatient', (p === 100?' (SWF loaded)':(p > 0?' (SWF ' + p + '% loaded)':''))));
+ }
+
+ setTimeout(function() {
+
+ p = _s.getMoviePercent();
+
+ // <d>
+ if (!_didInit) {
+ _s._wD(_sm + ': No Flash response within expected time.\nLikely causes: ' + (p === 0?'Loading ' + _s.movieURL + ' may have failed (and/or Flash ' + _fV + '+ not present?), ':'') + 'Flash blocked or JS-Flash security error.' + (_s.debugFlash?' ' + _str('checkSWF'):''), 2);
+ if (!_overHTTP && p) {
+ _wDS('localFail', 2);
+ if (!_s.debugFlash) {
+ _wDS('tryDebug', 2);
+ }
+ }
+ if (p === 0) {
+ // if 0 (not null), probably a 404.
+ _s._wD(_str('swf404', _s.url));
+ }
+ _debugTS('flashtojs', false, ': Timed out' + _overHTTP?' (Check flash security or flash blockers)':' (No plugin/missing SWF?)');
+ }
+ // </d>
+
+ // give up / time-out, depending
+
+ if (!_didInit && _okToDisable) {
+ if (p === null) {
+ // SWF failed. Maybe blocked.
+ if (_s.useFlashBlock || _s.flashLoadTimeout === 0) {
+ if (_s.useFlashBlock) {
+ _flashBlockHandler();
+ }
+ _wDS('waitForever');
+ } else {
+ // old SM2 behaviour, simply fail
+ _failSafely(true);
+ }
+ } else {
+ // flash loaded? Shouldn't be a blocking issue, then.
+ if (_s.flashLoadTimeout === 0) {
+ _wDS('waitForever');
+ } else {
+ _failSafely(true);
+ }
+ }
+ }
+
+ }, _s.flashLoadTimeout);
+
+ };
+
+ _handleFocus = function() {
+
+ function cleanup() {
+ _event.remove(_win, 'focus', _handleFocus);
+ _event.remove(_win, 'load', _handleFocus);
+ }
+
+ if (_isFocused || !_tryInitOnFocus) {
+ cleanup();
+ return true;
+ }
+
+ _okToDisable = true;
+ _isFocused = true;
+ _s._wD(_smc+'handleFocus()');
+
+ if (_isSafari && _tryInitOnFocus) {
+ _event.remove(_win, 'mousemove', _handleFocus);
+ }
+
+ // allow init to restart
+ _waitingForEI = false;
+
+ cleanup();
+ return true;
+
+ };
+
+ _showSupport = function() {
+
+ var item, tests = [];
+
+ if (_s.useHTML5Audio && _s.hasHTML5) {
+ for (item in _s.audioFormats) {
+ if (_s.audioFormats.hasOwnProperty(item)) {
+ tests.push(item + ': ' + _s.html5[item] + (!_s.html5[item] && _hasFlash && _s.flash[item] ? ' (using flash)' : (_s.preferFlash && _s.flash[item] && _hasFlash ? ' (preferring flash)': (!_s.html5[item] ? ' (' + (_s.audioFormats[item].required ? 'required, ':'') + 'and no flash support)' : ''))));
+ }
+ }
+ _s._wD('-- SoundManager 2: HTML5 support tests ('+_s.html5Test+'): '+tests.join(', ')+' --',1);
+ }
+
+ };
+
+ _initComplete = function(bNoDisable) {
+
+ if (_didInit) {
+ return false;
+ }
+
+ if (_s.html5Only) {
+ // all good.
+ _s._wD('-- SoundManager 2: loaded --');
+ _didInit = true;
+ _initUserOnload();
+ _debugTS('onload', true);
+ return true;
+ }
+
+ var wasTimeout = (_s.useFlashBlock && _s.flashLoadTimeout && !_s.getMoviePercent()),
+ error;
+
+ if (!wasTimeout) {
+ _didInit = true;
+ if (_disabled) {
+ error = {type: (!_hasFlash && _needsFlash ? 'NO_FLASH' : 'INIT_TIMEOUT')};
+ }
+ }
+
+ _s._wD('-- SoundManager 2 ' + (_disabled?'failed to load':'loaded') + ' (' + (_disabled?'security/load error':'OK') + ') --', 1);
+
+ if (_disabled || bNoDisable) {
+ if (_s.useFlashBlock && _s.oMC) {
+ _s.oMC.className = _getSWFCSS() + ' ' + (_s.getMoviePercent() === null?_s.swfCSS.swfTimedout:_s.swfCSS.swfError);
+ }
+ _processOnEvents({type:'ontimeout', error:error});
+ _debugTS('onload', false);
+ _catchError(error);
+ return false;
+ } else {
+ _debugTS('onload', true);
+ }
+
+ if (_s.waitForWindowLoad && !_windowLoaded) {
+ _wDS('waitOnload');
+ _event.add(_win, 'load', _initUserOnload);
+ return false;
+ } else {
+ // <d>
+ if (_s.waitForWindowLoad && _windowLoaded) {
+ _wDS('docLoaded');
+ }
+ // </d>
+ _initUserOnload();
+ }
+
+ return true;
+
+ };
+
+ _init = function() {
+
+ _wDS('init');
+
+ // called after onload()
+
+ if (_didInit) {
+ _wDS('didInit');
+ return false;
+ }
+
+ function _cleanup() {
+ _event.remove(_win, 'load', _s.beginDelayedInit);
+ }
+
+ if (_s.html5Only) {
+ if (!_didInit) {
+ // we don't need no steenking flash!
+ _cleanup();
+ _s.enabled = true;
+ _initComplete();
+ }
+ return true;
+ }
+
+ // flash path
+ _initMovie();
+
+ try {
+
+ _wDS('flashJS');
+
+ // attempt to talk to Flash
+ _s.o._externalInterfaceTest(false);
+
+ // apply user-specified polling interval, OR, if "high performance" set, faster vs. default polling
+ // (determines frequency of whileloading/whileplaying callbacks, effectively driving UI framerates)
+ _setPolling(true, (_s.flashPollingInterval || (_s.useHighPerformance ? 10 : 50)));
+
+ if (!_s.debugMode) {
+ // stop the SWF from making debug output calls to JS
+ _s.o._disableDebug();
+ }
+
+ _s.enabled = true;
+ _debugTS('jstoflash', true);
+
+ if (!_s.html5Only) {
+ // prevent browser from showing cached page state (or rather, restoring "suspended" page state) via back button, because flash may be dead
+ // http://www.webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/
+ _event.add(_win, 'unload', _doNothing);
+ }
+
+ } catch(e) {
+
+ _s._wD('js/flash exception: ' + e.toString());
+ _debugTS('jstoflash', false);
+ _catchError({type:'JS_TO_FLASH_EXCEPTION', fatal:true});
+ // don't disable, for reboot()
+ _failSafely(true);
+ _initComplete();
+
+ return false;
+
+ }
+
+ _initComplete();
+
+ // disconnect events
+ _cleanup();
+
+ return true;
+
+ };
+
+ _domContentLoaded = function() {
+
+ if (_didDCLoaded) {
+ return false;
+ }
+
+ _didDCLoaded = true;
+ _initDebug();
+
+ /**
+ * Temporary feature: allow force of HTML5 via URL params: sm2-usehtml5audio=0 or 1
+ * Ditto for sm2-preferFlash, too.
+ */
+ // <d>
+ (function(){
+
+ var a = 'sm2-usehtml5audio=', l = _wl.toLowerCase(), b = null,
+ a2 = 'sm2-preferflash=', b2 = null, hasCon = (typeof console !== 'undefined' && typeof console.log !== 'undefined');
+
+ if (l.indexOf(a) !== -1) {
+ b = (l.charAt(l.indexOf(a)+a.length) === '1');
+ if (hasCon) {
+ console.log((b?'Enabling ':'Disabling ')+'useHTML5Audio via URL parameter');
+ }
+ _s.useHTML5Audio = b;
+ }
+
+ if (l.indexOf(a2) !== -1) {
+ b2 = (l.charAt(l.indexOf(a2)+a2.length) === '1');
+ if (hasCon) {
+ console.log((b2?'Enabling ':'Disabling ')+'preferFlash via URL parameter');
+ }
+ _s.preferFlash = b2;
+ }
+
+ }());
+ // </d>
+
+ if (!_hasFlash && _s.hasHTML5) {
+ _s._wD('SoundManager: No Flash detected'+(!_s.useHTML5Audio?', enabling HTML5.':'. Trying HTML5-only mode.'));
+ _s.useHTML5Audio = true;
+ // make sure we aren't preferring flash, either
+ // TODO: preferFlash should not matter if flash is not installed. Currently, stuff breaks without the below tweak.
+ _s.preferFlash = false;
+ }
+
+ _testHTML5();
+ _s.html5.usingFlash = _featureCheck();
+ _needsFlash = _s.html5.usingFlash;
+ _showSupport();
+
+ if (!_hasFlash && _needsFlash) {
+ _s._wD('SoundManager: Fatal error: Flash is needed to play some required formats, but is not available.');
+ // TODO: Fatal here vs. timeout approach, etc.
+ // hack: fail sooner.
+ _s.flashLoadTimeout = 1;
+ }
+
+ if (_doc.removeEventListener) {
+ _doc.removeEventListener('DOMContentLoaded', _domContentLoaded, false);
+ }
+
+ _initMovie();
+ return true;
+
+ };
+
+ _domContentLoadedIE = function() {
+
+ if (_doc.readyState === 'complete') {
+ _domContentLoaded();
+ _doc.detachEvent('onreadystatechange', _domContentLoadedIE);
+ }
+
+ return true;
+
+ };
+
+ // sniff up-front
+ _detectFlash();
+
+ // focus and window load, init (primarily flash-driven)
+ _event.add(_win, 'focus', _handleFocus);
+ _event.add(_win, 'load', _handleFocus);
+ _event.add(_win, 'load', _delayWaitForEI);
+
+ if (_isSafari && _tryInitOnFocus) {
+ // massive Safari 3.1 focus detection hack
+ _event.add(_win, 'mousemove', _handleFocus);
+ }
+
+ if (_doc.addEventListener) {
+
+ _doc.addEventListener('DOMContentLoaded', _domContentLoaded, false);
+
+ } else if (_doc.attachEvent) {
+
+ _doc.attachEvent('onreadystatechange', _domContentLoadedIE);
+
+ } else {
+
+ // no add/attachevent support - safe to assume no JS -> Flash either
+ _debugTS('onload', false);
+ _catchError({type:'NO_DOM2_EVENTS', fatal:true});
+
+ }
+
+ if (_doc.readyState === 'complete') {
+ // DOMReady has already happened.
+ setTimeout(_domContentLoaded,100);
+ }
+
+} // SoundManager()
+
+// SM2_DEFER details: http://www.schillmania.com/projects/soundmanager2/doc/getstarted/#lazy-loading
+
+if (typeof SM2_DEFER === 'undefined' || !SM2_DEFER) {
+ soundManager = new SoundManager();
+}
+
+/**
+ * SoundManager public interfaces
+ * ------------------------------
+ */
+
+window.SoundManager = SoundManager; // constructor
+window.soundManager = soundManager; // public API, flash callbacks etc.
+
+}(window));
\ No newline at end of file
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/swf/soundmanager2.swf b/fantasmixDjango/django_project/audiofield/static/audiofield/swf/soundmanager2.swf
new file mode 100755
index 0000000000000000000000000000000000000000..d2bda595a831279aec51160112acfc24d0fe7cfe
Binary files /dev/null and b/fantasmixDjango/django_project/audiofield/static/audiofield/swf/soundmanager2.swf differ
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/swf/soundmanager2_debug.swf b/fantasmixDjango/django_project/audiofield/static/audiofield/swf/soundmanager2_debug.swf
new file mode 100755
index 0000000000000000000000000000000000000000..1c523d25962931425ae902b4bda5d7c9cc0187b3
Binary files /dev/null and b/fantasmixDjango/django_project/audiofield/static/audiofield/swf/soundmanager2_debug.swf differ
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/swf/soundmanager2_flash9.swf b/fantasmixDjango/django_project/audiofield/static/audiofield/swf/soundmanager2_flash9.swf
new file mode 100755
index 0000000000000000000000000000000000000000..bf4fdf046496c5153223c785981490f4e77b0d6b
Binary files /dev/null and b/fantasmixDjango/django_project/audiofield/static/audiofield/swf/soundmanager2_flash9.swf differ
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/swf/soundmanager2_flash9_debug.swf b/fantasmixDjango/django_project/audiofield/static/audiofield/swf/soundmanager2_flash9_debug.swf
new file mode 100755
index 0000000000000000000000000000000000000000..0781c2e25e1c3f9f70f0cec7b9e8f4e79647b740
Binary files /dev/null and b/fantasmixDjango/django_project/audiofield/static/audiofield/swf/soundmanager2_flash9_debug.swf differ
diff --git a/fantasmixDjango/django_project/audiofield/static/audiofield/swf/soundmanager2_flash_xdomain.zip b/fantasmixDjango/django_project/audiofield/static/audiofield/swf/soundmanager2_flash_xdomain.zip
new file mode 100755
index 0000000000000000000000000000000000000000..cc2c90f9e08c114ef261814ce13283c498488f21
Binary files /dev/null and b/fantasmixDjango/django_project/audiofield/static/audiofield/swf/soundmanager2_flash_xdomain.zip differ
diff --git a/fantasmixDjango/django_project/audiofield/tasks.py b/fantasmixDjango/django_project/audiofield/tasks.py
new file mode 100755
index 0000000000000000000000000000000000000000..193858e0ae23f83537d574a235e3ec358630faa4
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/tasks.py
@@ -0,0 +1,97 @@
+#
+# django-audiofield License
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# Copyright (C) 2011-2014 Star2Billing S.L.
+#
+# The Initial Developer of the Original Code is
+# Arezqui Belaid <info@star2billing.com>
+#
+
+from celery.utils.log import get_task_logger
+from celery.decorators import task
+import subprocess
+import os
+from uuid import uuid1
+# import shlex
+
+logger = get_task_logger(__name__)
+
+DELAY_TASK = 5 # Seconds
+
+
+@task()
+def audio_convert_task(conv):
+ """Convert audio files"""
+
+ logger.info('[audio_convert_task] Received a request to convert audio file in %dsecs' % DELAY_TASK)
+ run_convert_task.apply_async((conv,), countdown=DELAY_TASK)
+
+ return True
+
+
+@task()
+def run_convert_task(conv):
+ """
+ Exec the audio convert
+ This version use Bash to convert the audio as calling Sox directly fails
+ """
+ filebash = "/tmp/bash-%s.sh" % str(uuid1())
+
+ logger.warning('Convert audio file :> %s' % str(conv))
+ logger.warning('Filebash :> %s' % filebash)
+
+ filename = conv.split(' ')[1].strip()
+ if os.path.isfile(filename):
+ logger.debug("File exists!")
+ else:
+ logger.error("Error: File don't exist!")
+ return False
+
+ with open(filebash, 'w') as mfile:
+ mfile.write('#!/bin/bash\n')
+ mfile.write(conv)
+ mfile.write('\n')
+
+ cmd = [
+ 'bash',
+ filebash
+ ]
+
+ # output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0].decode("utf-8")
+ response = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ (output, error) = response.communicate()
+ if error:
+ logger.error('Error conversion : %s ' % error)
+
+ return response
+
+
+@task()
+def old_run_convert_task(conv):
+ """Exec the audio convert"""
+
+ logger.warning('Convert audio file :> %s' % str(conv))
+
+ filename = conv.split(' ')[1].strip()
+ if os.path.isfile(filename):
+ logger.debug("File exists!")
+ else:
+ logger.error("Error: File don't exist!")
+
+ # Option 1 : Popen
+ response = subprocess.Popen(conv.split(' '), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ (output, error) = response.communicate()
+ if error:
+ logger.error('Conv :')
+ logger.error(conv.split(' '))
+ logger.error('Error conversion2 : %s ' % error)
+
+ # Option 2 : Popen & Shlex
+ # args = shlex.split(conv)
+ # p = subprocess.Popen(args)
+
+ return response
diff --git a/fantasmixDjango/django_project/audiofield/templates/common_audiofield.html b/fantasmixDjango/django_project/audiofield/templates/common_audiofield.html
new file mode 100755
index 0000000000000000000000000000000000000000..f02acefbbd8b0240e7f4c04c25b23bb4922c5ede
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/templates/common_audiofield.html
@@ -0,0 +1,57 @@
+<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}audiofield/page-player/css/page-player.css" />
+<style type="text/css">
+ ul.playlist li a {
+ color: #333333;
+ display: block;
+ font-family: "Lucida Grande","DejaVu Sans","Bitstream Vera Sans","Verdana,Arial,sans-serif";
+ font-size: 12px;
+ vertical-align: top;
+ }
+</style>
+<!-- soundManager.useFlashBlock: related CSS -->
+<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}audiofield/flashblock/flashblock.css" />
+<script type="text/javascript" src="{{ STATIC_URL }}audiofield/script/soundmanager2.js"></script>
+
+<script>
+/* --------
+ Config override: This demo uses shiny flash 9 stuff, overwriting Flash 8-based defaults
+ Alternate PP_CONFIG object must be defined before soundManager.onready()/onload() fire.
+ Alternately, edit the config in page-player.js to simply use the values below by default
+-------- */
+
+// demo only, but you can use these settings too..
+soundManager.flashVersion = 9;
+soundManager.preferFlash = true; // for visualization effects
+soundManager.useHighPerformance = true; // keep flash on screen, boost performance
+soundManager.wmode = 'transparent'; // transparent SWF, if possible
+soundManager.useFastPolling = true; // increased JS callback frequency
+soundManager.url = {{ STATIC_URL }}+'audiofield/swf/';
+soundManager.debugFlash = false;
+soundManager.debugMode = true;
+// Added
+//soundManager.useHTML5Audio = false;
+
+// custom page player configuration
+
+var PP_CONFIG = {
+ autoStart: false, // begin playing first sound when page loads
+ playNext: false, // stop after one sound, or play through list until end
+ useThrottling: false, // try to rate-limit potentially-expensive calls (eg. dragging position around)</span>
+ usePeakData: true, // [Flash 9 only] whether or not to show peak data (left/right channel values) - nor noticable on CPU
+ useWaveformData: false,// [Flash 9 only] show raw waveform data - WARNING: LIKELY VERY CPU-HEAVY
+ useEQData: false, // [Flash 9 only] show EQ (frequency spectrum) data
+ useFavIcon: false, // try to apply peakData to address bar (Firefox + Opera) - performance note: appears to make Firefox 3 do some temporary, heavy disk access/swapping/garbage collection at first(?) - may be too heavy on CPU
+ useMovieStar: true // Flash 9.0r115+ only: Support for a subset of MPEG4 formats.
+}
+</script>
+
+<script type="text/javascript" src="{{ STATIC_URL }}audiofield/page-player/script/page-player.js"></script>
+<script type="text/javascript">
+
+// demo only..
+function setTheme(sTheme) {
+ var o = document.getElementsByTagName('ul')[0];
+ o.className = 'playlist'+(sTheme?' '+sTheme:'');
+ return false;
+}
+</script>
diff --git a/fantasmixDjango/django_project/audiofield/tests.py b/fantasmixDjango/django_project/audiofield/tests.py
new file mode 100755
index 0000000000000000000000000000000000000000..ae4ba31eb5e43b65ef4c7175aa3a953376b07882
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/tests.py
@@ -0,0 +1,58 @@
+#
+# django-audiofield License
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# Copyright (C) 2011-2014 Star2Billing S.L.
+#
+# The Initial Developer of the Original Code is
+# Arezqui Belaid <info@star2billing.com>
+#
+
+from django.contrib.auth.models import User
+from django.test import TestCase
+from common.utils import BaseAuthenticatedClient
+from audiofield.models import AudioFile
+from audiofield.forms import CustomerAudioFileForm
+
+
+class AudiofieldAdminInterfaceTestCase(BaseAuthenticatedClient):
+ """Test cases for Audiofield Admin Interface."""
+
+ def test_admin_audiofile_list(self):
+ """Test Function to check admin audio file list"""
+ response = self.client.get('/admin/audiofield/audiofile/')
+ self.failUnlessEqual(response.status_code, 200)
+
+ def test_admin_audiofile_add(self):
+ """Test Function to check admin audio file add"""
+ response = self.client.get('/admin/audiofield/audiofile/add/')
+ self.failUnlessEqual(response.status_code, 200)
+
+
+class AudioFileModel(TestCase):
+ """Test AudioFile model"""
+
+ fixtures = ['auth_user.json']
+
+ def setUp(self):
+ self.user = User.objects.get(username='admin')
+ self.audiofile = AudioFile(
+ name='MyAudio',
+ user=self.user,
+ )
+ self.audiofile.save()
+
+ def test_name(self):
+ self.assertEqual(self.audiofile.name, "MyAudio")
+
+ def test_audio_form(self):
+ form = CustomerAudioFileForm(instance=self.audiofile)
+
+ self.assertTrue(isinstance(form.instance, AudioFile))
+ self.assertEqual(form.instance.pk, self.audiofile.pk)
+
+ def teardown(self):
+ self.audiofile.delete()
diff --git a/fantasmixDjango/django_project/audiofield/widgets.py b/fantasmixDjango/django_project/audiofield/widgets.py
new file mode 100755
index 0000000000000000000000000000000000000000..35c4a5b2a50f80b35e41192bbd7ccaedc31fbef6
--- /dev/null
+++ b/fantasmixDjango/django_project/audiofield/widgets.py
@@ -0,0 +1,164 @@
+#
+# django-audiofield License
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# Copyright (C) 2011-2014 Star2Billing S.L.
+#
+# The Initial Developer of the Original Code is
+# Arezqui Belaid <info@star2billing.com>
+#
+from __future__ import unicode_literals
+
+from django.contrib.admin.widgets import AdminFileWidget
+from django import forms
+from django.utils.translation import ugettext_lazy as _
+from django.utils.safestring import mark_safe
+from django.conf import settings
+import os.path
+
+
+CHANNEL_TYPE = (
+ ('0', _('Keep original')),
+ ('1', _('Mono')),
+ ('2', _('Stereo')),
+)
+
+FREQ_TYPE = (
+ ('0', _('Keep original')),
+ ('8000', _('8000 Hz')),
+ ('16000', _('16000 Hz')),
+ ('22050', _('22050 Hz')),
+ ('44100', _('44100 Hz')),
+ ('48000', _('48000 Hz')),
+)
+
+CONVERT_TYPE = (
+ ('0', _('Keep original audio file')),
+ ('1', _('Convert to MP3')),
+ ('2', _('Convert to WAV')),
+ ('3', _('Convert to OGG')),
+)
+
+
+def add_select_box(select_name, select_value):
+ '''
+ function to create Html select option
+ '''
+ select_box = '<select name="%s">' % (select_name)
+ for i in select_value:
+ select_box += '<option value="%s">%s</option>' % (i[0], i[1])
+ select_box += '</select>'
+ return select_box
+
+
+class AdminAudioFileWidget(AdminFileWidget):
+ '''
+ A AdminFileWidget that shows
+ - audio player to play uploaded file
+ - file browser
+ - audio type conversion
+ - If conversion is mp3 to wav, you can add channel type & frequency
+ - a delete checkbox
+ '''
+ input_type = 'file'
+
+ def render(self, name, value, attrs=None):
+ input = super(forms.widgets.FileInput, self).render(name, value, attrs)
+
+ file_select_box = add_select_box('convert_type', CONVERT_TYPE)
+ channel_select_box = add_select_box('channel_type', CHANNEL_TYPE)
+ freq_select_box = add_select_box('freq_type', FREQ_TYPE)
+
+ file_url = ''
+ item = '<tr><td style="vertical-align: middle;">%s</td><td>%s</td>'
+ output = []
+ output.append('<table style="border-style: none;">')
+ help_text = _('Allowed format - mp3 wav and ogg')
+ if value and type(value).__name__ != 'str':
+ file_url = settings.MEDIA_URL + str(value)
+ output.append(item % (
+ _('Currently:'),
+ '<audio src="%s" controls>Your browser does not support the audio element.</audio>' % (file_url)))
+ output.append(item % (_('Change:'), input + '<br/>%s' % help_text))
+ else:
+ output.append(item % (_('Upload:'), input + '<br/>%s' % help_text))
+
+ output.append(item % (_('Convert to:'), file_select_box))
+ output.append(item % (_('Channel:'), channel_select_box))
+ output.append(item % (_('Frequency:'), freq_select_box))
+
+ if value:
+ # split colon to force "Delete" that is already translated
+ output.append(item % (_('Delete:'), '<input type="checkbox" name="%s_delete"/>' % name))
+ output.append('</table>')
+
+ return mark_safe(''.join(output))
+
+ def value_from_datadict(self, data, files, name):
+ if not data.get('%s_delete' % name):
+ return super(AdminAudioFileWidget, self).value_from_datadict(data, files, name)
+ else:
+ return '__deleted__'
+
+
+class CustomerAudioFileWidget(AdminFileWidget):
+ '''
+ A CustomerAudioFileWidget that shows
+ - audio player to play uploaded file
+ - file browser
+ - hidden variables which are set in settings.py
+ - audio type conversion
+ - If conversion is mp3 to wav, you can add channel type & frequency
+ '''
+ input_type = 'file'
+
+ def render(self, name, value, attrs=None):
+ input = super(forms.widgets.FileInput, self).render(name, value, attrs)
+
+ file_url = ''
+
+ file_select_box = '<input type="hidden" name="convert_type" value="%s"/>' % settings.CONVERT_TYPE_VALUE
+ channel_select_box = '<input type="hidden" name="channel_type" value="%s"/>' % settings.CHANNEL_TYPE_VALUE
+ freq_select_box = '<input type="hidden" name="freq_type" value="%s"/>' % settings.FREQ_TYPE_VALUE
+
+ output = []
+
+ label_style = 'float:left;line-height:18px;padding-top:6px;text-align:right;'
+ input_div_style = 'width:300px;margin-left:70px;'
+
+ item = '<div style="' + label_style + '">%s</div><div style="' + input_div_style + '">%s</div>'
+ help_text = '<span class="help-block">%s</span>' % _('Allowed format - mp3, wav and ogg')
+
+ form_var = 0
+ if value and type(value).__name__ != 'str':
+ dst_fullpath = os.path.join(settings.MEDIA_ROOT, str(value))
+ if os.path.isfile(dst_fullpath):
+ file_url = settings.MEDIA_URL + str(value)
+ output.append(item % (
+ _('Currently:'),
+ '<audio src="%s" controls>Your browser does not support the audio element.</audio>' % (file_url)))
+ output.append(item % (_('Change:'), input + help_text))
+ form_var = 1 # no error
+ else:
+ form_var = 0 # form error
+
+ # default
+ if form_var == 0:
+ input_div_style = 'width:300px;'
+ item = '<div style="' + label_style + '">%s</div><div style="' + input_div_style + '">%s</div>'
+ output.append(item % ('', input + help_text))
+
+ output.append(item % (file_select_box, ''))
+ output.append(item % (channel_select_box, ''))
+ output.append(item % (freq_select_box, ''))
+
+ return mark_safe(''.join(output))
+
+ def value_from_datadict(self, data, files, name):
+ if not data.get('%s_delete' % name):
+ return super(CustomerAudioFileWidget, self).value_from_datadict(data, files, name)
+ else:
+ return '__deleted__'
diff --git a/fantasmixDjango/django_project/django_project/__pycache__/settings.cpython-37.pyc b/fantasmixDjango/django_project/django_project/__pycache__/settings.cpython-37.pyc
index 542e5ea51689ba2bfd809d3e9e443b3cc8a62ba5..5afa8e6c2dea3bf8d1cb6ca7c8415c846b50469b 100644
Binary files a/fantasmixDjango/django_project/django_project/__pycache__/settings.cpython-37.pyc and b/fantasmixDjango/django_project/django_project/__pycache__/settings.cpython-37.pyc differ
diff --git a/fantasmixDjango/django_project/django_project/__pycache__/urls.cpython-37.pyc b/fantasmixDjango/django_project/django_project/__pycache__/urls.cpython-37.pyc
index 551f7d09040af6903e06aec358112ecdd3930380..95180892facf5fdb917ab90f5ac2f4d7b9ca8c4f 100644
Binary files a/fantasmixDjango/django_project/django_project/__pycache__/urls.cpython-37.pyc and b/fantasmixDjango/django_project/django_project/__pycache__/urls.cpython-37.pyc differ
diff --git a/fantasmixDjango/django_project/django_project/urls.py b/fantasmixDjango/django_project/django_project/urls.py
index 109cf7a0ac214de760f26768d127fa56abb0d99d..483117e24398e84cdd54527f35aef14698c6285f 100644
--- a/fantasmixDjango/django_project/django_project/urls.py
+++ b/fantasmixDjango/django_project/django_project/urls.py
@@ -16,5 +16,4 @@ urlpatterns = [
url(r'admin/', admin.site.urls),
url(r'^home/generateMusic/$', views.generateMusic, name='generateMusic'),
url(r'^home/generateMusicTest/$', views.getSettings, name='getSettings'),
-
]
diff --git a/fantasmixDjango/django_project/fluidsynth/25-piano-sf.rar b/fantasmixDjango/django_project/fluidsynth/25-piano-sf.rar
new file mode 100644
index 0000000000000000000000000000000000000000..02d271eac9b767b87a41609f353480f002f103ff
Binary files /dev/null and b/fantasmixDjango/django_project/fluidsynth/25-piano-sf.rar differ
diff --git a/fantasmixDjango/django_project/fluidsynth/FluidR3_GM.sf2 b/fantasmixDjango/django_project/fluidsynth/FluidR3_GM.sf2
new file mode 100644
index 0000000000000000000000000000000000000000..443d42bf487327c37938c5a3403540845aa20f2b
Binary files /dev/null and b/fantasmixDjango/django_project/fluidsynth/FluidR3_GM.sf2 differ
diff --git a/fantasmixDjango/django_project/fluidsynth/GoldDrums.sfpack b/fantasmixDjango/django_project/fluidsynth/GoldDrums.sfpack
new file mode 100644
index 0000000000000000000000000000000000000000..21bd5ddade3b2579ea934279c503483ec4c67e70
Binary files /dev/null and b/fantasmixDjango/django_project/fluidsynth/GoldDrums.sfpack differ
diff --git a/fantasmixDjango/django_project/fluidsynth/StabBrass_JJ.sf2 b/fantasmixDjango/django_project/fluidsynth/StabBrass_JJ.sf2
new file mode 100755
index 0000000000000000000000000000000000000000..a793d671f2e51109ca47328aa81cf27e7a422db4
Binary files /dev/null and b/fantasmixDjango/django_project/fluidsynth/StabBrass_JJ.sf2 differ
diff --git a/fantasmixDjango/django_project/fluidsynth/VMStabII_JJ.sf2 b/fantasmixDjango/django_project/fluidsynth/VMStabII_JJ.sf2
new file mode 100755
index 0000000000000000000000000000000000000000..92850604331809006bfa58ff08be813b21cf59f6
Binary files /dev/null and b/fantasmixDjango/django_project/fluidsynth/VMStabII_JJ.sf2 differ
diff --git a/fantasmixDjango/django_project/fluidsynth/VMStab_JJ.sf2 b/fantasmixDjango/django_project/fluidsynth/VMStab_JJ.sf2
new file mode 100755
index 0000000000000000000000000000000000000000..afbb7e524d6652482cadcbe327e7b59f62d96042
Binary files /dev/null and b/fantasmixDjango/django_project/fluidsynth/VMStab_JJ.sf2 differ
diff --git a/fantasmixDjango/django_project/out.wav b/fantasmixDjango/django_project/out.wav
new file mode 100644
index 0000000000000000000000000000000000000000..878bf23ceab94d07389dc32df995862f4da2b0c9
Binary files /dev/null and b/fantasmixDjango/django_project/out.wav differ
diff --git a/fantasmixDjango/django_project/scripts/__pycache__/midiClass.cpython-37.pyc b/fantasmixDjango/django_project/scripts/__pycache__/midiClass.cpython-37.pyc
index 148d9c42ceeb546f23a0c5987172fbcdd9527de8..3822999787d419c1312ca8b3fd01aab4fda7aeb8 100644
Binary files a/fantasmixDjango/django_project/scripts/__pycache__/midiClass.cpython-37.pyc and b/fantasmixDjango/django_project/scripts/__pycache__/midiClass.cpython-37.pyc differ
diff --git a/fantasmixDjango/django_project/scripts/midiClass.py b/fantasmixDjango/django_project/scripts/midiClass.py
index 419d4bef414ee9451eb264469b4061b909436d3b..026c53c78ab02b137474b37552b311210372720a 100644
--- a/fantasmixDjango/django_project/scripts/midiClass.py
+++ b/fantasmixDjango/django_project/scripts/midiClass.py
@@ -1,5 +1,6 @@
import random
from midiutil import MIDIFile
+import os.path
random.seed()
@@ -197,7 +198,11 @@ class midi():
trackTime = self.addMotif(pitch_B, time_B, trackTime, MyMIDI)
trackTime = self.addMotif(pitch_B, time_B, trackTime, MyMIDI)
- with open(self.name, "wb") as output_file:
+ # {% load static %}
+ # save_path = "{% static 'audio/' %}"
+ save_path = "static/audio/" + self.name
+
+ with open(save_path, "wb") as output_file:
MyMIDI.writeFile(output_file)
diff --git a/fantasmixDjango/django_project/static/.DS_Store b/fantasmixDjango/django_project/static/.DS_Store
index 56cfdd2b5974e0bc12d2c7bf955aa0fe0e0a398b..d7c2ef7913bb95282512e89e2f65a4db43c7a5ae 100644
Binary files a/fantasmixDjango/django_project/static/.DS_Store and b/fantasmixDjango/django_project/static/.DS_Store differ
diff --git a/fantasmixDjango/django_project/static/audio/audio_samples/Rain on Car Roof.aac b/fantasmixDjango/django_project/static/audio/audio_samples/Rain on Car Roof.aac
new file mode 100755
index 0000000000000000000000000000000000000000..244be84f0a9ff848a2ae21cc929fd33c40b8a503
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/audio_samples/Rain on Car Roof.aac differ
diff --git a/fantasmixDjango/django_project/static/audio/audio_samples/duck.wav b/fantasmixDjango/django_project/static/audio/audio_samples/duck.wav
new file mode 100755
index 0000000000000000000000000000000000000000..96fa4282a72630732cc214eddc92317eb71f9004
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/audio_samples/duck.wav differ
diff --git a/fantasmixDjango/django_project/static/audio/audio_samples/rain.mp3 b/fantasmixDjango/django_project/static/audio/audio_samples/rain.mp3
new file mode 100755
index 0000000000000000000000000000000000000000..86050cbdf01632991e687fd80e65dc4cc9aed109
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/audio_samples/rain.mp3 differ
diff --git a/fantasmixDjango/django_project/static/audio/audio_samples/sample_ogg.ogg b/fantasmixDjango/django_project/static/audio/audio_samples/sample_ogg.ogg
new file mode 100755
index 0000000000000000000000000000000000000000..1c03444c8abdcc39873af3778fed4c48a8310f93
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/audio_samples/sample_ogg.ogg differ
diff --git a/fantasmixDjango/django_project/static/audio/audio_samples/select.mp3 b/fantasmixDjango/django_project/static/audio/audio_samples/select.mp3
new file mode 100755
index 0000000000000000000000000000000000000000..9f9c7112409b59e679744ed90fecc36915d076a1
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/audio_samples/select.mp3 differ
diff --git a/fantasmixDjango/django_project/static/audio/audio_samples/sine, square, sawtooth, rando.mp3 b/fantasmixDjango/django_project/static/audio/audio_samples/sine, square, sawtooth, rando.mp3
new file mode 100755
index 0000000000000000000000000000000000000000..a649164e7d4e5ec7b85f38a1db68ba030c1bdc59
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/audio_samples/sine, square, sawtooth, rando.mp3 differ
diff --git a/fantasmixDjango/django_project/static/audio/audio_samples/walking.mp3 b/fantasmixDjango/django_project/static/audio/audio_samples/walking.mp3
new file mode 100755
index 0000000000000000000000000000000000000000..45f660ea528119568d4373716468d7886978111d
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/audio_samples/walking.mp3 differ
diff --git a/fantasmixDjango/django_project/static/audio/audio_samples/webconf.wav b/fantasmixDjango/django_project/static/audio/audio_samples/webconf.wav
new file mode 100755
index 0000000000000000000000000000000000000000..9668851cf40b21bce000dcb8473ee926f256e267
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/audio_samples/webconf.wav differ
diff --git a/fantasmixDjango/django_project/static/audio/banjo.mid b/fantasmixDjango/django_project/static/audio/banjo.mid
new file mode 100644
index 0000000000000000000000000000000000000000..9e616f8a25e4d05fec0aa7ed11f26d2b4c1cfd46
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/banjo.mid differ
diff --git a/fantasmixDjango/django_project/static/audio/banjokazooie.mid b/fantasmixDjango/django_project/static/audio/banjokazooie.mid
new file mode 100644
index 0000000000000000000000000000000000000000..970b4e5cfba4308b0b0bb1aebe983307f30a8dc7
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/banjokazooie.mid differ
diff --git a/fantasmixDjango/django_project/static/audio/banjokazooie2.mid b/fantasmixDjango/django_project/static/audio/banjokazooie2.mid
new file mode 100644
index 0000000000000000000000000000000000000000..432d897c7cef1b7c98469c5c93770a88b2dea804
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/banjokazooie2.mid differ
diff --git a/fantasmixDjango/django_project/static/audio/bass.mid b/fantasmixDjango/django_project/static/audio/bass.mid
new file mode 100644
index 0000000000000000000000000000000000000000..a7433fdbf14dffc22214cd55e2b98febd1e30b79
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/bass.mid differ
diff --git a/fantasmixDjango/django_project/static/audio/convertedFiles/banjo.wav b/fantasmixDjango/django_project/static/audio/convertedFiles/banjo.wav
new file mode 100644
index 0000000000000000000000000000000000000000..8f2e0851d561cac838714ea6c1343f1d3a4671d4
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/convertedFiles/banjo.wav differ
diff --git a/fantasmixDjango/django_project/static/audio/convertedFiles/banjokazooie.wav b/fantasmixDjango/django_project/static/audio/convertedFiles/banjokazooie.wav
new file mode 100644
index 0000000000000000000000000000000000000000..175c83f3932cb155b5aa16fee5a13fa647bd06b5
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/convertedFiles/banjokazooie.wav differ
diff --git a/fantasmixDjango/django_project/static/audio/convertedFiles/banjokazooie2.wav b/fantasmixDjango/django_project/static/audio/convertedFiles/banjokazooie2.wav
new file mode 100644
index 0000000000000000000000000000000000000000..b1ba8ffeaec8172e925d0fd6e07520ff73c35ce3
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/convertedFiles/banjokazooie2.wav differ
diff --git a/fantasmixDjango/django_project/static/audio/convertedFiles/bass.wav b/fantasmixDjango/django_project/static/audio/convertedFiles/bass.wav
new file mode 100644
index 0000000000000000000000000000000000000000..0dea879704cef497381f3c3143b0c02134968a07
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/convertedFiles/bass.wav differ
diff --git a/fantasmixDjango/django_project/static/audio/convertedFiles/guitar.wav b/fantasmixDjango/django_project/static/audio/convertedFiles/guitar.wav
new file mode 100644
index 0000000000000000000000000000000000000000..7cb32efb3458e86f6a927da70ebed34e75cab1d7
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/convertedFiles/guitar.wav differ
diff --git a/fantasmixDjango/django_project/static/audio/convertedFiles/name.wav b/fantasmixDjango/django_project/static/audio/convertedFiles/name.wav
new file mode 100644
index 0000000000000000000000000000000000000000..a6881bffaaf89d5998c58d1300429374f0508dc9
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/convertedFiles/name.wav differ
diff --git a/fantasmixDjango/django_project/static/audio/convertedFiles/piano.wav b/fantasmixDjango/django_project/static/audio/convertedFiles/piano.wav
new file mode 100644
index 0000000000000000000000000000000000000000..7acbe87d11a85c2211ed300e07410e184925a38b
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/convertedFiles/piano.wav differ
diff --git a/fantasmixDjango/django_project/static/audio/convertedFiles/synth.wav b/fantasmixDjango/django_project/static/audio/convertedFiles/synth.wav
new file mode 100644
index 0000000000000000000000000000000000000000..9547de2b820c923420750ed23fda55b58dd85cf0
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/convertedFiles/synth.wav differ
diff --git a/fantasmixDjango/django_project/static/audio/convertedFiles/synthlong.wav b/fantasmixDjango/django_project/static/audio/convertedFiles/synthlong.wav
new file mode 100644
index 0000000000000000000000000000000000000000..f8ef1b8071e09c30fe3cb29de61ae09beea69d3b
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/convertedFiles/synthlong.wav differ
diff --git a/fantasmixDjango/django_project/static/audio/convertedFiles/testing_space_s.wav b/fantasmixDjango/django_project/static/audio/convertedFiles/testing_space_s.wav
new file mode 100644
index 0000000000000000000000000000000000000000..acfbcbfb0c4b53e6fdf4ed19a652c883bac8efb1
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/convertedFiles/testing_space_s.wav differ
diff --git a/fantasmixDjango/django_project/static/audio/convertedFiles/testing_spaces.wav b/fantasmixDjango/django_project/static/audio/convertedFiles/testing_spaces.wav
new file mode 100644
index 0000000000000000000000000000000000000000..b492b4da95abd5d9bd6576dc4c2c72f463ac2670
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/convertedFiles/testing_spaces.wav differ
diff --git a/fantasmixDjango/django_project/static/audio/convertedFiles/violin.wav b/fantasmixDjango/django_project/static/audio/convertedFiles/violin.wav
new file mode 100644
index 0000000000000000000000000000000000000000..2e19ed4f95c42c6217d6306caa9d3081c27dfca6
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/convertedFiles/violin.wav differ
diff --git a/fantasmixDjango/django_project/static/audio/guitar.mid b/fantasmixDjango/django_project/static/audio/guitar.mid
new file mode 100644
index 0000000000000000000000000000000000000000..9973ad4db4e0c8c39f57c3874065ac8f8bb76ce0
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/guitar.mid differ
diff --git a/fantasmixDjango/django_project/static/audio/name.mid b/fantasmixDjango/django_project/static/audio/name.mid
new file mode 100644
index 0000000000000000000000000000000000000000..8352be175bc63f021aa6bf723d1647aa0c897beb
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/name.mid differ
diff --git a/fantasmixDjango/django_project/static/audio/piano.mid b/fantasmixDjango/django_project/static/audio/piano.mid
new file mode 100644
index 0000000000000000000000000000000000000000..9a4bf88b5a565ae9902522ed44bddacb291c8f97
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/piano.mid differ
diff --git a/fantasmixDjango/django_project/static/audio/synth long.mid b/fantasmixDjango/django_project/static/audio/synth long.mid
new file mode 100644
index 0000000000000000000000000000000000000000..f2fec0dbcf6c9239f21e8b6a1836459c9d1308d6
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/synth long.mid differ
diff --git a/fantasmixDjango/django_project/static/audio/synth.mid b/fantasmixDjango/django_project/static/audio/synth.mid
new file mode 100644
index 0000000000000000000000000000000000000000..0cf8b6f51a3c6d1a7b79ba65d1285154d2e5c7eb
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/synth.mid differ
diff --git a/fantasmixDjango/django_project/static/audio/synthlong.mid b/fantasmixDjango/django_project/static/audio/synthlong.mid
new file mode 100644
index 0000000000000000000000000000000000000000..20901dfc1b1e767e91e1700c73c447ca0f3a671e
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/synthlong.mid differ
diff --git a/fantasmixDjango/django_project/static/audio/testing_space_s.mid b/fantasmixDjango/django_project/static/audio/testing_space_s.mid
new file mode 100644
index 0000000000000000000000000000000000000000..87b51795626c96948cadc90b367e922ddfff5809
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/testing_space_s.mid differ
diff --git a/fantasmixDjango/django_project/static/audio/testing_spaces.mid b/fantasmixDjango/django_project/static/audio/testing_spaces.mid
new file mode 100644
index 0000000000000000000000000000000000000000..cc73b940760de42777a890ea345c57af91f20b59
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/testing_spaces.mid differ
diff --git a/fantasmixDjango/django_project/static/audio/violin.mid b/fantasmixDjango/django_project/static/audio/violin.mid
new file mode 100644
index 0000000000000000000000000000000000000000..ce9c7be780f2f37abaa7d6afc0e3bd24e4cc92db
Binary files /dev/null and b/fantasmixDjango/django_project/static/audio/violin.mid differ
diff --git a/fantasmixDjango/django_project/static/images/name.mid b/fantasmixDjango/django_project/static/images/name.mid
new file mode 100644
index 0000000000000000000000000000000000000000..f1d1738db975f11455ef258236ed3fb39a19211f
Binary files /dev/null and b/fantasmixDjango/django_project/static/images/name.mid differ
diff --git a/fantasmixDjango/django_project/static/images/testingasdf.mid b/fantasmixDjango/django_project/static/images/testingasdf.mid
new file mode 100644
index 0000000000000000000000000000000000000000..d024df50a2f2d130a2433310af60d31c907bfa36
Binary files /dev/null and b/fantasmixDjango/django_project/static/images/testingasdf.mid differ
diff --git a/fantasmixDjango/django_project/votings/__pycache__/forms.cpython-37.pyc b/fantasmixDjango/django_project/votings/__pycache__/forms.cpython-37.pyc
index 978f5afd07b72399f54e91868ec2668e6c3fc9ac..72f0cac79a24151aa4451e380474f0236e056097 100644
Binary files a/fantasmixDjango/django_project/votings/__pycache__/forms.cpython-37.pyc and b/fantasmixDjango/django_project/votings/__pycache__/forms.cpython-37.pyc differ
diff --git a/fantasmixDjango/django_project/votings/__pycache__/models.cpython-37.pyc b/fantasmixDjango/django_project/votings/__pycache__/models.cpython-37.pyc
index 3b2423b590870f95ac3456e43ba19a4050533610..f850cd72bbd5da528c76ea7e000466e34ee4e66b 100644
Binary files a/fantasmixDjango/django_project/votings/__pycache__/models.cpython-37.pyc and b/fantasmixDjango/django_project/votings/__pycache__/models.cpython-37.pyc differ
diff --git a/fantasmixDjango/django_project/votings/__pycache__/views.cpython-37.pyc b/fantasmixDjango/django_project/votings/__pycache__/views.cpython-37.pyc
index 816047c79cc8577d8e1865020bb63a3209b9c309..b8685fd36e8b1d10dd0f6606302d8a7e27f59acd 100644
Binary files a/fantasmixDjango/django_project/votings/__pycache__/views.cpython-37.pyc and b/fantasmixDjango/django_project/votings/__pycache__/views.cpython-37.pyc differ
diff --git a/fantasmixDjango/django_project/votings/forms.py b/fantasmixDjango/django_project/votings/forms.py
index db25510149d3b8899af48c5a41029127300ab5ec..6da8976988d379fc75bffbd329dc48031d43fdf1 100644
--- a/fantasmixDjango/django_project/votings/forms.py
+++ b/fantasmixDjango/django_project/votings/forms.py
@@ -1,12 +1,33 @@
from django import forms
-"""class MyForm(forms.Form):
- NAME_CHOICES = (('songName', 'name'),
- 'tempo', 'mid'))
- name = forms.ChoiceField(choices=NAME_CHOICES)"""
-
+# generate.html test form class
class NameForm(forms.Form):
songName = forms.CharField(label='songName', max_length=100)
- #tempo = forms.CharField(label='tempo', max_length=100)
- #length = forms.CharField(label='length', max_length=100)
- #instrument = forms.CharField(label='instrument', max_length=100)
+ tempo = forms.CharField(label="tempo", required=True)
+ length = forms.CharField(label="length", required=True)
+ instrument = forms.CharField(label="instrument", required=True)
+ scale = forms.CharField(label="instrument", required=True)
+
+# generate.html dropdown Scale
+class scaleForm(forms.Form):
+ SCALE_CHOICES=(("major", "major"), ("minor", "minor"))
+ scalechoice = forms.ChoiceField(label="scalechoice", choices=SCALE_CHOICES)
+
+# generate.html dropdown Length
+class lengthForm(forms.Form):
+ LENGTH_CHOICES=(("short", "short"), ("mid", "mid"), ("long", "long"))
+ lengthchoice = forms.ChoiceField(label="lengthchoice", choices=LENGTH_CHOICES)
+
+# generate.html dropdown Tempo
+class tempoForm(forms.Form):
+ TEMPO_CHOICES=(("slow", "slow"), ("mid", "mid"), ("fast", "fast"), ("faster", "faster"))
+ tempochoice = forms.ChoiceField(label="tempochoice", choices=TEMPO_CHOICES)
+
+# generate.html dropdown Instrument
+class instrumentForm(forms.Form):
+ INSTRUMENT_CHOICES=(("piano", "piano"), ("guitar", "guitar"), ("synth", "synth"), ("violin", "violin"), ("banjo", "banjo"))
+ instrumentchoice = forms.ChoiceField(label="instrumentchoice", choices=INSTRUMENT_CHOICES)
+
+# generate.html dropdown Song Name
+class songNameForm(forms.Form):
+ songName = forms.CharField(label='songName', max_length=100)
diff --git a/fantasmixDjango/django_project/votings/models.py b/fantasmixDjango/django_project/votings/models.py
index 71a836239075aa6e6e4ecb700e9c42c95c022d91..81a5efc91b401c88d64887b167d6ac48cc303135 100644
--- a/fantasmixDjango/django_project/votings/models.py
+++ b/fantasmixDjango/django_project/votings/models.py
@@ -1,3 +1,6 @@
from django.db import models
-# Create your models here.
+class Profile(models.Model):
+ #user = models.OneToOneField(User)
+ CHOICES=[(1, "empty"), (2, "major"), (3, "minor")]
+ #scalechoice = models.IntegerField(choices=CHOICES)
diff --git a/fantasmixDjango/django_project/votings/templates/musicgenerate.html b/fantasmixDjango/django_project/votings/templates/musicgenerate.html
index 99b33c04805eb815861e8bf84bec4af916d5f7a6..06f8c993650e4ca61d3aea87896af86de278199b 100644
--- a/fantasmixDjango/django_project/votings/templates/musicgenerate.html
+++ b/fantasmixDjango/django_project/votings/templates/musicgenerate.html
@@ -1,6 +1,8 @@
<html>
<head>
- {% load static %}
+ <!-- Django Python added code-->
+ {% load static %}
+
<title>Fantasmix | Generate</title>
<link rel="icon" href="CaptureX.png">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
@@ -20,20 +22,21 @@
animation: breath 30s linear infinite;
}
</style>
-<body>
-<div class = "navi">
+<body onload="initFunction()">
<ul>
+ <!-- Django Python added code-->
<li><img src="{% static 'images/CaptureX.PNG' %}" class = "logo"></li>
<li><a href="/home/">Home</a></li>
<li><a href="/home/about/">About Project</a></li>
<li><a href="/home/generate/">Generate Music</a></li>
<li><a href="/login/">Login</a></li>
</ul>
-</div>
<br>
+<!--
<div class = "container-fluid">
<h1 class="animated fadeInUp">Generate Music</h1>
<hr>
+
<div class = "container">
<div class="col-lg-6">
<h2 class="animated fadeInUp">Length <i class="material-icons" style ="font-size: 30px;" href="#" data-toggle="popover" title="What is length?" data-content="Length in this context refers to how long you would like the song you produce to be. Click the respective radio button below to your preferred length!">help</i></h2>
@@ -75,8 +78,8 @@
<div class = "container">
<div class="col-lg-6">
<h2 class="animated fadeInUp">Instruments <i class="material-icons" style ="font-size: 30px;" href="#" data-toggle="popover" title="How does choosing an instrument work?" data-content="Instruments will define what kind of music you are hearing. The main melody will be played by the primary instrument selected below. The secondary instrument will supply supporting sounds. Below you can select a primary and secondary instrument using the dropdown menus.">help</i></h2>
- <label for="primaryInstrument" style = "font-weight: normal;">Primary Instrument:</label>
- <select class="form-control" id="primaryInstrument">
+ <label style = "font-weight: normal;">Primary Instrument:</label>
+ <select class="form-control" name="primaryInstrument">
<option value="empty">Pick an instrument</option>
<option value="piano">Piano</option>
<option value="guitar">Guitar</option>
@@ -99,41 +102,104 @@
<div class="col-lg-6">
<h2 class="animated fadeInUp">Scale <i class="material-icons" style ="font-size: 30px;" href="#" data-toggle="popover" title="What is scale?" data-content="Music scale is an organized sequence of notes. Depending what scale you choose, the pitch of your music will change!">help</i></h2>
- <label for="scalechoice" style = "font-weight: normal;">Scale:</label>
- <select class="form-control"id="scalechoice">
+ <label style="font-weight: normal;">Scale:</label>
+ <select class="form-control" name="scalechoice">
<option value="empty">Pick an scale</option>
<option value="major">Major</option>
<option value="minor">Minor</option>
</select>
</div>
</div>
-<!-- <button class="btn btn-outline-success btn-block" id ="generbutt">Generate!</button> -->
+-->
+<br><br>
<!-- Django Python added code-->
-<br>
<form action="/home/generateMusic/" method="createMusic">
{% csrf_token %}
+ String Input<br>
+<div class = "container-fluid">
+ <h1 class="animated fadeInUp">Generate Music</h1>
+
+ <hr>
+ <div class = "container">
+ <div class="col-lg-6">
+ <h2 class="animated fadeInUp">Instruments <i class="material-icons" style ="font-size: 30px;" href="#" data-toggle="popover" title="How does choosing an instrument work?" data-content="Instruments will define what kind of music you are hearing. The main melody will be played by the primary instrument selected below. The secondary instrument will supply supporting sounds. Below you can select a primary and secondary instrument using the dropdown menus.">help</i></h2>
+ <label name="instrumentchoice" style="font-weight: normal;">Primary Instrument:</label>
+ <select class="form-control" name="instrumentchoice" id="instrumentchoice">
+ <option value="piano">Piano</option>
+ <option value="guitar">Guitar</option>
+ <option value="synth">Synth</option>
+ <option value="violin">Violin</option>
+ <option value="banjo">Banjo</option>
+ </select>
+ </div>
+ <div class="col-lg-6">
+ <h2 class="animated fadeInUp">Scale <i class="material-icons" style ="font-size: 30px;" href="#" data-toggle="popover" title="What is scale?" data-content="Music scale is an organized sequence of notes. Depending what scale you choose, the pitch of your music will change!">help</i></h2>
+ <label name="scalechoice" style="font-weight: normal;">Scale:</label>
+ <select class="form-control" name="scalechoice" id="scalechoice">
+ <option value="major">Major</option>
+ <option value="minor">Minor</option>
+ </select>
+ </div>
+ <div class="col-lg-6">
+ <h2 class="animated fadeInUp">Length <i class="material-icons" style ="font-size: 30px;" href="#" data-toggle="popover" title="What is scale?" data-content="Music scale is an organized sequence of notes. Depending what scale you choose, the pitch of your music will change!">help</i></h2>
+ <label name="lengthchoice" style="font-weight: normal;">Length:</label>
+ <select class="form-control" name="lengthchoice" id="lengthchoice">
+ <option value="short">Short</option>
+ <option value="mid">Mid</option>
+ <option value="long">Long</option>
+ </select>
+ </div>
+ <div class="col-lg-6">
+ <h2 class="animated fadeInUp">Tempo <i class="material-icons" style ="font-size: 30px;" href="#" data-toggle="popover" title="What is scale?" data-content="Music scale is an organized sequence of notes. Depending what scale you choose, the pitch of your music will change!">help</i></h2>
+ <label name="tempochoice" style="font-weight: normal;">Tempo:</label>
+ <select class="form-control" name="tempochoice" id="tempochoice">
+ <option value="slow">Slow</option>
+ <option value="mid">Mid</option>
+ <option value="fast">Fast</option>
+ <option value="faster">Faster</option>
+ </select>
+ </div>
+ </div>
+ <br>
+
+ <!-- Django Python added code-->
+ {% if done %}
+ <p>Recently Created Song: {{songFile}}</p>
+ <figure>
+ <audio controls src="/static/audio/convertedFiles/{{ songFile }}" type="audio/wav">
+ Your browser does not support the
+ <code>audio</code> element.
+ </audio>
+ </figure>
+ {% endif %}
+
<label>Song name: </label>
<input id="songName" type="text" name="songName" value="name">
- <input type="tempo" name="tempo" value="mid">
- <input type="length" name="length" value="short">
- <input type="intrument" name="intrument" value="Random">
+
<button type="submit" class="btn btn-outline-success btn-block" id ="generbutt">Generate!</button>
+
+ <p>All songs create in convertedFiles</p>
+ {% for analytic in analytics %}
+ <a href="/static/analytics/{{ analytic }}">{{ analytic }}</a>
+ <figure>
+ <audio controls src="/static/audio/convertedFiles/{{ analytic }}" type="audio/wav">
+ Your browser does not support the
+ <code>audio</code> element.
+ </audio>
+ </figure>
+ <br>
+ {% endfor %}
+
</form>
-{% if done %} <p> {{done}} </p> {% endif %}
-<!--
-<form action="/home/generateMusic/" method="post">
- <label for="songName">Your name: </label>
- <input id="songName" type="songName" name="songName" value="songName">
- <input type="submit" value="OK">
-</form> -->
+</div>
<!-- Django Python added code-->
</div>
</body>
<script>
-$(document).ready(function(){
- $('[data-toggle="popover"]').popover();
-});
+ $(document).ready(function(){
+ $('[data-toggle="popover"]').popover();
+ });
</script>
</html>
diff --git a/fantasmixDjango/django_project/votings/templates/musicgenerate_momo.html b/fantasmixDjango/django_project/votings/templates/musicgenerate_momo.html
new file mode 100644
index 0000000000000000000000000000000000000000..99b33c04805eb815861e8bf84bec4af916d5f7a6
--- /dev/null
+++ b/fantasmixDjango/django_project/votings/templates/musicgenerate_momo.html
@@ -0,0 +1,139 @@
+<html>
+<head>
+ {% load static %}
+ <title>Fantasmix | Generate</title>
+ <link rel="icon" href="CaptureX.png">
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
+ <link rel="stylesheet" type="text/css" href="{% static 'css/musicgeneratestyle.css' %}">
+ <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+ <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
+ <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css">
+</head>
+<style>
+ body {
+ background-image: url( "{% static 'images/hpwallpaper.jpg' %}" );
+ background-repeat: no-repeat;
+ background-size: 5000px;
+ animation: breath 30s linear infinite;
+ }
+</style>
+<body>
+<div class = "navi">
+ <ul>
+ <li><img src="{% static 'images/CaptureX.PNG' %}" class = "logo"></li>
+ <li><a href="/home/">Home</a></li>
+ <li><a href="/home/about/">About Project</a></li>
+ <li><a href="/home/generate/">Generate Music</a></li>
+ <li><a href="/login/">Login</a></li>
+ </ul>
+</div>
+<br>
+<div class = "container-fluid">
+ <h1 class="animated fadeInUp">Generate Music</h1>
+ <hr>
+<div class = "container">
+ <div class="col-lg-6">
+ <h2 class="animated fadeInUp">Length <i class="material-icons" style ="font-size: 30px;" href="#" data-toggle="popover" title="What is length?" data-content="Length in this context refers to how long you would like the song you produce to be. Click the respective radio button below to your preferred length!">help</i></h2>
+ <label class="selector" style = "font-weight: normal;">Short
+ <input type="radio" checked="checked" name="radio">
+ <span class="checkmark"></span>
+ </label>
+ <label class="selector" style = "font-weight: normal;">Mid
+ <input type="radio" name="radio">
+ <span class="checkmark"></span>
+ </label>
+ <label class="selector" style = "font-weight: normal;">Long
+ <input type="radio" name="radio">
+ <span class="checkmark"></span>
+ </label>
+ </div>
+
+ <div class="col-lg-6">
+ <h2 class="animated fadeInUp">Tempo <i class="material-icons" style ="font-size: 30px;" href="#" data-toggle="popover" title="What is tempo?" data-content="Tempo is the speed at which your music will be played. Click the respective radio button to your preferred tempo!">help</i></h2>
+ <label class="selector" style = "font-weight: normal;">Slow
+ <input type="radio" checked="checked" name="radio-alt">
+ <span class="checkmark"></span>
+ </label>
+ <label class="selector" style = "font-weight: normal;">Mid
+ <input type="radio" name="radio-alt">
+ <span class="checkmark"></span>
+ </label>
+ <label class="selector" style = "font-weight: normal;">Fast
+ <input type="radio" name="radio-alt">
+ <span class="checkmark"></span>
+ </label>
+ <label class="selector" style = "font-weight: normal;">Faster
+ <input type="radio" name="radio-alt">
+ <span class="checkmark"></span>
+ </label>
+ </div>
+</div>
+
+<div class = "container">
+ <div class="col-lg-6">
+ <h2 class="animated fadeInUp">Instruments <i class="material-icons" style ="font-size: 30px;" href="#" data-toggle="popover" title="How does choosing an instrument work?" data-content="Instruments will define what kind of music you are hearing. The main melody will be played by the primary instrument selected below. The secondary instrument will supply supporting sounds. Below you can select a primary and secondary instrument using the dropdown menus.">help</i></h2>
+ <label for="primaryInstrument" style = "font-weight: normal;">Primary Instrument:</label>
+ <select class="form-control" id="primaryInstrument">
+ <option value="empty">Pick an instrument</option>
+ <option value="piano">Piano</option>
+ <option value="guitar">Guitar</option>
+ <option value="synth">Synth</option>
+ <option value="violin">Violin</option>
+ <option value="banjo">Banjo</option>
+ </select>
+ <br>
+ <label for="secondaryInstrument" style = "font-weight: normal;">Secondary Instrument:</label>
+ <select class="form-control"id="secondaryInstrument">
+ <option value="empty">Pick an instrument</option>
+ <option value="none">None</option>
+ <option value="piano">Piano</option>
+ <option value="guitar">Guitar</option>
+ <option value="synth">Synth</option>
+ <option value="violin">Violin</option>
+ <option value="banjo">Banjo</option>
+ </select>
+ </div>
+
+ <div class="col-lg-6">
+ <h2 class="animated fadeInUp">Scale <i class="material-icons" style ="font-size: 30px;" href="#" data-toggle="popover" title="What is scale?" data-content="Music scale is an organized sequence of notes. Depending what scale you choose, the pitch of your music will change!">help</i></h2>
+ <label for="scalechoice" style = "font-weight: normal;">Scale:</label>
+ <select class="form-control"id="scalechoice">
+ <option value="empty">Pick an scale</option>
+ <option value="major">Major</option>
+ <option value="minor">Minor</option>
+ </select>
+ </div>
+ </div>
+<!-- <button class="btn btn-outline-success btn-block" id ="generbutt">Generate!</button> -->
+
+<!-- Django Python added code-->
+<br>
+<form action="/home/generateMusic/" method="createMusic">
+ {% csrf_token %}
+ <label>Song name: </label>
+ <input id="songName" type="text" name="songName" value="name">
+ <input type="tempo" name="tempo" value="mid">
+ <input type="length" name="length" value="short">
+ <input type="intrument" name="intrument" value="Random">
+ <button type="submit" class="btn btn-outline-success btn-block" id ="generbutt">Generate!</button>
+</form>
+{% if done %} <p> {{done}} </p> {% endif %}
+<!--
+<form action="/home/generateMusic/" method="post">
+ <label for="songName">Your name: </label>
+ <input id="songName" type="songName" name="songName" value="songName">
+ <input type="submit" value="OK">
+</form> -->
+<!-- Django Python added code-->
+
+</div>
+</body>
+<script>
+$(document).ready(function(){
+ $('[data-toggle="popover"]').popover();
+});
+</script>
+</html>
diff --git a/fantasmixDjango/django_project/votings/views.py b/fantasmixDjango/django_project/votings/views.py
index 192237c3faf3555ba493e3f73b58620109d54488..cc50c540789a8fd67a680671721a752ba6932135 100644
--- a/fantasmixDjango/django_project/votings/views.py
+++ b/fantasmixDjango/django_project/votings/views.py
@@ -1,10 +1,21 @@
# app views.py
from django.shortcuts import render
-import pyrebase
+import pyrebase # firebase import
from django.http import HttpResponse
from scripts.midiClass import midi
+
+# import forms
from .forms import NameForm
+from .forms import scaleForm
+from .forms import lengthForm
+from .forms import tempoForm
+from .forms import instrumentForm
+from .forms import songNameForm
+
+# fluidsynth imports
+import os
+from midi2audio import FluidSynth
def getSettings(request):
# if this is a POST request we need to process the form data
@@ -32,11 +43,10 @@ config = {
'messagingSenderId': "1037380528537",
'appId': "1:1037380528537:web:fd0a617620233116"
}
-
firebase = pyrebase.initialize_app(config)
auth = firebase.auth()
-
+# test HttpResponse request
def index(request):
return HttpResponse("Hello, world. You're at the polls index.")
@@ -48,18 +58,22 @@ def home(request):
# generate page
def generate(request):
- return render(request, 'musicgenerate.html')
+ message = { # listing all created songs
+ "analytics": os.listdir("./static/audio/convertedFiles")
+ }
+
+ return render(request, 'musicgenerate.html', message)
# generate page
def about(request):
return render(request, 'about.html')
-
+# minimal sign in page (testing webpage)
def signIn(request):
return render(request, "signIn.html")
-
+# login page
def login(request):
return render(request, "login.html")
@@ -78,31 +92,55 @@ def postsign(request):
def generateMusic(request):
- # submitbutton = request.POST.get("submit")
+ # testing variables
instrument = ''
length = ''
- songName = 'not working'
+ songName = ''
tempo=''
-
- # if request.method == 'createMusic':
- # instrument = request.POST.get("intrument")
- # length = request.POST.get("length")
- # tempo = request.POST.get("tempo")
-
-
- form = NameForm(request.GET)
- if form.is_valid():
- # songName = form['songName'].value()
- songName = form.cleaned_data['songName']
- #tempo = form.cleaned_data['tempo']
- #length = form.cleaned_data['length']
- #instrument = form.cleaned_data['intrument']
-
+ scale=''
+
+ # initiating variables ()
+ scalechoice=''
+ lengthchoice=''
+ tempochoice=''
+ instrumentchoice=''
+
+ # create GET request form
+ form2 = scaleForm(request.GET)
+ form3 = lengthForm(request.GET)
+ form4 = tempoForm(request.GET)
+ form5 = instrumentForm(request.GET)
+ form6 = songNameForm(request.GET)
+
+ # GET variable from form -> html
+ if form2.is_valid():
+ scalechoice = form2.cleaned_data['scalechoice']
+ if form3.is_valid():
+ lengthchoice = form3.cleaned_data['lengthchoice']
+ if form4.is_valid():
+ tempochoice = form4.cleaned_data['tempochoice']
+ if form5.is_valid():
+ instrumentchoice = form5.cleaned_data['instrumentchoice']
+ if form6.is_valid():
+ songName = form6.cleaned_data['songName']
+
+ displaySongName = songName # to display without "_"
+
+ songName = songName.replace(' ','_') # Song Names - add underscores to spaces
# runs midiClass.py file and outputs file into django_project folder
# with the manage.py file
- test = midi("mid", "major", "guitar", "mid", songName)
+ test = midi(tempochoice, scalechoice, instrumentchoice, lengthchoice, songName)
test.runProgram()
- message = "program ran! the .midi is in the first django_project folder -----> "+songName
- return render(request, "musicgenerate.html", {"done": message})
+
+ # convert .mid files to .wav
+ os.system('fluidsynth ./fluidsynth/FluidR3_GM.sf2 ./static/audio/' + songName + '.mid -F ./static/audio/convertedFiles/' + songName + '.wav -r 44100')
+
+ message = {
+ "done": displaySongName,
+ "songFile": songName + ".wav",
+ "analytics": os.listdir("./static/audio/convertedFiles") # listing all created songs
+ }
+
+ return render(request, "musicgenerate.html", message)