use of annis.libgui.media.MediaPlayer in project ANNIS by korpling.
the class MediaControllerImpl method play.
@Override
public void play(String resultID, double startTime, double endTime) {
boolean foundPlayer = false;
lock.readLock().lock();
try {
MediaPlayer player = getPlayerForResult(resultID);
if (player != null) {
closeOtherPlayers(player);
VisualizationToggle t = visToggle.get(player);
if (t != null) {
foundPlayer = true;
t.toggleVisualizer(true, new CallbackImpl(player, startTime, endTime));
}
}
} finally {
lock.readLock().unlock();
}
if (!foundPlayer) {
Notification.show("Could not play media.", "If this is a match reference open the actual search interface by following the \"Show in ANNIS search interface\" link.", Notification.Type.WARNING_MESSAGE);
}
}
use of annis.libgui.media.MediaPlayer in project ANNIS by korpling.
the class MediaControllerImpl method getPlayerForResult.
private MediaPlayer getPlayerForResult(String resultID) {
List<MediaPlayer> allPlayers = mediaPlayers.get(resultID);
if (allPlayers != null && allPlayers.size() > 0) {
MediaPlayer lastPlayer = lastUsedPlayer.get(resultID);
MediaPlayer player;
if (lastPlayer == null) {
player = allPlayers.get(0);
} else {
player = lastPlayer;
}
return player;
}
return null;
}
use of annis.libgui.media.MediaPlayer in project ANNIS by korpling.
the class VisualizerPanel method updateGUIAfterLoadingVisualizer.
// end loadVisualizer
private void updateGUIAfterLoadingVisualizer(LoadableVisualizer.Callback callback) {
if (callback != null && vis instanceof LoadableVisualizer) {
LoadableVisualizer loadableVis = (LoadableVisualizer) vis;
if (loadableVis.isLoaded()) {
// direct call callback since the visualizer is already ready
callback.visualizerLoaded(loadableVis);
} else {
loadableVis.clearCallbacks();
// add listener when player was fully loaded
loadableVis.addOnLoadCallBack(callback);
}
}
progress.setEnabled(false);
progress.setVisible(false);
if (vis != null) {
btEntry.setEnabled(true);
vis.setVisible(true);
if (vis instanceof PDFViewer) {
((PDFViewer) vis).openPDFPage("-1");
}
if (vis instanceof MediaPlayer) {
// if this is a media player visualizer, close all other media players
// since some browsers (e.g. Chrome) have problems if there are multiple
// audio/video elements on one page
MediaController mediaController = VaadinSession.getCurrent().getAttribute(MediaController.class);
mediaController.closeOtherPlayers((MediaPlayer) vis);
}
// add if not already added
if (getComponentIndex(vis) < 0) {
addComponent(vis);
}
}
}
Aggregations