Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
radiopanik
panikweb
Commits
d0b0c60a
Commit
d0b0c60a
authored
Aug 21, 2013
by
Simon Daron
Browse files
Adding unique ID for audio layer
parent
c80530c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
panikweb/views.py
View file @
d0b0c60a
from
datetime
import
datetime
,
timedelta
import
math
import
math
,
uuid
from
django.views.generic.base
import
TemplateView
from
django.views.decorators.csrf
import
csrf_exempt
...
...
@@ -161,6 +161,7 @@ class Home(TemplateView):
context
=
super
(
Home
,
self
).
get_context_data
(
**
kwargs
)
context
[
'news'
]
=
NewsItem
.
objects
.
all
().
exclude
(
image__isnull
=
True
).
exclude
(
image__exact
=
''
).
order_by
(
'-datetime'
)[:
5
]
context
[
'emissions'
]
=
Emission
.
objects
.
filter
(
archived
=
False
).
order_by
(
'?'
)
context
[
'player'
]
=
audioPlayer
()
return
context
home
=
Home
.
as_view
()
...
...
@@ -180,10 +181,25 @@ class Player(TemplateView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
Player
,
self
).
get_context_data
(
**
kwargs
)
context
[
'player'
]
=
audioPlayer
()
return
context
player
=
Player
.
as_view
()
class
loadPlayer
(
TemplateView
):
template_name
=
'player.html'
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
Player
,
self
).
get_context_data
(
**
kwargs
)
context
[
'player'
]
=
audioPlayer
()
return
context
player
=
Player
.
as_view
()
class
audioPlayer
:
def
__init__
(
self
):
self
.
unique
=
uuid
.
uuid4
()
@
csrf_exempt
@
to_json
(
'api'
)
...
...
panikweb_templates/templates/player/detail.html
View file @
d0b0c60a
...
...
@@ -6,8 +6,14 @@
<span
class=
"label"
>
en direct
</span>
</button>
<div
id=
"WhatsOnAir"
></div>
<audio
id=
"DirectStreamPanik"
class=
"hidden"
tabindex=
"0"
src=
"http://streaming.domainepublic.net:8000/radiopanik.ogg"
controls=
"controls"
>
</audio>
<audio
id=
"DirectStreamPanik"
preload=
"none"
class=
"hidden"
tabindex=
"0"
src=
"http://streaming.domainepublic.net:8000/radiopanik.ogg?&unique={{ player.unique }}"
controls=
"controls"
></audio>
<ul
class=
"inline metas small"
>
<li
class=
"right"
>
<button
id=
"BufferStateTODO"
></button>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment