Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
29239d66
Commit
29239d66
authored
13 years ago
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
remember volume and playback time in the media player
parent
30ce4e5b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/media/ajax/api.php
+1
-0
1 addition, 0 deletions
apps/media/ajax/api.php
apps/media/js/player.js
+25
-6
25 additions, 6 deletions
apps/media/js/player.js
with
26 additions
and
6 deletions
apps/media/ajax/api.php
+
1
−
0
View file @
29239d66
...
...
@@ -132,6 +132,7 @@ if($arguments['action']){
header
(
'Expires: 0'
);
header
(
'Cache-Control: must-revalidate, post-check=0, pre-check=0'
);
header
(
'Pragma: public'
);
header
(
'Accept-Ranges: bytes'
);
header
(
'Content-Length: '
.
OC_Filesystem
::
filesize
(
$arguments
[
'path'
]));
OC_Filesystem
::
readfile
(
$arguments
[
'path'
]);
...
...
This diff is collapsed.
Click to expand it.
apps/media/js/player.js
+
25
−
6
View file @
29239d66
...
...
@@ -3,6 +3,7 @@ var PlayList={
current
:
-
1
,
items
:[],
player
:
null
,
volume
:
0.8
,
next
:
function
(){
var
next
=
PlayList
.
current
+
1
;
if
(
next
>=
PlayList
.
items
.
length
){
...
...
@@ -19,7 +20,7 @@ var PlayList={
PlayList
.
play
(
next
);
PlayList
.
render
();
},
play
:
function
(
index
,
ready
){
play
:
function
(
index
,
time
,
ready
){
if
(
index
==
null
){
index
=
PlayList
.
current
;
}
...
...
@@ -28,11 +29,11 @@ var PlayList={
if
(
PlayList
.
player
){
if
(
PlayList
.
player
.
data
(
'
jPlayer
'
).
options
.
supplied
!=
PlayList
.
items
[
index
].
type
){
//the the audio type changes we need to reinitialize jplayer
PlayList
.
player
.
jPlayer
(
"
destroy
"
);
PlayList
.
init
(
PlayList
.
items
[
index
].
type
,
function
(){
PlayList
.
play
(
null
,
r
eady
)});
PlayList
.
init
(
PlayList
.
items
[
index
].
type
,
function
(){
PlayList
.
play
(
null
,
time
,
eady
)});
}
else
{
PlayList
.
player
.
jPlayer
(
"
setMedia
"
,
PlayList
.
items
[
PlayList
.
current
]);
PlayList
.
items
[
index
].
playcount
++
;
PlayList
.
player
.
jPlayer
(
"
play
"
);
PlayList
.
player
.
jPlayer
(
"
play
"
,
time
);
localStorage
.
setItem
(
oc_current_user
+
'
oc_playlist_current
'
,
index
);
if
(
index
>
0
){
var
previous
=
index
-
1
;
...
...
@@ -82,6 +83,14 @@ var PlayList={
play
:
function
(){
localStorage
.
setItem
(
oc_current_user
+
'
oc_playlist_playing
'
,
'
true
'
);
},
timeupdate
:
function
(){
var
time
=
Math
.
round
(
PlayList
.
player
.
data
(
'
jPlayer
'
).
status
.
currentTime
);
localStorage
.
setItem
(
oc_current_user
+
'
oc_playlist_time
'
,
time
);
},
volumechange
:
function
(){
var
volume
=
PlayList
.
player
.
data
(
'
jPlayer
'
).
options
.
volume
*
100
;
localStorage
.
setItem
(
oc_current_user
+
'
oc_playlist_volume
'
,
volume
);
},
supplied
:
type
,
ready
:
function
(){
PlayList
.
load
();
...
...
@@ -89,6 +98,7 @@ var PlayList={
ready
();
}
},
volume
:
PlayList
.
volume
,
cssSelectorAncestor
:
'
#jp-interface
'
,
swfPath
:
OC
.
linkTo
(
'
media
'
,
'
js
'
),
});
...
...
@@ -150,11 +160,20 @@ var PlayList={
if
(
typeof
localStorage
!==
'
undefined
'
){
if
(
localStorage
.
hasOwnProperty
(
oc_current_user
+
'
oc_playlist_items
'
)){
PlayList
.
items
=
JSON
.
parse
(
localStorage
.
getItem
(
oc_current_user
+
'
oc_playlist_items
'
));
PlayList
.
current
=
parseInt
((
localStorage
.
getItem
(
oc_current_user
+
'
oc_playlist_current
'
)));
PlayList
.
current
=
parseInt
(
localStorage
.
getItem
(
oc_current_user
+
'
oc_playlist_current
'
));
var
time
=
parseInt
(
localStorage
.
getItem
(
oc_current_user
+
'
oc_playlist_time
'
));
if
(
localStorage
.
hasOwnProperty
(
oc_current_user
+
'
oc_playlist_volume
'
)){
var
volume
=
localStorage
.
getItem
(
oc_current_user
+
'
oc_playlist_volume
'
);
PlayList
.
volume
=
volume
/
100
;
$
(
'
.jp-volume-bar-value
'
).
css
(
'
width
'
,
volume
+
'
%
'
);
if
(
PlayList
.
player
.
data
(
'
jPlayer
'
)){
PlayList
.
player
.
jPlayer
(
"
option
"
,
'
volume
'
,
volume
/
100
);
}
}
if
(
JSON
.
parse
(
localStorage
.
getItem
(
oc_current_user
+
'
oc_playlist_playing
'
))){
PlayList
.
play
();
PlayList
.
play
(
null
,
time
);
}
else
{
PlayList
.
play
(
null
,
function
(){
PlayList
.
play
(
null
,
time
,
function
(){
PlayList
.
player
.
jPlayer
(
"
pause
"
);
});
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment