Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
officejs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
officejs
Commits
dc4e3bc8
Commit
dc4e3bc8
authored
Aug 14, 2014
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add time show in playlist
parent
aa39dcf4
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
255 additions
and
78 deletions
+255
-78
dev/audioplayer/audioplayer.js
dev/audioplayer/audioplayer.js
+4
-0
dev/audioplayer_control/control.js
dev/audioplayer_control/control.js
+55
-18
dev/audioplayer_playlist_offline/index.html
dev/audioplayer_playlist_offline/index.html
+4
-2
dev/audioplayer_video_control/control.js
dev/audioplayer_video_control/control.js
+62
-18
src/audioplayer/audioplayer.js
src/audioplayer/audioplayer.js
+6
-0
src/audioplayer_control/control.js
src/audioplayer_control/control.js
+53
-18
src/audioplayer_playlist_offline/index.html
src/audioplayer_playlist_offline/index.html
+4
-2
src/audioplayer_video_control/control.js
src/audioplayer_video_control/control.js
+67
-20
No files found.
dev/audioplayer/audioplayer.js
View file @
dc4e3bc8
...
...
@@ -118,6 +118,10 @@
return
this
.
getDeclaredGadget
(
storageType
(
this
.
storageType
)).
push
(
function
(
jio_gadget
)
{
return
jio_gadget
.
remove
.
apply
(
jio_gadget
,
param_list
);
});
}).
allowPublicAcquisition
(
"
jio_put
"
,
function
(
param_list
)
{
return
this
.
getDeclaredGadget
(
storageType
(
this
.
storageType
)).
push
(
function
(
jio_gadget
)
{
return
jio_gadget
.
put
.
apply
(
jio_gadget
,
param_list
);
});
}).
allowPublicAcquisition
(
"
jio_removeAttachment
"
,
function
(
param_list
)
{
return
this
.
getDeclaredGadget
(
storageType
(
this
.
storageType
)).
push
(
function
(
jio_gadget
)
{
return
jio_gadget
.
removeAttachment
.
apply
(
jio_gadget
,
param_list
);
...
...
dev/audioplayer_control/control.js
View file @
dc4e3bc8
...
...
@@ -40,14 +40,6 @@
}
return
new
RSVP
.
Promise
(
itsANonResolvableTrap
,
canceller
);
};
function
set
()
{
//configure a song
var
gadget
=
this
;
gadget
.
source
.
connect
(
gadget
.
filter
);
gadget
.
filter
.
connect
(
gadget
.
analyser
);
gadget
.
analyser
.
connect
(
gadget
.
gain
);
gadget
.
gain
.
connect
(
audioCtx
.
destination
);
}
function
timeFormat
(
seconds
)
{
var
result
=
"
00:
"
+
Math
.
round
(
seconds
),
min
,
sec
;
if
(
seconds
>
59
)
{
...
...
@@ -57,6 +49,14 @@
}
return
result
;
}
function
set
()
{
//configure a song
var
gadget
=
this
;
gadget
.
source
.
connect
(
gadget
.
filter
);
gadget
.
filter
.
connect
(
gadget
.
analyser
);
gadget
.
analyser
.
connect
(
gadget
.
gain
);
gadget
.
gain
.
connect
(
audioCtx
.
destination
);
}
function
getTime
(
context
,
x
)
{
var
posX
=
x
,
targetLeft
=
$
(
context
).
offset
().
left
;
posX
=
(
posX
-
targetLeft
)
/
$
(
context
).
width
();
...
...
@@ -102,9 +102,9 @@
canvasCtx
.
clearRect
(
0
,
0
,
cwidth
,
cheight
);
step
=
Math
.
round
(
array
.
length
/
meterNum
);
bar_context
.
value
=
that
.
audio
.
currentTime
;
if
(
isFinite
(
that
.
audio
.
duration
))
{
bar_context
.
max
=
that
.
audio
.
duration
;
}
/*
if (isFinite(that.audio.duration)) {
bar_context.max = that.audio.duration;
}*/
time_context
.
innerHTML
=
timeFormat
(
that
.
audio
.
duration
-
that
.
audio
.
currentTime
);
for
(
i
=
0
;
i
<
meterNum
;
i
+=
1
)
{
value
=
array
[
i
*
step
];
...
...
@@ -114,7 +114,7 @@
};
return
promiseRequestAnimation
(
drawFrame
);
}
gk
.
declareAcquiredMethod
(
"
jio_getAttachment
"
,
"
jio_getAttachment
"
).
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
).
declareAcquiredMethod
(
"
jio_remove
"
,
"
jio_remove
"
).
declareAcquiredMethod
(
"
plSave
"
,
"
plSave
"
).
declareAcquiredMethod
(
"
plGive
"
,
"
plGive
"
).
declareAcquiredMethod
(
"
displayThisPage
"
,
"
displayThisPage
"
).
declareAcquiredMethod
(
"
displayThisTitle
"
,
"
displayThisTitle
"
).
declareAcquiredMethod
(
"
allDocs
"
,
"
allDocs
"
).
declareAcquiredMethod
(
"
plEnablePage
"
,
"
plEnablePage
"
).
declareAcquiredMethod
(
"
pleaseRedirectMyHash
"
,
"
pleaseRedirectMyHash
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
gk
.
declareAcquiredMethod
(
"
jio_getAttachment
"
,
"
jio_getAttachment
"
).
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
).
declareAcquiredMethod
(
"
jio_
put
"
,
"
jio_put
"
).
declareAcquiredMethod
(
"
jio_
remove
"
,
"
jio_remove
"
).
declareAcquiredMethod
(
"
plSave
"
,
"
plSave
"
).
declareAcquiredMethod
(
"
plGive
"
,
"
plGive
"
).
declareAcquiredMethod
(
"
displayThisPage
"
,
"
displayThisPage
"
).
declareAcquiredMethod
(
"
displayThisTitle
"
,
"
displayThisTitle
"
).
declareAcquiredMethod
(
"
allDocs
"
,
"
allDocs
"
).
declareAcquiredMethod
(
"
plEnablePage
"
,
"
plEnablePage
"
).
declareAcquiredMethod
(
"
pleaseRedirectMyHash
"
,
"
pleaseRedirectMyHash
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
g
=
this
;
if
(
options
.
id
)
{
return
new
RSVP
.
Queue
().
push
(
function
()
{
...
...
@@ -150,14 +150,13 @@
});
}).
push
(
function
(
url
)
{
g
.
__element
.
getElementsByClassName
(
"
next
"
)[
0
].
href
=
url
;
g
.
id
=
options
.
id
;
return
g
.
jio_get
({
_id
:
options
.
id
});
}).
push
(
function
(
result
)
{
var
share_context
=
g
.
__element
.
getElementsByClassName
(
"
share
"
)[
0
];
share_context
.
href
=
"
https://twitter.com/intent/tweet?hashtags=MusicPlayer&text=
"
+
encodeURI
(
result
.
data
.
title
);
g
.
size
=
result
.
data
.
size
;
g
.
metadata
=
result
.
data
;
return
g
.
displayThisTitle
(
options
.
action
+
"
:
"
+
result
.
data
.
title
);
}).
push
(
function
()
{
g
.
index
=
2
e6
;
...
...
@@ -204,7 +203,7 @@
time_context
.
innerHTML
=
timeFormat
(
g
.
audio
.
duration
);
if
(
g
.
rebuild
)
{
return
g
.
jio_getAttachment
({
_id
:
g
.
i
d
,
_id
:
g
.
currentI
d
,
_attachment
:
"
enclosure
"
});
}
...
...
@@ -212,25 +211,63 @@
blob
=
result
;
return
g
.
plEnablePage
();
}).
push
(
function
()
{
if
(
blob
)
{
if
(
g
.
rebuild
)
{
g
.
audio
.
src
=
URL
.
createObjectURL
(
blob
);
g
.
audio
.
load
();
g
.
audio
.
play
();
return
promiseEventListener
(
g
.
audio
,
"
loadedmetadata
"
,
false
);
}
}).
push
(
function
()
{
if
(
g
.
rebuild
)
{
bar_context
.
max
=
g
.
audio
.
duration
;
if
(
g
.
metadata
.
time
===
undefined
)
{
return
g
.
jio_put
({
_id
:
g
.
currentId
,
title
:
g
.
metadata
.
title
,
type
:
g
.
metadata
.
type
,
format
:
g
.
metadata
.
type
,
size
:
g
.
metadata
.
size
,
artist
:
g
.
metadata
.
artist
,
album
:
g
.
metadata
.
album
,
year
:
g
.
metadata
.
year
,
picture
:
g
.
metadata
.
picture
,
modified
:
g
.
metadata
.
modified
,
date
:
g
.
metadata
.
date
,
time
:
timeFormat
(
g
.
audio
.
duration
)
});
}
}
else
{
g
.
sourceBuffer
.
appendBuffer
(
new
Uint8Array
(
g
.
buffer
));
}
}).
push
(
function
()
{
return
RSVP
.
any
([
play
.
call
(
g
),
loopEventListener
(
g
.
sourceBuffer
,
"
updateend
"
,
false
,
function
()
{
if
(
!
g
.
fin
)
{
return
;
}
g
.
fin
=
false
;
if
(
g
.
index
>=
g
.
size
)
{
if
(
g
.
index
>=
g
.
metadata
.
size
)
{
g
.
mediaSource
.
endOfStream
();
bar_context
.
max
=
g
.
audio
.
duration
;
if
(
g
.
metadata
.
time
===
undefined
)
{
return
g
.
jio_put
({
_id
:
g
.
currentId
,
title
:
g
.
metadata
.
title
,
type
:
g
.
metadata
.
type
,
format
:
g
.
metadata
.
type
,
size
:
g
.
metadata
.
size
,
artist
:
g
.
metadata
.
artist
,
album
:
g
.
metadata
.
album
,
year
:
g
.
metadata
.
year
,
picture
:
g
.
metadata
.
picture
,
modified
:
g
.
metadata
.
modified
,
date
:
g
.
metadata
.
date
,
time
:
timeFormat
(
g
.
audio
.
duration
)
});
}
return
;
}
return
g
.
jio_getAttachment
({
_id
:
g
.
i
d
,
_id
:
g
.
currentI
d
,
_attachment
:
"
enclosure
"
,
_start
:
g
.
index
,
_end
:
g
.
index
+
1
e6
...
...
dev/audioplayer_playlist_offline/index.html
View file @
dc4e3bc8
...
...
@@ -17,8 +17,9 @@
<
a
href
=
#
page
=
control
&
id
=
{{
this
.
id
}}
&
action
=
offline
>
<
img
src
=
{{
this
.
doc
.
picture
}}
>
<
h3
>
{{
this
.
doc
.
title
}}
<
/h3
>
<
P
>
{{
this
.
doc
.
artist
}}
<
/p
>
<
P
>
{{
this
.
doc
.
album
}}
<
/p
>
<
P
>
{{
this
.
doc
.
artist
}}
<
/p
>
<
P
>
{{
this
.
doc
.
album
}}
<
/p
>
<
p
class
=
"
ui-li-count
"
>
{{
this
.
doc
.
time
}}
<
/p
>
<
/a
>
{{
else
}}
<
a
href
=
#
page
=
video_control
&
id
=
{{
this
.
id
}}
&
action
=
offline
>
...
...
@@ -26,6 +27,7 @@
<
h3
>
{{
this
.
doc
.
title
}}
<
/h3
>
<
P
>
{{
this
.
doc
.
artist
}}
<
/p
>
<
P
>
{{
this
.
doc
.
album
}}
<
/p
>
<
p
class
=
"
ui-li-count
"
>
{{
this
.
doc
.
time
}}
<
/p
>
<
/a
>
{{
/
compare
}}
<
a
href
=
#
page
=
playlist
&
id
=
{{
this
.
id
}}
&
action
=
delete
>
...
...
dev/audioplayer_video_control/control.js
View file @
dc4e3bc8
...
...
@@ -10,7 +10,16 @@
(
function
(
window
,
rJS
,
RSVP
,
loopEventListener
,
$
,
promiseEventListener
)
{
"
use strict
"
;
var
gk
=
rJS
(
window
),
MediaSource
=
window
.
MediaSource
||
window
.
WebKitMediaSource
||
window
.
mozMediaSource
;
gk
.
declareAcquiredMethod
(
"
jio_getAttachment
"
,
"
jio_getAttachment
"
).
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
).
declareAcquiredMethod
(
"
jio_remove
"
,
"
jio_remove
"
).
declareAcquiredMethod
(
"
plSave
"
,
"
plSave
"
).
declareAcquiredMethod
(
"
plGive
"
,
"
plGive
"
).
declareAcquiredMethod
(
"
displayThisPage
"
,
"
displayThisPage
"
).
declareAcquiredMethod
(
"
displayThisTitle
"
,
"
displayThisTitle
"
).
declareAcquiredMethod
(
"
allDocs
"
,
"
allDocs
"
).
declareAcquiredMethod
(
"
plEnablePage
"
,
"
plEnablePage
"
).
declareAcquiredMethod
(
"
pleaseRedirectMyHash
"
,
"
pleaseRedirectMyHash
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
function
timeFormat
(
seconds
)
{
var
result
=
"
00:
"
+
Math
.
round
(
seconds
),
min
,
sec
;
if
(
seconds
>
59
)
{
min
=
Math
.
floor
(
seconds
/
60
);
sec
=
Math
.
floor
(
seconds
%
60
);
result
=
(
min
>
9
?
min
:
"
0
"
+
min
)
+
"
:
"
+
(
sec
>
9
?
sec
:
"
0
"
+
sec
);
}
return
result
;
}
gk
.
declareAcquiredMethod
(
"
jio_getAttachment
"
,
"
jio_getAttachment
"
).
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
).
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
).
declareAcquiredMethod
(
"
jio_remove
"
,
"
jio_remove
"
).
declareAcquiredMethod
(
"
plSave
"
,
"
plSave
"
).
declareAcquiredMethod
(
"
plGive
"
,
"
plGive
"
).
declareAcquiredMethod
(
"
displayThisPage
"
,
"
displayThisPage
"
).
declareAcquiredMethod
(
"
displayThisTitle
"
,
"
displayThisTitle
"
).
declareAcquiredMethod
(
"
allDocs
"
,
"
allDocs
"
).
declareAcquiredMethod
(
"
plEnablePage
"
,
"
plEnablePage
"
).
declareAcquiredMethod
(
"
pleaseRedirectMyHash
"
,
"
pleaseRedirectMyHash
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
g
=
this
;
if
(
options
.
id
)
{
return
new
RSVP
.
Queue
().
push
(
function
()
{
...
...
@@ -21,8 +30,7 @@
}).
push
(
function
(
result
)
{
var
share_context
=
g
.
__element
.
getElementsByClassName
(
"
share
"
)[
0
];
share_context
.
href
=
"
https://twitter.com/intent/tweet?hashtags=MusicPlayer&text=
"
+
encodeURI
(
result
.
data
.
title
);
g
.
size
=
result
.
data
.
size
;
g
.
format
=
result
.
data
.
format
;
g
.
metadata
=
result
.
data
;
return
g
.
displayThisTitle
(
options
.
action
+
"
:
"
+
result
.
data
.
title
);
}).
push
(
function
()
{
return
g
.
allDocs
({
...
...
@@ -48,7 +56,6 @@
});
}).
push
(
function
(
url
)
{
g
.
__element
.
getElementsByClassName
(
"
next
"
)[
0
].
href
=
url
;
g
.
id
=
options
.
id
;
g
.
index
=
35
e5
;
return
g
.
jio_getAttachment
({
_id
:
g
.
id
,
...
...
@@ -76,7 +83,7 @@
return
new
RSVP
.
Queue
().
push
(
function
()
{
if
(
g
.
rebuild
)
{
return
g
.
jio_getAttachment
({
_id
:
g
.
i
d
,
_id
:
g
.
currentI
d
,
_attachment
:
"
enclosure
"
});
}
...
...
@@ -84,32 +91,59 @@
blob
=
result
;
return
g
.
plEnablePage
();
}).
push
(
function
()
{
if
(
blob
)
{
if
(
g
.
rebuild
)
{
g
.
video
.
src
=
URL
.
createObjectURL
(
blob
);
g
.
video
.
load
();
g
.
video
.
play
();
return
promiseEventListener
(
g
.
video
,
"
loadedmetadata
"
,
false
);
}
}).
push
(
function
()
{
if
(
g
.
rebuild
)
{
if
(
g
.
metadata
.
time
===
undefined
)
{
return
g
.
jio_put
({
_id
:
g
.
currentId
,
title
:
g
.
metadata
.
title
,
type
:
g
.
metadata
.
type
,
format
:
g
.
metadata
.
type
,
size
:
g
.
metadata
.
size
,
artist
:
g
.
metadata
.
artist
,
album
:
g
.
metadata
.
album
,
year
:
g
.
metadata
.
year
,
picture
:
g
.
metadata
.
picture
,
modified
:
g
.
metadata
.
modified
,
date
:
g
.
metadata
.
date
,
time
:
timeFormat
(
g
.
video
.
duration
)
});
}
}
else
{
g
.
sourceBuffer
.
appendBuffer
(
new
Uint8Array
(
g
.
buffer
));
g
.
video
.
play
();
}
return
RSVP
.
any
([
loopEventListener
(
g
.
video
,
"
ended
"
,
false
,
function
()
{
window
.
location
=
g
.
__element
.
getElementsByClassName
(
"
next
"
)[
0
].
href
;
}),
loopEventListener
(
g
.
video
,
"
seeking
"
,
false
,
function
(
e
)
{
if
(
g
.
buffedTime
===
undefined
)
{
g
.
video
.
currentTime
=
0
;
}
else
{
if
(
g
.
video
.
currentTime
>
g
.
buffedTime
)
{
g
.
video
.
currentTime
=
g
.
buffedTime
;
}
}
}),
loopEventListener
(
g
.
sourceBuffer
,
"
updateend
"
,
false
,
function
()
{
}).
push
(
function
()
{
return
RSVP
.
any
([
loopEventListener
(
g
.
sourceBuffer
,
"
updateend
"
,
false
,
function
()
{
g
.
buffedTime
=
g
.
sourceBuffer
.
buffered
.
end
(
0
);
if
(
!
g
.
fin
)
{
return
;
}
g
.
fin
=
false
;
if
(
g
.
index
>=
g
.
size
)
{
if
(
g
.
index
>=
g
.
metadata
.
size
)
{
g
.
mediaSource
.
endOfStream
();
if
(
g
.
metadata
.
time
===
undefined
)
{
return
g
.
jio_put
({
_id
:
g
.
currentId
,
title
:
g
.
metadata
.
title
,
type
:
g
.
metadata
.
type
,
format
:
g
.
metadata
.
type
,
size
:
g
.
metadata
.
size
,
artist
:
g
.
metadata
.
artist
,
album
:
g
.
metadata
.
album
,
year
:
g
.
metadata
.
year
,
picture
:
g
.
metadata
.
picture
,
modified
:
g
.
metadata
.
modified
,
date
:
g
.
metadata
.
date
,
time
:
timeFormat
(
g
.
video
.
duration
)
});
}
return
;
}
return
g
.
jio_getAttachment
({
...
...
@@ -124,6 +158,16 @@
g
.
fin
=
true
;
g
.
sourceBuffer
.
appendBuffer
(
new
Uint8Array
(
e
.
target
.
result
));
});
}),
loopEventListener
(
g
.
video
,
"
ended
"
,
false
,
function
()
{
window
.
location
=
g
.
__element
.
getElementsByClassName
(
"
next
"
)[
0
].
href
;
}),
loopEventListener
(
g
.
video
,
"
seeking
"
,
false
,
function
(
e
)
{
if
(
g
.
buffedTime
===
undefined
)
{
g
.
video
.
currentTime
=
0
;
}
else
{
if
(
g
.
video
.
currentTime
>
g
.
buffedTime
)
{
g
.
video
.
currentTime
=
g
.
buffedTime
;
}
}
})
]);
});
});
...
...
src/audioplayer/audioplayer.js
View file @
dc4e3bc8
...
...
@@ -138,6 +138,12 @@
return
jio_gadget
.
remove
.
apply
(
jio_gadget
,
param_list
);
});
})
.
allowPublicAcquisition
(
"
jio_put
"
,
function
(
param_list
)
{
return
this
.
getDeclaredGadget
(
storageType
(
this
.
storageType
))
.
push
(
function
(
jio_gadget
)
{
return
jio_gadget
.
put
.
apply
(
jio_gadget
,
param_list
);
});
})
.
allowPublicAcquisition
(
"
jio_removeAttachment
"
,
function
(
param_list
)
{
return
this
.
getDeclaredGadget
(
storageType
(
this
.
storageType
))
.
push
(
function
(
jio_gadget
)
{
...
...
src/audioplayer_control/control.js
View file @
dc4e3bc8
...
...
@@ -53,16 +53,6 @@
return
new
RSVP
.
Promise
(
itsANonResolvableTrap
,
canceller
);
};
function
set
()
{
//configure a song
var
gadget
=
this
;
gadget
.
source
.
connect
(
gadget
.
filter
);
gadget
.
filter
.
connect
(
gadget
.
analyser
);
gadget
.
analyser
.
connect
(
gadget
.
gain
);
gadget
.
gain
.
connect
(
audioCtx
.
destination
);
}
function
timeFormat
(
seconds
)
{
var
result
=
'
00:
'
+
Math
.
round
(
seconds
),
min
,
...
...
@@ -76,6 +66,15 @@
return
result
;
}
function
set
()
{
//configure a song
var
gadget
=
this
;
gadget
.
source
.
connect
(
gadget
.
filter
);
gadget
.
filter
.
connect
(
gadget
.
analyser
);
gadget
.
analyser
.
connect
(
gadget
.
gain
);
gadget
.
gain
.
connect
(
audioCtx
.
destination
);
}
function
getTime
(
context
,
x
)
{
var
posX
=
x
,
targetLeft
=
$
(
context
).
offset
().
left
;
...
...
@@ -141,9 +140,9 @@
canvasCtx
.
clearRect
(
0
,
0
,
cwidth
,
cheight
);
step
=
Math
.
round
(
array
.
length
/
meterNum
);
bar_context
.
value
=
that
.
audio
.
currentTime
;
if
(
isFinite
(
that
.
audio
.
duration
))
{
/*
if (isFinite(that.audio.duration)) {
bar_context.max = that.audio.duration;
}
}
*/
time_context
.
innerHTML
=
timeFormat
(
that
.
audio
.
duration
-
that
.
audio
.
currentTime
);
for
(
i
=
0
;
i
<
meterNum
;
i
+=
1
)
{
...
...
@@ -160,6 +159,7 @@
gk
.
declareAcquiredMethod
(
"
jio_getAttachment
"
,
"
jio_getAttachment
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
"
jio_remove
"
,
"
jio_remove
"
)
.
declareAcquiredMethod
(
"
plSave
"
,
"
plSave
"
)
.
declareAcquiredMethod
(
"
plGive
"
,
"
plGive
"
)
...
...
@@ -210,7 +210,6 @@
})
.
push
(
function
(
url
)
{
g
.
__element
.
getElementsByClassName
(
"
next
"
)[
0
].
href
=
url
;
g
.
id
=
options
.
id
;
return
g
.
jio_get
({
"
_id
"
:
options
.
id
});
})
.
push
(
function
(
result
)
{
...
...
@@ -218,7 +217,7 @@
share_context
.
href
=
"
https://twitter.com/intent/tweet?hashtags=MusicPlayer&text=
"
+
encodeURI
(
result
.
data
.
title
);
g
.
size
=
result
.
data
.
size
;
g
.
metadata
=
result
.
data
;
return
g
.
displayThisTitle
(
options
.
action
+
"
:
"
+
result
.
data
.
title
);
})
...
...
@@ -285,7 +284,7 @@
$
(
time_context
).
offset
().
top
=
$
(
bar_context
).
offset
().
top
+
3
;
time_context
.
innerHTML
=
timeFormat
(
g
.
audio
.
duration
);
if
(
g
.
rebuild
)
{
return
g
.
jio_getAttachment
({
"
_id
"
:
g
.
i
d
,
return
g
.
jio_getAttachment
({
"
_id
"
:
g
.
currentI
d
,
"
_attachment
"
:
"
enclosure
"
});
}
})
...
...
@@ -294,13 +293,35 @@
return
g
.
plEnablePage
();
})
.
push
(
function
()
{
if
(
blob
)
{
if
(
g
.
rebuild
)
{
g
.
audio
.
src
=
URL
.
createObjectURL
(
blob
);
g
.
audio
.
load
();
g
.
audio
.
play
();
return
promiseEventListener
(
g
.
audio
,
"
loadedmetadata
"
,
false
);
}
})
.
push
(
function
()
{
if
(
g
.
rebuild
)
{
bar_context
.
max
=
g
.
audio
.
duration
;
if
(
g
.
metadata
.
time
===
undefined
)
{
return
g
.
jio_put
({
"
_id
"
:
g
.
currentId
,
"
title
"
:
g
.
metadata
.
title
,
"
type
"
:
g
.
metadata
.
type
,
"
format
"
:
g
.
metadata
.
type
,
"
size
"
:
g
.
metadata
.
size
,
"
artist
"
:
g
.
metadata
.
artist
,
"
album
"
:
g
.
metadata
.
album
,
"
year
"
:
g
.
metadata
.
year
,
"
picture
"
:
g
.
metadata
.
picture
,
"
modified
"
:
g
.
metadata
.
modified
,
"
date
"
:
g
.
metadata
.
date
,
"
time
"
:
timeFormat
(
g
.
audio
.
duration
)});
}
}
else
{
g
.
sourceBuffer
.
appendBuffer
(
new
Uint8Array
(
g
.
buffer
));
}
})
.
push
(
function
()
{
return
RSVP
.
any
([
play
.
call
(
g
),
loopEventListener
(
g
.
sourceBuffer
,
"
updateend
"
,
false
,
function
()
{
...
...
@@ -308,12 +329,26 @@
return
;
}
g
.
fin
=
false
;
if
(
g
.
index
>=
g
.
size
)
{
if
(
g
.
index
>=
g
.
metadata
.
size
)
{
g
.
mediaSource
.
endOfStream
();
bar_context
.
max
=
g
.
audio
.
duration
;
if
(
g
.
metadata
.
time
===
undefined
)
{
return
g
.
jio_put
({
"
_id
"
:
g
.
currentId
,
"
title
"
:
g
.
metadata
.
title
,
"
type
"
:
g
.
metadata
.
type
,
"
format
"
:
g
.
metadata
.
type
,
"
size
"
:
g
.
metadata
.
size
,
"
artist
"
:
g
.
metadata
.
artist
,
"
album
"
:
g
.
metadata
.
album
,
"
year
"
:
g
.
metadata
.
year
,
"
picture
"
:
g
.
metadata
.
picture
,
"
modified
"
:
g
.
metadata
.
modified
,
"
date
"
:
g
.
metadata
.
date
,
"
time
"
:
timeFormat
(
g
.
audio
.
duration
)});
}
return
;
}
return
g
.
jio_getAttachment
({
"
_id
"
:
g
.
i
d
,
return
g
.
jio_getAttachment
({
"
_id
"
:
g
.
currentI
d
,
"
_attachment
"
:
"
enclosure
"
,
"
_start
"
:
g
.
index
,
"
_end
"
:
g
.
index
+
1000000
})
...
...
src/audioplayer_playlist_offline/index.html
View file @
dc4e3bc8
...
...
@@ -17,8 +17,9 @@
<
a
href
=
#
page
=
control
&
id
=
{{
this
.
id
}}
&
action
=
offline
>
<
img
src
=
{{
this
.
doc
.
picture
}}
>
<
h3
>
{{
this
.
doc
.
title
}}
<
/h3
>
<
P
>
{{
this
.
doc
.
artist
}}
<
/p
>
<
P
>
{{
this
.
doc
.
album
}}
<
/p
>
<
P
>
{{
this
.
doc
.
artist
}}
<
/p
>
<
P
>
{{
this
.
doc
.
album
}}
<
/p
>
<
p
class
=
"
ui-li-count
"
>
{{
this
.
doc
.
time
}}
<
/p
>
<
/a
>
{{
else
}}
<
a
href
=
#
page
=
video_control
&
id
=
{{
this
.
id
}}
&
action
=
offline
>
...
...
@@ -26,6 +27,7 @@
<
h3
>
{{
this
.
doc
.
title
}}
<
/h3
>
<
P
>
{{
this
.
doc
.
artist
}}
<
/p
>
<
P
>
{{
this
.
doc
.
album
}}
<
/p
>
<
p
class
=
"
ui-li-count
"
>
{{
this
.
doc
.
time
}}
<
/p
>
<
/a
>
{{
/
compare
}}
<
a
href
=
#
page
=
playlist
&
id
=
{{
this
.
id
}}
&
action
=
delete
>
...
...
src/audioplayer_video_control/control.js
View file @
dc4e3bc8
...
...
@@ -17,8 +17,23 @@
var
gk
=
rJS
(
window
),
MediaSource
=
window
.
MediaSource
||
window
.
WebKitMediaSource
||
window
.
mozMediaSource
;
function
timeFormat
(
seconds
)
{
var
result
=
'
00:
'
+
Math
.
round
(
seconds
),
min
,
sec
;
if
(
seconds
>
59
)
{
min
=
Math
.
floor
(
seconds
/
60
);
sec
=
Math
.
floor
(
seconds
%
60
);
result
=
(
min
>
9
?
min
:
(
'
0
'
+
min
))
+
'
:
'
+
(
sec
>
9
?
sec
:
(
'
0
'
+
sec
));
}
return
result
;
}
gk
.
declareAcquiredMethod
(
"
jio_getAttachment
"
,
"
jio_getAttachment
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
"
jio_remove
"
,
"
jio_remove
"
)
.
declareAcquiredMethod
(
"
plSave
"
,
"
plSave
"
)
.
declareAcquiredMethod
(
"
plGive
"
,
"
plGive
"
)
...
...
@@ -40,8 +55,7 @@
share_context
.
href
=
"
https://twitter.com/intent/tweet?hashtags=MusicPlayer&text=
"
+
encodeURI
(
result
.
data
.
title
);
g
.
size
=
result
.
data
.
size
;
g
.
format
=
result
.
data
.
format
;
g
.
metadata
=
result
.
data
;
return
g
.
displayThisTitle
(
options
.
action
+
"
:
"
+
result
.
data
.
title
);
})
...
...
@@ -71,7 +85,6 @@
})
.
push
(
function
(
url
)
{
g
.
__element
.
getElementsByClassName
(
"
next
"
)[
0
].
href
=
url
;
g
.
id
=
options
.
id
;
g
.
index
=
3500000
;
return
g
.
jio_getAttachment
({
"
_id
"
:
g
.
id
,
"
_attachment
"
:
"
enclosure
"
,
...
...
@@ -109,7 +122,7 @@
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
if
(
g
.
rebuild
)
{
return
g
.
jio_getAttachment
({
"
_id
"
:
g
.
i
d
,
return
g
.
jio_getAttachment
({
"
_id
"
:
g
.
currentI
d
,
"
_attachment
"
:
"
enclosure
"
});
}
})
...
...
@@ -118,37 +131,58 @@
return
g
.
plEnablePage
();
})
.
push
(
function
()
{
if
(
blob
)
{
if
(
g
.
rebuild
)
{
g
.
video
.
src
=
URL
.
createObjectURL
(
blob
);
g
.
video
.
load
();
g
.
video
.
play
();
return
promiseEventListener
(
g
.
video
,
"
loadedmetadata
"
,
false
);
}
})
.
push
(
function
()
{
if
(
g
.
rebuild
)
{
if
(
g
.
metadata
.
time
===
undefined
)
{
return
g
.
jio_put
({
"
_id
"
:
g
.
currentId
,
"
title
"
:
g
.
metadata
.
title
,
"
type
"
:
g
.
metadata
.
type
,
"
format
"
:
g
.
metadata
.
type
,
"
size
"
:
g
.
metadata
.
size
,
"
artist
"
:
g
.
metadata
.
artist
,
"
album
"
:
g
.
metadata
.
album
,
"
year
"
:
g
.
metadata
.
year
,
"
picture
"
:
g
.
metadata
.
picture
,
"
modified
"
:
g
.
metadata
.
modified
,
"
date
"
:
g
.
metadata
.
date
,
"
time
"
:
timeFormat
(
g
.
video
.
duration
)});
}
}
else
{
g
.
sourceBuffer
.
appendBuffer
(
new
Uint8Array
(
g
.
buffer
));
g
.
video
.
play
();
}
})
.
push
(
function
()
{
return
RSVP
.
any
([
loopEventListener
(
g
.
video
,
"
ended
"
,
false
,
function
()
{
window
.
location
=
g
.
__element
.
getElementsByClassName
(
"
next
"
)[
0
].
href
;
}),
loopEventListener
(
g
.
video
,
"
seeking
"
,
false
,
function
(
e
)
{
if
(
g
.
buffedTime
===
undefined
)
{
g
.
video
.
currentTime
=
0
;
}
else
{
if
(
g
.
video
.
currentTime
>
g
.
buffedTime
)
{
g
.
video
.
currentTime
=
g
.
buffedTime
;
}
}
}),
loopEventListener
(
g
.
sourceBuffer
,
"
updateend
"
,
false
,
function
()
{
g
.
buffedTime
=
g
.
sourceBuffer
.
buffered
.
end
(
0
);
if
(
!
g
.
fin
)
{
return
;
}
g
.
fin
=
false
;
if
(
g
.
index
>=
g
.
size
)
{
if
(
g
.
index
>=
g
.
metadata
.
size
)
{
g
.
mediaSource
.
endOfStream
();
if
(
g
.
metadata
.
time
===
undefined
)
{
return
g
.
jio_put
({
"
_id
"
:
g
.
currentId
,
"
title
"
:
g
.
metadata
.
title
,
"
type
"
:
g
.
metadata
.
type
,
"
format
"
:
g
.
metadata
.
type
,
"
size
"
:
g
.
metadata
.
size
,
"
artist
"
:
g
.
metadata
.
artist
,
"
album
"
:
g
.
metadata
.
album
,
"
year
"
:
g
.
metadata
.
year
,
"
picture
"
:
g
.
metadata
.
picture
,
"
modified
"
:
g
.
metadata
.
modified
,
"
date
"
:
g
.
metadata
.
date
,
"
time
"
:
timeFormat
(
g
.
video
.
duration
)});
}
return
;
}
return
g
.
jio_getAttachment
({
"
_id
"
:
g
.
id
,
...
...
@@ -163,6 +197,19 @@
g
.
fin
=
true
;
g
.
sourceBuffer
.
appendBuffer
(
new
Uint8Array
(
e
.
target
.
result
));
});
}),
loopEventListener
(
g
.
video
,
"
ended
"
,
false
,
function
()
{
window
.
location
=
g
.
__element
.
getElementsByClassName
(
"
next
"
)[
0
].
href
;
}),
loopEventListener
(
g
.
video
,
"
seeking
"
,
false
,
function
(
e
)
{
if
(
g
.
buffedTime
===
undefined
)
{
g
.
video
.
currentTime
=
0
;
}
else
{
if
(
g
.
video
.
currentTime
>
g
.
buffedTime
)
{
g
.
video
.
currentTime
=
g
.
buffedTime
;
}
}
})
]);
});
...
...
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