Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AudioBookConverter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Gummi
AudioBookConverter
Commits
80537bd7
Unverified
Commit
80537bd7
authored
2 years ago
by
Yarick Yermak
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #441 from yermak/development
Fixed mp3 playback and seek
parents
c98d4e38
a9d92433
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/uk/yermak/audiobookconverter/fx/MediaPlayerController.java
+13
-4
13 additions, 4 deletions
...k/yermak/audiobookconverter/fx/MediaPlayerController.java
with
13 additions
and
4 deletions
src/main/java/uk/yermak/audiobookconverter/fx/MediaPlayerController.java
+
13
−
4
View file @
80537bd7
...
@@ -13,8 +13,8 @@ import javafx.util.Duration;
...
@@ -13,8 +13,8 @@ import javafx.util.Duration;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
uk.yermak.audiobookconverter.AudiobookConverter
;
import
uk.yermak.audiobookconverter.AudiobookConverter
;
import
uk.yermak.audiobookconverter.book.MediaInfo
;
import
uk.yermak.audiobookconverter.Utils
;
import
uk.yermak.audiobookconverter.Utils
;
import
uk.yermak.audiobookconverter.book.MediaInfo
;
import
java.io.File
;
import
java.io.File
;
import
java.lang.invoke.MethodHandles
;
import
java.lang.invoke.MethodHandles
;
...
@@ -26,7 +26,7 @@ import java.util.concurrent.TimeUnit;
...
@@ -26,7 +26,7 @@ import java.util.concurrent.TimeUnit;
/**
/**
* Created by yermak on 26-Oct-18.
* Created by yermak on 26-Oct-18.
*/
*/
public
class
MediaPlayerController
{
public
class
MediaPlayerController
{
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
MethodHandles
.
lookup
().
lookupClass
());
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
MethodHandles
.
lookup
().
lookupClass
());
@FXML
@FXML
...
@@ -120,13 +120,21 @@ public class MediaPlayerController {
...
@@ -120,13 +120,21 @@ public class MediaPlayerController {
mediaPlayer
.
volumeProperty
().
bindBidirectional
(
volume
.
valueProperty
());
mediaPlayer
.
volumeProperty
().
bindBidirectional
(
volume
.
valueProperty
());
mediaPlayer
.
volumeProperty
().
set
(
1.0
);
mediaPlayer
.
volumeProperty
().
set
(
1.0
);
mediaPlayer
.
rateProperty
().
bind
(
context
.
getOutputParameters
().
getSpeedObservable
());
mediaPlayer
.
rateProperty
().
set
(
context
.
getOutputParameters
().
getSpeed
());
mediaPlayer
.
rateProperty
().
set
(
context
.
getOutputParameters
().
getSpeed
());
mediaPlayer
.
rateProperty
().
bind
(
context
.
getOutputParameters
().
getSpeedObservable
());
timelapse
.
valueProperty
().
addListener
(
observable
->
{
timelapse
.
valueProperty
().
addListener
(
observable
->
{
if
(
timelapse
.
isValueChanging
())
{
if
(
timelapse
.
isValueChanging
())
{
boolean
wasPlaying
=
false
;
if
(
mediaPlayer
.
getStatus
()
==
MediaPlayer
.
Status
.
PLAYING
)
{
wasPlaying
=
true
;
mediaPlayer
.
pause
();
}
playTime
.
setText
(
Utils
.
formatTime
(
timelapse
.
getValue
()
*
1000
));
playTime
.
setText
(
Utils
.
formatTime
(
timelapse
.
getValue
()
*
1000
));
mediaPlayer
.
seek
(
Duration
.
seconds
(
timelapse
.
getValue
()));
mediaPlayer
.
seek
(
Duration
.
seconds
(
timelapse
.
getValue
()));
if
(
wasPlaying
)
{
mediaPlayer
.
play
();
}
}
}
});
});
...
@@ -134,7 +142,8 @@ public class MediaPlayerController {
...
@@ -134,7 +142,8 @@ public class MediaPlayerController {
executorService
.
shutdown
();
executorService
.
shutdown
();
mediaPlayer
.
volumeProperty
().
unbindBidirectional
(
volume
.
valueProperty
());
mediaPlayer
.
volumeProperty
().
unbindBidirectional
(
volume
.
valueProperty
());
mediaPlayer
.
dispose
();
mediaPlayer
.
dispose
();
mediaPlayer
=
null
;
mediaPlayer
=
null
;
totalTime
.
setText
(
"00:00:00"
);
totalTime
.
setText
(
"00:00:00"
);
playTime
.
setText
(
"00:00:00"
);
playTime
.
setText
(
"00:00:00"
);
...
...
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