Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
apk
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
apk
Commits
7e327c1e
Commit
7e327c1e
authored
Aug 27, 2018
by
DrKLO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fixes
parent
fe599cd5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
32 deletions
+33
-32
libtgvoip
TMessagesProj/jni/libtgvoip
+1
-1
MusicPlayerService.java
.../main/java/org/telegram/messenger/MusicPlayerService.java
+32
-31
No files found.
libtgvoip
@
bfa1e6ab
Subproject commit
23ae67306d7fa1c4d5a8a9c8653f63ab93100f88
Subproject commit
bfa1e6ab76a467c6c6bff7eabb7c213acc7a1b34
TMessagesProj/src/main/java/org/telegram/messenger/MusicPlayerService.java
View file @
7e327c1e
...
...
@@ -323,56 +323,57 @@ public class MusicPlayerService extends Service implements NotificationCenter.No
}
if
(
remoteControlClient
!=
null
)
{
int
currentID
=
MediaController
.
getInstance
().
getPlayingMessageObject
().
getId
();
if
(
notificationMessageID
!=
currentID
)
{
notificationMessageID
=
currentID
;
RemoteControlClient
.
MetadataEditor
metadataEditor
=
remoteControlClient
.
editMetadata
(
true
);
int
currentID
=
MediaController
.
getInstance
().
getPlayingMessageObject
().
getId
();
if
(
notificationMessageID
!=
currentID
)
{
notificationMessageID
=
currentID
;
RemoteControlClient
.
MetadataEditor
metadataEditor
=
remoteControlClient
.
editMetadata
(
true
);
metadataEditor
.
putString
(
MediaMetadataRetriever
.
METADATA_KEY_ARTIST
,
authorName
);
metadataEditor
.
putString
(
MediaMetadataRetriever
.
METADATA_KEY_TITLE
,
songName
);
if
(
audioInfo
!=
null
&&
!
TextUtils
.
isEmpty
(
audioInfo
.
getAlbum
()))
if
(
audioInfo
!=
null
&&
!
TextUtils
.
isEmpty
(
audioInfo
.
getAlbum
()))
metadataEditor
.
putString
(
MediaMetadataRetriever
.
METADATA_KEY_ALBUM
,
audioInfo
.
getAlbum
());
metadataEditor
.
putLong
(
MediaMetadataRetriever
.
METADATA_KEY_DURATION
,
MediaController
.
getInstance
().
getPlayingMessageObject
().
audioPlayerDuration
*
1000L
);
if
(
audioInfo
!=
null
&&
audioInfo
.
getCover
()!=
null
)
{
try
{
metadataEditor
.
putLong
(
MediaMetadataRetriever
.
METADATA_KEY_DURATION
,
MediaController
.
getInstance
().
getPlayingMessageObject
().
audioPlayerDuration
*
1000L
);
if
(
audioInfo
!=
null
&&
audioInfo
.
getCover
()
!=
null
)
{
try
{
metadataEditor
.
putBitmap
(
RemoteControlClient
.
MetadataEditor
.
BITMAP_KEY_ARTWORK
,
audioInfo
.
getCover
());
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
FileLog
.
e
(
e
);
}
}
metadataEditor
.
apply
();
AndroidUtilities
.
runOnUIThread
(
new
Runnable
(){
AndroidUtilities
.
runOnUIThread
(
new
Runnable
()
{
@Override
public
void
run
(){
if
(
remoteControlClient
==
null
)
return
;
if
(
MediaController
.
getInstance
().
getPlayingMessageObject
().
audioPlayerDuration
==
C
.
TIME_UNSET
){
AndroidUtilities
.
runOnUIThread
(
this
,
500
);
return
;
public
void
run
()
{
if
(
remoteControlClient
==
null
||
MediaController
.
getInstance
().
getPlayingMessageObject
()
==
null
)
{
return
;
}
if
(
MediaController
.
getInstance
().
getPlayingMessageObject
().
audioPlayerDuration
==
C
.
TIME_UNSET
)
{
AndroidUtilities
.
runOnUIThread
(
this
,
500
);
return
;
}
RemoteControlClient
.
MetadataEditor
metadataEditor
=
remoteControlClient
.
editMetadata
(
false
);
metadataEditor
.
putLong
(
MediaMetadataRetriever
.
METADATA_KEY_DURATION
,
MediaController
.
getInstance
().
getPlayingMessageObject
().
audioPlayerDuration
*
1000L
);
RemoteControlClient
.
MetadataEditor
metadataEditor
=
remoteControlClient
.
editMetadata
(
false
);
metadataEditor
.
putLong
(
MediaMetadataRetriever
.
METADATA_KEY_DURATION
,
MediaController
.
getInstance
().
getPlayingMessageObject
().
audioPlayerDuration
*
1000L
);
metadataEditor
.
apply
();
if
(
Build
.
VERSION
.
SDK_INT
>=
18
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
18
)
{
remoteControlClient
.
setPlaybackState
(
MediaController
.
getInstance
().
isMessagePaused
()
?
RemoteControlClient
.
PLAYSTATE_PAUSED
:
RemoteControlClient
.
PLAYSTATE_PLAYING
,
Math
.
max
(
MediaController
.
getInstance
().
getPlayingMessageObject
().
audioProgressSec
*
1000L
,
100
),
Math
.
max
(
MediaController
.
getInstance
().
getPlayingMessageObject
().
audioProgressSec
*
1000L
,
100
),
MediaController
.
getInstance
().
isMessagePaused
()
?
0
f
:
1
f
);
}
else
{
}
else
{
remoteControlClient
.
setPlaybackState
(
MediaController
.
getInstance
().
isMessagePaused
()
?
RemoteControlClient
.
PLAYSTATE_PAUSED
:
RemoteControlClient
.
PLAYSTATE_PLAYING
);
}
}
},
1000
);
}
if
(
MediaController
.
getInstance
().
isDownloadingCurrentMessage
())
{
if
(
MediaController
.
getInstance
().
isDownloadingCurrentMessage
())
{
remoteControlClient
.
setPlaybackState
(
RemoteControlClient
.
PLAYSTATE_BUFFERING
);
}
else
{
RemoteControlClient
.
MetadataEditor
metadataEditor
=
remoteControlClient
.
editMetadata
(
false
);
metadataEditor
.
putLong
(
MediaMetadataRetriever
.
METADATA_KEY_DURATION
,
MediaController
.
getInstance
().
getPlayingMessageObject
().
audioPlayerDuration
*
1000L
);
}
else
{
RemoteControlClient
.
MetadataEditor
metadataEditor
=
remoteControlClient
.
editMetadata
(
false
);
metadataEditor
.
putLong
(
MediaMetadataRetriever
.
METADATA_KEY_DURATION
,
MediaController
.
getInstance
().
getPlayingMessageObject
().
audioPlayerDuration
*
1000L
);
metadataEditor
.
apply
();
if
(
Build
.
VERSION
.
SDK_INT
>=
18
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
18
)
{
remoteControlClient
.
setPlaybackState
(
MediaController
.
getInstance
().
isMessagePaused
()
?
RemoteControlClient
.
PLAYSTATE_PAUSED
:
RemoteControlClient
.
PLAYSTATE_PLAYING
,
Math
.
max
(
MediaController
.
getInstance
().
getPlayingMessageObject
().
audioProgressSec
*
1000L
,
100
),
Math
.
max
(
MediaController
.
getInstance
().
getPlayingMessageObject
().
audioProgressSec
*
1000L
,
100
),
MediaController
.
getInstance
().
isMessagePaused
()
?
0
f
:
1
f
);
}
else
{
}
else
{
remoteControlClient
.
setPlaybackState
(
MediaController
.
getInstance
().
isMessagePaused
()
?
RemoteControlClient
.
PLAYSTATE_PAUSED
:
RemoteControlClient
.
PLAYSTATE_PLAYING
);
}
}
...
...
@@ -420,10 +421,10 @@ public class MusicPlayerService extends Service implements NotificationCenter.No
}
else
{
stopSelf
();
}
}
else
if
(
id
==
NotificationCenter
.
messagePlayingDidSeek
)
{
}
else
if
(
id
==
NotificationCenter
.
messagePlayingDidSeek
)
{
MessageObject
messageObject
=
MediaController
.
getInstance
().
getPlayingMessageObject
();
if
(
remoteControlClient
!=
null
&&
Build
.
VERSION
.
SDK_INT
>=
18
)
{
long
progress
=
Math
.
round
(
messageObject
.
audioPlayerDuration
*(
float
)
args
[
1
])*
1000L
;
if
(
remoteControlClient
!=
null
&&
Build
.
VERSION
.
SDK_INT
>=
18
)
{
long
progress
=
Math
.
round
(
messageObject
.
audioPlayerDuration
*
(
float
)
args
[
1
])
*
1000L
;
remoteControlClient
.
setPlaybackState
(
MediaController
.
getInstance
().
isMessagePaused
()
?
RemoteControlClient
.
PLAYSTATE_PAUSED
:
RemoteControlClient
.
PLAYSTATE_PLAYING
,
progress
,
MediaController
.
getInstance
().
isMessagePaused
()
?
0
f
:
1
f
);
...
...
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