Index: tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/OpenMediaPlayer.java
===================================================================
--- tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/OpenMediaPlayer.java	(revision 3191)
+++ tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/OpenMediaPlayer.java	(revision 3192)
@@ -50,7 +50,8 @@
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.handlers.HandlerUtil;
 import org.txm.backtomedia.editors.input.MediaPlayerEditorInput;
-import org.txm.backtomedia.editors.vlcplayer.MediaPlayerEditor;
+import org.txm.backtomedia.editors.player.MediaPlayerEditor;
+import org.txm.backtomedia.preferences.BackToMediaPreferences;
 import org.txm.rcp.StatusLine;
 import org.txm.rcp.TXMWindows;
 
@@ -64,7 +65,7 @@
 public class OpenMediaPlayer extends AbstractHandler {
 	
 	/** The ID. */
-	public static String ID = "org.txm.rcp.commands.BackToMedia"; //$NON-NLS-1$
+	public static String ID = OpenMediaPlayer.class.getSimpleName(); //$NON-NLS-1$
 	
 	/*
 	 * (non-Javadoc)
@@ -92,7 +93,7 @@
 		}
 		
 		Shell sh = HandlerUtil.getActiveShell(event);
-		SimpleFileDialog fd = new SimpleFileDialog(sh, "Opening media file...", "Enter file path or URL", "", null);
+		SimpleFileDialog fd = new SimpleFileDialog(sh, "Opening media file...", "Enter file path or URL", BackToMediaPreferences.getInstance().getString(ID), null);
 		// FileDialog fd = new FileDialog(new Shell(), SWT.SAVE);
 		// fd.setText(MessagesMP.select_file);
 		
@@ -109,6 +110,7 @@
 				else {
 					
 				}
+				BackToMediaPreferences.getInstance().put(ID, mrl);
 				return openEditor(mrl, 0);
 			}
 		}
Index: tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/BackToMedia.java
===================================================================
--- tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/BackToMedia.java	(revision 3191)
+++ tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/BackToMedia.java	(revision 3192)
@@ -45,8 +45,8 @@
 import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.handlers.HandlerUtil;
 import org.eclipse.ui.part.EditorPart;
-import org.txm.backtomedia.editors.vlcplayer.VLCPlayer;
-import org.txm.backtomedia.editors.vlcplayer.MediaPlayerEditor;
+import org.txm.backtomedia.editors.player.MediaPlayerEditor;
+import org.txm.backtomedia.editors.player.VLCPlayer;
 import org.txm.backtomedia.preferences.BackToMediaPreferences;
 import org.txm.concordance.core.functions.Line;
 import org.txm.concordance.rcp.editors.ConcordanceEditor;
Index: tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/SimpleFileDialog.java
===================================================================
--- tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/SimpleFileDialog.java	(revision 3191)
+++ tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/SimpleFileDialog.java	(revision 3192)
@@ -16,6 +16,7 @@
 public class SimpleFileDialog extends InputDialog {
 	
 	Button selectButton;
+	String defaultPath = null;
 	
 	public SimpleFileDialog(Shell parentShell, String dialogTitle, String dialogMessage, String initialValue, IInputValidator validator) {
 		super(parentShell, dialogTitle, dialogMessage, initialValue, validator);
@@ -29,6 +30,9 @@
 		layout.numColumns = layout.numColumns + 1;
 		
 		getText().setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false, 2, 1));
+		if (defaultPath != null) {
+			getText().setText(defaultPath);
+		}
 		setErrorMessage(null);
 		selectButton = new Button(p, SWT.PUSH);
 		selectButton.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, true));
Index: tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/preferences/BackToMediaPreferencePage.java
===================================================================
--- tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/preferences/BackToMediaPreferencePage.java	(revision 3191)
+++ tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/preferences/BackToMediaPreferencePage.java	(revision 3192)
@@ -156,7 +156,7 @@
 		
 		updateEnables(BackToMediaPreferences.getInstance().getString(BackToMediaPreferences.SYNCMODE));
 		
-		String[][] players = { { "JFX", "JFX" }, { "VLC", "VLC" } };
+		String[][] players = {{ "HTML", "HTML" },  { "JFX", "JFX" }, { "VLC", "VLC" } };
 		playerProperty = new ComboFieldEditor(BackToMediaPreferences.PLAYER, "Embedded player", players, getFieldEditorParent());
 		addField(playerProperty);
 	}
Index: tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/preferences/BackToMediaPreferences.java
===================================================================
--- tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/preferences/BackToMediaPreferences.java	(revision 3191)
+++ tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/preferences/BackToMediaPreferences.java	(revision 3192)
@@ -67,7 +67,7 @@
 		super.initializeDefaultPreferences();
 		
 		Preferences preferences = DefaultScope.INSTANCE.getNode(getPreferencesNodeQualifier());
-		preferences.put(PLAYER, "JFX");
+		preferences.put(PLAYER, "HTML");
 		preferences.putBoolean(REPEAT, true);
 		preferences.put(SYNCMODE, MILESTONEMODE);
 		preferences.put(STRUCTURE, "u");
Index: tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/MediaPlayerComposite.java
===================================================================
--- tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/MediaPlayerComposite.java	(revision 0)
+++ tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/MediaPlayerComposite.java	(revision 3192)
@@ -0,0 +1,305 @@
+package org.txm.backtomedia.editors.player;
+
+import java.io.File;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Scale;
+import org.txm.backtomedia.commands.function.TripleRangeSlider;
+import org.txm.backtomedia.preferences.BackToMediaPreferences;
+import org.txm.utils.logger.Log;
+
+import javafx.util.Duration;
+import vlcplayerrcp.MessagesMP;
+
+public class MediaPlayerComposite extends Composite {
+	
+	IPlayer player;
+	private Scale rateField;
+	private Label rateValueLabel;
+	private Scale volumeField;
+	private Label volumeValueLabel;
+	private Button playButton;
+	private Button stopButton;
+	private Button repeatButton;
+	Label timeLabel;
+	TripleRangeSlider timeRange;
+	
+	protected boolean userStopped;
+	protected String currentlyPlayed = ""; //$NON-NLS-1$
+	protected int start, end;
+	protected boolean hasEnded = false;
+	protected String previouslyPlayed = ""; //$NON-NLS-1$
+	protected boolean repeat = false;
+	protected int volume = 100;
+	protected int time;
+	private int mins;
+	private int secs;
+	
+	public MediaPlayerComposite(Composite parent, int style) {
+		
+		super(parent, style);
+		
+		if ("HTML".equals(BackToMediaPreferences.getInstance().getString(BackToMediaPreferences.PLAYER))) {
+			player = new HTMLPlayer(parent, SWT.NONE);
+		} else if ("JFX".equals(BackToMediaPreferences.getInstance().getString(BackToMediaPreferences.PLAYER))) {
+			player = new JFXPlayer(parent, SWT.NONE);
+		}
+		else if ("VLC".equals(BackToMediaPreferences.getInstance().getString(BackToMediaPreferences.PLAYER))) {
+			player = new VLCPlayer(parent, SWT.NONE);
+		}
+		else {
+			player = new HTMLPlayer(parent, SWT.NONE);
+		}
+		
+		
+		// THE CONTROL BUTTONS
+		playButton = new Button(this, SWT.PUSH);
+		GridData playLayoutData = new GridData(SWT.FILL, SWT.CENTER, false, false);
+		playButton.setLayoutData(playLayoutData);
+		playButton.setText(MessagesMP.play);
+		playButton.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				userStopped = false;
+				if (currentlyPlayed.length() == 0) {
+					selectMedia();
+					playButton.setText(MessagesMP.pause);
+					playButton.getParent().layout();
+				}
+				else if (player != null && player.isPlaying()) {
+					player.pause();
+				}
+				else if (player != null && hasEnded) {
+					if (player == null) return;
+					player.replay();
+				}
+				else {
+					player.resume();
+				}
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		
+		// Button browseButton = new Button(this,SWT.PUSH);
+		// browseButton.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
+		// browseButton.setText("Open...");
+		// browseButton.addSelectionListener(new SelectionListener() {
+		// @Override
+		// public void widgetSelected(SelectionEvent e) {
+		// selectMedia();
+		// }
+		//
+		// @Override
+		// public void widgetDefaultSelected(SelectionEvent e) {}
+		// });
+		
+		stopButton = new Button(this, SWT.PUSH);
+		stopButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+		stopButton.setText(MessagesMP.stop);
+		stopButton.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				if (player != null) {
+					userStopped = true;
+					player.stop();
+				}
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		
+		timeLabel = new Label(this, SWT.NONE);
+		timeLabel.setText("00:00"); //$NON-NLS-1$
+		
+		timeRange = new TripleRangeSlider(this, SWT.None);
+		timeRange.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+		timeRange.setToolTipText(MessagesMP.time_range);
+		timeRange.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				TripleRangeSlider.SELECTED_KNOB sk = timeRange.getLastSelectedKnob();
+				switch (sk) {
+					case UPPER:
+						end = timeRange.getUpperValue();
+						
+						player.setStopTime(end); //Duration.seconds(end));
+						if (end < time) {
+							// System.out.println("Upper changed: fix time");
+							time = end;
+							player.seek(time);//Duration.seconds(time));
+						}
+						break;
+					case LOWER:
+						start = timeRange.getLowerValue();
+						player.setStartTime(start);//Duration.seconds(start));
+						if (start > time) {
+							// System.out.println("Lower changed: fix time");
+							time = start;
+							player.seek(time);//Duration.seconds(time));
+						}
+						break;
+					case MIDDLE:
+						
+						time = timeRange.getMiddleValue();
+						// System.out.println("Middle changed: fix time: " + time);
+						
+						player.seek(time);//Duration.seconds(time));
+						
+						break;
+					default:
+						// nothing
+				}
+				// System.out.println("time range: "+start+" -> "+end+" time="+time);
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		
+		repeatButton = new Button(this, SWT.CHECK);
+		repeatButton.setText(MessagesMP.repeat);
+		repeat = BackToMediaPreferences.getInstance().getBoolean(BackToMediaPreferences.REPEAT);
+		repeatButton.setSelection(repeat);
+		repeatButton.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				repeat = repeatButton.getSelection();
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		
+		Label l = new Label(this, SWT.NONE);
+		l.setText(MessagesMP.rate);
+		
+		rateField = new Scale(this, SWT.BORDER);
+		GridData gdata4 = new GridData(SWT.FILL, SWT.CENTER, false, false);
+		gdata4.widthHint = 100;
+		rateField.setLayoutData(gdata4);
+		rateField.setMaximum(140);
+		rateField.setMinimum(70);
+		rateField.setSelection(100);
+		rateField.setPageIncrement(5);
+		
+		rateField.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				float rate = rateField.getSelection() / 100.0f;
+				player.setRate(rate);
+				rateValueLabel.setText("" + rateField.getSelection() + "%");
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		
+		rateValueLabel = new Label(this, SWT.NONE);
+		rateValueLabel.setText("100%");//$NON-NLS-1$
+		
+		l = new Label(this, SWT.NONE);
+		l.setText(MessagesMP.volume);
+		
+		volumeField = new Scale(this, SWT.BORDER);
+		gdata4 = new GridData(SWT.FILL, SWT.CENTER, false, false);
+		gdata4.widthHint = 100;
+		volumeField.setLayoutData(gdata4);
+		volumeField.setMinimum(0);
+		volumeField.setMaximum(100);
+		volumeField.setSelection(volume);
+		volumeField.setPageIncrement(5);
+		volumeField.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				player.setVolume(volumeField.getSelection());
+				volume = volumeField.getSelection();
+				volumeValueLabel.setText("" + volume + "%");
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		
+		volumeValueLabel = new Label(this, SWT.NONE);
+		volumeValueLabel.setText("100%");
+		
+		
+	}
+	
+	public void hideStopButton() {
+		if (this.stopButton != null && !this.stopButton.isDisposed()) {
+			this.stopButton.dispose();
+		}
+	}
+	
+	public void resume() {
+		if (player != null) {
+			//player.play();
+			playButton.setText(MessagesMP.pause);
+			playButton.getParent().layout();
+		}
+	}
+	
+	public void pause() {
+		if (player != null) {
+			player.pause();
+			playButton.setText(MessagesMP.resume);
+			playButton.getParent().layout();
+		}
+	}
+	
+	private void updateTimeLabel() {
+		mins = time / 60;
+		secs = (time) % 60;
+		timeLabel.setText(String.format("%02d:%02d", mins, secs)); //$NON-NLS-1$
+		timeLabel.update();
+	}
+	
+	public void replay() {
+		if (currentlyPlayed.length() > 0) {
+			//player.seek(Duration.seconds(start));
+			playButton.setText(MessagesMP.pause);
+			playButton.getParent().layout();
+		}
+	}
+	
+	protected void selectMedia() {
+		Log.fine(MessagesMP.select_file);
+		
+		FileDialog fd = new FileDialog(MediaPlayerComposite.this.getShell(), SWT.OPEN);
+		fd.setText(MessagesMP.select_file_title);
+		File f = new File(previouslyPlayed);
+		if (f.isDirectory()) fd.setFilterPath(f.getPath());
+		else fd.setFilterPath(f.getParent());
+		
+		String[] filterExt = { "*.*", "*.mp3", "*.mp4", "*.avi", "*.ogg", "*.ogv" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+		fd.setFilterExtensions(filterExt);
+		String selected = fd.open();
+		if (selected == null) {
+			System.out.println(MessagesMP.cancel);
+			return;
+		}
+		
+		currentlyPlayed = selected;
+		previouslyPlayed = selected;
+		Log.fine(MessagesMP.opening + currentlyPlayed);
+		player.play(new File(currentlyPlayed).toURI().toString(), 0, 0);
+	}
+	
+}

Property changes on: tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/MediaPlayerComposite.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/HTMLPlayer.java
===================================================================
--- tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/HTMLPlayer.java	(revision 0)
+++ tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/HTMLPlayer.java	(revision 3192)
@@ -0,0 +1,337 @@
+package org.txm.backtomedia.editors.player;
+
+import java.io.File;
+import java.time.LocalTime;
+import java.time.format.DateTimeFormatter;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Scale;
+import org.eclipse.swt.widgets.Spinner;
+import org.txm.backtomedia.commands.function.OpenMediaPlayer;
+import org.txm.backtomedia.commands.function.SimpleFileDialog;
+import org.txm.backtomedia.preferences.BackToMediaPreferences;
+import org.txm.rcp.swt.GLComposite;
+
+public class HTMLPlayer extends Composite implements IPlayer {
+
+	Browser browser;
+	String mrl = null;
+	private String login;
+	private String mdp;
+	private Button stopButton;
+	
+	public HTMLPlayer(Composite parent, int style) {
+		
+		super(parent, style);
+		parent.setLayout(new GridLayout(1, true));
+		
+		GLComposite controls = new GLComposite(parent, SWT.BORDER, "controls");
+		controls.getLayout().numColumns = 20;
+		
+		Button openButton = new Button(controls, SWT.PUSH);
+		openButton.setText("Open...");
+		openButton.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				
+				SimpleFileDialog fd = new SimpleFileDialog(HTMLPlayer.this.getDisplay().getActiveShell(), "Opening media file...", "Enter file path or URL", BackToMediaPreferences.getInstance().getString(OpenMediaPlayer.ID), null);
+				if (fd.open() == SimpleFileDialog.OK) {
+					String mrl = fd.getValue();
+					
+					if (mrl != null) {
+						File f = new File(mrl);
+						if (f.exists()) {
+							mrl = new File(mrl).toURI().toString();
+						}
+						else {
+							
+						}
+						BackToMediaPreferences.getInstance().put(OpenMediaPlayer.ID, mrl);
+						play(mrl, 0);
+					}
+				}
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+
+		stopButton = new Button(controls, SWT.PUSH);
+		stopButton.setText("Stop");
+		stopButton.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				stop();
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+		
+		Button playpauseButton = new Button(controls, SWT.TOGGLE);
+		playpauseButton.setText("Pause");
+		playpauseButton.setSelection(true);
+		playpauseButton.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				if (playpauseButton.getSelection()) {
+					resume();
+					playpauseButton.setText("Pause");
+				} else {
+					pause();
+					playpauseButton.setText("Play");
+				}
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+		
+		Button replayButton = new Button(controls, SWT.PUSH);
+		replayButton.setText("Re-play");
+		replayButton.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				replay();
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+		
+		Button loopButton = new Button(controls, SWT.TOGGLE);
+		loopButton.setText("Loop");
+		loopButton.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				setRepeat(loopButton.getSelection());
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+		
+		Scale volumneSpinner = new Scale(controls, SWT.NONE);
+		volumneSpinner.setMinimum(0);
+		volumneSpinner.setMaximum(100);
+		volumneSpinner.setSelection(100);
+		volumneSpinner.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				setVolume(volumneSpinner.getSelection());
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+		
+		Scale rateSpinner = new Scale(controls, SWT.NONE);
+		rateSpinner.setMinimum(10);
+		rateSpinner.setMaximum(300);
+		rateSpinner.setSelection(100);
+		rateSpinner.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				setRate(((float)rateSpinner.getSelection())/100.0f);
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+		
+		browser = new Browser(parent, SWT.NONE);
+		browser.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
+		browser.setText("<video id=\"video\" width=\"100%\" height=\"100%\" controls></video>");
+		//browser.setText("<video id=\"video\" width=\"100%\" height=\"100%\" controls><source id=\"source\" src=\"\"></source></video>");
+	}
+
+	@Override
+	public void setCredentials(String login, String mdp) {
+		
+		//browser.evaluate(TXMCoreMessages.bind("video.;", login, mdp));
+		this.login = login;
+		this.mdp = mdp;
+		
+	}
+	
+	
+	public void hideStopButton() {
+		if (this.stopButton != null && !this.stopButton.isDisposed()) {
+			this.stopButton.dispose();
+		}
+	}
+
+	DateTimeFormatter hhmmssFormatter = DateTimeFormatter.ISO_LOCAL_TIME;
+	@Override
+	public boolean play(String mrl, String startTime, String endTime) {
+		
+		int start=0, end=0;
+		if (startTime.matches("[0-9]+.[0-9]+")) {
+			start = (int) (Float.parseFloat(startTime));
+		}
+		else if (startTime.matches("[0-9]+:[0-9]+:[0-9]+")) {
+			if (startTime.indexOf(":") == 1) {
+				startTime = "0" + startTime;
+			}
+			LocalTime time1 = LocalTime.parse(startTime, hhmmssFormatter);
+			start =  ((time1.getHour() * 60 * 60) + (time1.getMinute() * 60) + time1.getSecond());
+		}
+		
+		if (endTime.matches("[0-9]+.[0-9]+")) {
+			end = (int) ( Float.parseFloat(endTime));
+		}
+		else if (endTime.matches("[0-9]+:[0-9]+:[0-9]+")) {
+			if (endTime.indexOf(":") == 1) endTime = "0" + endTime;
+			LocalTime time1 = LocalTime.parse(endTime, hhmmssFormatter);
+			end =  ((time1.getHour() * 60 * 60) + (time1.getMinute() * 60) + time1.getSecond());
+		}
+		
+		return play(mrl, start, end);
+		
+	}
+
+	@Override
+	public boolean play(String mrl, int start, int end) {
+		
+		browser.evaluate("document;");
+		browser.evaluate("document.getElementById(\"video\");");
+		browser.evaluate("document.getElementById(\"source\");");
+		
+		if (login != null && mdp != null) {
+			mrl = mrl.replace("{0}", login).replace("{1}", mdp);
+		}
+		
+		String script = "document;\n"
+				+ "video = document.getElementById('video');\n";
+		
+		if (this.mrl == null || !this.mrl.equals(mrl)) {
+			script += "video.setAttribute('src', '"+mrl+"');\n"; 
+		}
+		script += "video.play();\n" +
+				"video.currentTime="+start+";\n";
+		//System.out.println("EVAL: "+script);
+		browser.evaluate(script);
+		
+		this.mrl = mrl;
+		return true;
+	}
+
+	@Override
+	public boolean play(String mrl, int start) {
+		
+		return play(mrl, start, -1);
+		
+	}
+
+	@Override
+	public void stop() {
+		
+		if (browser.isDisposed()) return;
+		
+		browser.evaluate("video.pause();");
+		browser.evaluate("video.setAttribute('src', '');");
+		
+	}
+
+	@Override
+	public boolean isMediaLoaded() {
+		
+		return mrl != null && mrl.length() > 0;
+		
+	}
+
+	@Override
+	public void setRepeat(boolean b) {
+		
+		browser.evaluate("video.loop="+b+";");
+		
+	}
+
+	@Override
+	public boolean isDisposed() {
+		
+		return browser.isDisposed();
+		
+	}
+
+	@Override
+	public void seek(float time) {
+		
+		browser.evaluate("video.currentTime="+time+";");
+		
+	}
+
+	@Override
+	public void pause() {
+		
+		browser.evaluate("video.pause();");
+		
+	}
+
+	@Override
+	public void replay() {
+		
+		browser.evaluate("video.currentTime=0;");
+		
+	}
+
+	@Override
+	public void resume() {
+		
+		browser.evaluate("video.play();");
+		
+	}
+
+	@Override
+	public void setVolume(double volume) {
+		
+		browser.evaluate("video.volume="+volume/100.0d+";");
+		
+	}
+
+	@Override
+	public void setRate(float rate) {
+		
+		browser.evaluate("video.playbackRate="+rate+";");
+		
+	}
+
+	@Override
+	public boolean isPlaying() {
+		Object o = browser.evaluate("return !video.played;");
+		if (o == null) return false;
+		if (o instanceof Boolean) {
+			return (Boolean)o;
+		}
+		return  false;
+		
+	}
+
+	@Override
+	public void setStartTime(float seconds) {
+		
+		//browser.evaluate(TXMCoreMessages.bind("alert(''set start time {0}'');", seconds));
+		
+	}
+
+	@Override
+	public void setStopTime(float seconds) {
+		
+		//browser.evaluate(TXMCoreMessages.bind("alert(''set stop time {0}'');", seconds));
+		
+	}
+}

Property changes on: tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/HTMLPlayer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/VLCPlayer.java
===================================================================
--- tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/VLCPlayer.java	(revision 0)
+++ tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/VLCPlayer.java	(revision 3192)
@@ -0,0 +1,714 @@
+package org.txm.backtomedia.editors.player;
+
+import static uk.co.caprica.vlcj.binding.LibVlc.libvlc_new;
+import static uk.co.caprica.vlcj.binding.LibVlc.libvlc_release;
+
+import java.io.File;
+import java.time.LocalTime;
+import java.time.format.DateTimeFormatter;
+import java.util.concurrent.Semaphore;
+
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Scale;
+import org.txm.backtomedia.commands.function.TripleRangeSlider;
+import org.txm.backtomedia.preferences.BackToMediaPreferences;
+import org.txm.utils.logger.Log;
+
+import com.sun.jna.StringArray;
+
+import uk.co.caprica.vlcj.binding.internal.libvlc_instance_t;
+import uk.co.caprica.vlcj.factory.discovery.NativeDiscovery;
+import uk.co.caprica.vlcj.factory.discovery.strategy.NativeDiscoveryStrategy;
+import uk.co.caprica.vlcj.factory.swt.SwtMediaPlayerFactory;
+import uk.co.caprica.vlcj.player.base.MediaPlayer;
+import uk.co.caprica.vlcj.player.base.MediaPlayerEventAdapter;
+import uk.co.caprica.vlcj.player.component.EmbeddedMediaPlayerComponent;
+import uk.co.caprica.vlcj.player.embedded.EmbeddedMediaPlayer;
+import uk.co.caprica.vlcj.player.embedded.videosurface.swt.CompositeVideoSurface;
+import uk.co.caprica.vlcj.support.version.LibVlcVersion;
+import vlcplayerrcp.MessagesMP;
+
+public class VLCPlayer extends Composite implements IPlayer {
+	
+	static { // force native libs discovery -> fix Mac OS X init
+		NativeDiscovery discovery = new NativeDiscovery() {
+			
+			@Override
+			protected void onFound(String path, NativeDiscoveryStrategy strategy) {
+				Log.finer("VLC NativeDiscovery: onFound " + path + " " + strategy);
+			}
+			
+			@Override
+			protected void onNotFound() {
+				Log.finer("VLC NativeDiscovery: Not found.");
+			}
+		};
+		
+		boolean found = discovery.discover();
+		Log.finer("VLC NativeDiscovery: the discovery was succesfull ? " + found);
+		if (found) {
+			libvlc_instance_t instance = libvlc_new(0, new StringArray(new String[0]));
+			Log.finer("VLC NativeDiscovery: VLC instance is " + instance);
+			if (instance != null) {
+				libvlc_release(instance);
+			}
+			else {
+				Log.warning(NLS.bind("** Impossible to use your VLC [{0}] (please check that you have at least VLC version 3.0).", instance));
+			}
+			Log.finer("VLC NativeDiscovery: VLC version is " + new LibVlcVersion().getVersion());
+		}
+		else {
+			Log.warning("** Impossible to find VLC (please check that you have at least VLC version 3.0).");
+		}
+	}
+	
+	protected static final String NOMEDIA = ""; //$NON-NLS-1$
+	
+	private EmbeddedMediaPlayer vlcPlayer;
+	
+	private Composite videoComposite;
+	
+	private CompositeVideoSurface playerCanvas;
+	
+	private Scale rateField;
+	
+	private Label rateValueLabel;
+	
+	private Scale volumeField;
+	
+	private Label volumeValueLabel;
+	
+	private Button playButton;
+	
+	private Button repeatButton;
+	
+	protected String currentlyPlayed = ""; //$NON-NLS-1$
+	
+	// private String startTime, endTime;
+	private int start, end;
+	
+	protected boolean hasEnded = false;
+	
+	private String previouslyPlayed = ""; //$NON-NLS-1$
+	
+	private boolean repeat = false;
+	
+	protected int volume = 100;
+	
+	private Button stopButton;
+	
+	Label timeLabel;
+	
+	TripleRangeSlider timeRange;
+	
+	boolean firstLengthEvent = true;
+	
+	long previous = 0;
+	
+	long time, mins, secs;
+	
+	private SwtMediaPlayerFactory factory;
+	
+	
+	static {
+		// uncomment to enable VLC logs
+		// Logger.setLevel(Level.TRACE);
+	}
+	
+	public EmbeddedMediaPlayer getEmbeddedMediaPlayer() {
+		return vlcPlayer;
+	}
+	
+	Semaphore s = new Semaphore(1);
+	
+	public VLCPlayer(Composite parent, int style) {
+		super(parent, style);
+		this.setLayout(new GridLayout(11, false));
+		
+		// THE PLAYER
+		// if (RuntimeUtil.isMac()) {
+		// try {
+		// LibC.INSTANCE.setenv("VLC_PLUGIN_PATH", "/Applications/VLC.app/Contents/MacOS/plugins", 1);
+		// }
+		// catch (Exception ex) {
+		// ex.printStackTrace();
+		// }
+		// }
+		videoComposite = new Composite(this, SWT.EMBEDDED | SWT.NO_BACKGROUND);
+		GridData gdata = new GridData(SWT.FILL, SWT.FILL, true, true);
+		gdata.horizontalSpan = 11;
+		videoComposite.setLayoutData(gdata);
+		
+		factory = new SwtMediaPlayerFactory();
+		playerCanvas = factory.swt().newCompositeVideoSurface(videoComposite);
+		
+		EmbeddedMediaPlayerComponent e = new EmbeddedMediaPlayerComponent();
+		vlcPlayer = e.mediaPlayer();
+		vlcPlayer.videoSurface().set(playerCanvas);
+		
+		videoComposite.addDisposeListener(new DisposeListener() {
+			
+			@Override
+			public void widgetDisposed(DisposeEvent e) {
+				
+				
+				// vlcPlayer.submit(new Runnable() {
+				//
+				// @Override
+				// public void run() {
+				//
+				// }
+				// });
+				
+				// System.out.println("VLC STOP");
+				// vlcPlayer.controls().stop();
+				System.out.println("VLC RELEASE");
+				vlcPlayer.release();
+				System.out.println("FAC RELEASE");
+				factory.release();
+				// s.release();
+			}
+		});
+		
+		// THE CONTROL BUTTONS
+		playButton = new Button(this, SWT.PUSH);
+		GridData playLayoutData = new GridData(SWT.FILL, SWT.CENTER, false, false);
+		playButton.setLayoutData(playLayoutData);
+		playButton.setText(MessagesMP.play);
+		playButton.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				vlcPlayer.submit(new Runnable() {
+					
+					@Override
+					public void run() {
+						if (currentlyPlayed.length() == 0) {
+							selectMedia();
+							playButton.setText(MessagesMP.pause);
+						}
+						else if (vlcPlayer.status().isPlaying()) {
+							vlcPlayer.controls().pause();
+							playButton.setText(MessagesMP.resume);
+						}
+						else if (hasEnded) {
+							replay();
+						}
+						else {
+							vlcPlayer.controls().play();
+							playButton.setText(MessagesMP.pause);
+						}
+					}
+				});
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		
+		// Button browseButton = new Button(this,SWT.PUSH);
+		// browseButton.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
+		// browseButton.setText("Open...");
+		// browseButton.addSelectionListener(new SelectionListener() {
+		// @Override
+		// public void widgetSelected(SelectionEvent e) {
+		// selectMedia();
+		// }
+		//
+		// @Override
+		// public void widgetDefaultSelected(SelectionEvent e) {}
+		// });
+		
+		stopButton = new Button(this, SWT.PUSH);
+		stopButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+		stopButton.setText(MessagesMP.stop);
+		stopButton.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				stop();
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		
+		timeLabel = new Label(this, SWT.NONE);
+		timeLabel.setText("00:00"); //$NON-NLS-1$
+		
+		timeRange = new TripleRangeSlider(this, SWT.None);
+		timeRange.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+		timeRange.setToolTipText(MessagesMP.time_range);
+		timeRange.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				TripleRangeSlider.SELECTED_KNOB sk = timeRange.getLastSelectedKnob();
+				switch (sk) {
+					case UPPER:
+						setStopTime(timeRange.getUpperValue());
+						break;
+					case LOWER:
+						setStartTime(timeRange.getLowerValue());
+						
+						break;
+					case MIDDLE:
+						
+						seek(timeRange.getMiddleValue());
+						
+						break;
+					default:
+						// nothing
+				}
+				// System.out.println("time range: "+start+" -> "+end+" time="+time);
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		
+		repeatButton = new Button(this, SWT.CHECK);
+		repeatButton.setText(MessagesMP.repeat);
+		repeat = BackToMediaPreferences.getInstance().getBoolean(BackToMediaPreferences.REPEAT);
+		repeatButton.setSelection(repeat);
+		repeatButton.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				repeat = repeatButton.getSelection();
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		
+		Label l = new Label(this, SWT.NONE);
+		l.setText(MessagesMP.rate);
+		
+		rateField = new Scale(this, SWT.BORDER);
+		GridData gdata4 = new GridData(SWT.FILL, SWT.CENTER, false, false);
+		gdata4.widthHint = 100;
+		rateField.setLayoutData(gdata4);
+		rateField.setMaximum(140);
+		rateField.setMinimum(70);
+		rateField.setSelection(100);
+		rateField.setPageIncrement(5);
+		
+		rateField.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				float rate = rateField.getSelection() / 100.0f;
+				vlcPlayer.controls().setRate(rate);
+				rateValueLabel.setText("" + rateField.getSelection() + "%");
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		
+		rateValueLabel = new Label(this, SWT.NONE);
+		rateValueLabel.setText("100%");//$NON-NLS-1$
+		
+		l = new Label(this, SWT.NONE);
+		l.setText(MessagesMP.volume);
+		
+		volumeField = new Scale(this, SWT.BORDER);
+		gdata4 = new GridData(SWT.FILL, SWT.CENTER, false, false);
+		gdata4.widthHint = 100;
+		volumeField.setLayoutData(gdata4);
+		volumeField.setMinimum(0);
+		volumeField.setMaximum(100);
+		volumeField.setSelection(volume);
+		volumeField.setPageIncrement(5);
+		volumeField.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				vlcPlayer.audio().setVolume(volumeField.getSelection());
+				volume = volumeField.getSelection();
+				volumeValueLabel.setText("" + volume + "%");
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		
+		volumeValueLabel = new Label(this, SWT.NONE);
+		volumeValueLabel.setText("100%");
+		
+		vlcPlayer.events().addMediaPlayerEventListener(new MediaPlayerEventAdapter() {
+			
+			@Override
+			public void opening(MediaPlayer mediaPlayer) {
+				if (videoComposite.isDisposed()) return;
+				Log.finer("Opening media...");
+			}
+			
+			@Override
+			public void finished(MediaPlayer mediaPlayer) {
+				if (videoComposite.isDisposed()) return;
+				Log.finer("Finished playing media...");
+				mediaPlayer.submit(new Runnable() {
+					
+					@Override
+					public void run() {
+						if (repeat) {
+							replay();
+						}
+						else {
+							hasEnded = true;
+						}
+					}
+				});
+			}
+		});
+		
+		vlcPlayer.events().addMediaPlayerEventListener(new MediaPlayerEventAdapter() {
+			
+			@Override
+			public void timeChanged(MediaPlayer mediaPlayer, final long arg1) {
+				if (videoComposite.isDisposed()) return;
+				
+				mediaPlayer.submit(new Runnable() {
+					
+					@Override
+					public void run() {
+						time = arg1;
+						if (previous == time) {
+							return;
+						}
+						previous = time;
+						
+						timeLabel.getDisplay().syncExec(new Runnable() {
+							
+							@Override
+							public void run() {
+								if (timeRange.isDisposed()) {
+									return;
+								}
+								if (!timeRange.isDragMiddleKnob()) {
+									timeRange.setMiddleValue((int) time);
+								}
+								updateTimeLabel();
+								
+								if (arg1 > end && end != start) {
+									// System.out.println("Time > end :"+arg1 +" > "+end);
+									if (repeat) {
+										vlcPlayer.controls().setTime(start);
+									}
+									else {
+										vlcPlayer.controls().stop();
+									}
+								}
+							}
+						});
+					}
+				});
+			}
+			
+			@Override
+			public void lengthChanged(MediaPlayer mediaPlayer, final long arg1) {
+				if (videoComposite.isDisposed()) return;
+				
+				mediaPlayer.submit(new Runnable() {
+					
+					@Override
+					public void run() {
+						if (firstLengthEvent) {
+							firstLengthEvent = false;
+							
+							// initialize time range widget limits
+							timeRange.getDisplay().syncExec(new Runnable() {
+								
+								@Override
+								public void run() {
+									if (timeRange.isDisposed()) return;
+									timeRange.setMaximum((int) arg1);
+									// if (start == end) end = (int)arg1;
+									
+									
+									if (end > 0 && start != end) {
+										timeRange.setUpperValue(end);
+									}
+									else {
+										timeRange.setUpperValue((int) arg1);
+									}
+									
+									timeRange.setLowerValue(start);
+									// System.out.println("Range: "+start+" -> "+end+" song length "+arg1);
+								}
+							});
+						}
+					}
+				});
+			}
+		});
+	}
+	
+	private void updateTimeLabel() {
+		mins = time / 60000;
+		secs = (time / 1000) % 60;
+		timeLabel.setText(String.format("%02d:%02d", mins, secs)); //$NON-NLS-1$
+		timeLabel.update();
+	}
+	
+	public void replay() {
+		if (currentlyPlayed.length() > 0) {
+			// this.play(currentlyPlayed, startTime, endTime);
+			vlcPlayer.submit(new Runnable() {
+				
+				@Override
+				public void run() {
+					vlcPlayer.controls().setTime(start);
+				}
+			});
+			
+			playButton.setText(MessagesMP.pause);
+		}
+	}
+	
+	protected void selectMedia() {
+		Log.fine(MessagesMP.select_file);
+		
+		FileDialog fd = new FileDialog(VLCPlayer.this.getShell(), SWT.OPEN);
+		fd.setText(MessagesMP.select_file_title);
+		File f = new File(previouslyPlayed);
+		if (f.isDirectory()) fd.setFilterPath(f.getPath());
+		else fd.setFilterPath(f.getParent());
+		
+		String[] filterExt = { "*.*", "*.mp3", "*.mp4", "*.avi" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+		fd.setFilterExtensions(filterExt);
+		String selected = fd.open();
+		if (selected == null) {
+			System.out.println(MessagesMP.cancel);
+			return;
+		}
+		
+		currentlyPlayed = selected;
+		previouslyPlayed = selected;
+		Log.fine(MessagesMP.opening + currentlyPlayed);
+		play(currentlyPlayed, 0, 0);
+	}
+	
+	/**
+	 * 
+	 * @param mrl
+	 * @param time msec start time
+	 * @param endtime msec end time
+	 */
+	@Override
+	public boolean play(String mrl, int time, int endtime) {
+		Log.fine(MessagesMP.bind(MessagesMP.playing, new Object[] { mrl, time, endtime }));
+		return play(mrl, "" + time / 1000.0f, "" + endtime / 1000.0f); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+	
+	@Override
+	public boolean play(String mrl, int time) {
+		return play(mrl, time, time);
+	}
+	
+	public void hideStopButton() {
+		if (this.stopButton != null && !this.stopButton.isDisposed()) {
+			this.stopButton.dispose();
+		}
+	}
+	
+	DateTimeFormatter hhmmssFormatter = DateTimeFormatter.ISO_LOCAL_TIME;
+	
+	private boolean authenticatedURLMode = false;
+	
+	/**
+	 * 
+	 * @param mrl
+	 * @param startTime "0.0" or ""hh:mm:ss" format
+	 * @param endTime "0.0" or ""hh:mm:ss" format
+	 */
+	@Override
+	public boolean play(String mrl, String startTime, String endTime) {
+		
+		if (startTime.matches("[0-9]+.[0-9]+")) {
+			start = (int) (1000 * Float.parseFloat(startTime));
+		}
+		else if (startTime.matches("[0-9]+:[0-9]+:[0-9]+")) {
+			if (startTime.indexOf(":") == 1) {
+				startTime = "0" + startTime;
+			}
+			LocalTime time1 = LocalTime.parse(startTime, hhmmssFormatter);
+			start = 1000 * ((time1.getHour() * 60 * 60) + (time1.getMinute() * 60) + time1.getSecond());
+		}
+		
+		if (endTime.matches("[0-9]+.[0-9]+")) {
+			end = (int) (1000 * Float.parseFloat(endTime));
+		}
+		else if (endTime.matches("[0-9]+:[0-9]+:[0-9]+")) {
+			if (endTime.indexOf(":") == 1) endTime = "0" + endTime;
+			LocalTime time1 = LocalTime.parse(endTime, hhmmssFormatter);
+			end = 1000 * ((time1.getHour() * 60 * 60) + (time1.getMinute() * 60) + time1.getSecond());
+		}
+		
+		// if (start == end) end = -1;
+		
+		Log.finer(MessagesMP.bind(MessagesMP.playing, new Object[] { mrl, startTime, endTime }));
+		
+		String[] options = { " :live-caching=200" }; // reduce video stream cache duration to 200ms
+		
+		Log.finer("Preparing media...");
+		
+		// inserting login+mdp
+		String tmp = null;
+		if (authenticatedURLMode && mrl.contains("{0}") && mrl.contains("{1}")
+				&& System.getProperty(BackToMediaPreferences.MEDIA_AUTH_LOGIN) != null && System.getProperty(BackToMediaPreferences.MEDIA_AUTH_PASSWORD) != null) {
+			tmp = NLS.bind(mrl, System.getProperty(BackToMediaPreferences.MEDIA_AUTH_LOGIN), System.getProperty(BackToMediaPreferences.MEDIA_AUTH_PASSWORD));
+		}
+		
+		// use the patched URL if authenticatedURL is true
+		if (authenticatedURLMode && tmp != null) {
+			if (!vlcPlayer.media().prepare(tmp, options)) {
+				Log.finer("** Impossible to prepare media.");
+				return false;
+			}
+		}
+		else {
+			if (!vlcPlayer.media().prepare(mrl, options)) {
+				Log.finer("** Impossible to prepare media.");
+				return false;
+			}
+		}
+		
+		Log.finer("Is media valid ?");
+		if (!vlcPlayer.media().isValid()) {
+			Log.finer("** Invalid media.");
+			return false;
+		}
+		
+		Log.info("Playing media...");
+		vlcPlayer.controls().play();
+		vlcPlayer.audio().setVolume(volume);
+		vlcPlayer.controls().setTime(start);
+		
+		if (new File(mrl + ".srt").exists()) { //$NON-NLS-1$
+			vlcPlayer.subpictures().setSubTitleFile(mrl + ".srt"); //$NON-NLS-1$
+		}
+		currentlyPlayed = mrl;
+		previouslyPlayed = mrl;
+		
+		if (!playButton.isDisposed()) {
+			playButton.setText(MessagesMP.pause);
+		}
+		firstLengthEvent = true;
+		
+		return true;
+	}
+	
+	/**
+	 * for more test use "player.getEmbeddedMediaPlayer()"
+	 * 
+	 * @return false if the media could not be loaded (file not found, access error...)
+	 */
+	@Override
+	public boolean isMediaLoaded() {
+		return getEmbeddedMediaPlayer().status().isPlayable();
+	}
+	
+	@Override
+	public void setRepeat(boolean repeat) {
+		this.repeat = repeat;
+		repeatButton.setSelection(repeat);
+	}
+	
+	@Override
+	public void stop() {
+		vlcPlayer.controls().stop();
+		currentlyPlayed = NOMEDIA;
+		if (!playButton.isDisposed()) {
+			playButton.setText(MessagesMP.play);
+		}
+	}
+	
+	@Override
+	public final void setCredentials(String login, String mdp) {
+		if (login != null && mdp != null) {
+			authenticatedURLMode = true;
+		}
+		else {
+			authenticatedURLMode = false;
+		}
+	}
+
+	@Override
+	public void seek(float time) {
+		
+//		vlcPlayer.controls().setPosition(time);
+		time = timeRange.getMiddleValue();
+		// System.out.println("Middle changed: fix time: "+time);
+		vlcPlayer.controls().setPosition(time);
+	}
+
+	@Override
+	public void pause() {
+		
+		vlcPlayer.controls().pause();
+		
+	}
+
+	@Override
+	public void resume() {
+		
+		vlcPlayer.controls().play();
+		
+	}
+
+	@Override
+	public void setVolume(double volume) {
+		
+		vlcPlayer.audio().setVolume(volumeField.getSelection());
+	}
+
+	@Override
+	public void setRate(float rate) {
+		
+		vlcPlayer.controls().setRate(rate);
+		
+	}
+
+	@Override
+	public boolean isPlaying() {
+		
+		return vlcPlayer.status().isPlaying();
+	}
+
+	@Override
+	public void setStartTime(float seconds) {
+		
+		start = timeRange.getLowerValue();
+		if (start > time) {
+			// System.out.println("Lower changed: fix time");
+			time = start;
+			vlcPlayer.controls().setTime(time);
+		}
+	}
+
+	@Override
+	public void setStopTime(float seconds) {
+		end = timeRange.getUpperValue();
+		
+		if (end < time) {
+			// System.out.println("Upper changed: fix time");
+			time = end;
+			vlcPlayer.controls().setTime(time);
+		}
+		
+	}
+}

Property changes on: tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/VLCPlayer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/MediaPlayerEditor.java
===================================================================
--- tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/MediaPlayerEditor.java	(revision 0)
+++ tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/MediaPlayerEditor.java	(revision 3192)
@@ -0,0 +1,112 @@
+package org.txm.backtomedia.editors.player;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.EditorPart;
+import org.txm.backtomedia.preferences.BackToMediaPreferences;
+
+public class MediaPlayerEditor extends EditorPart {
+	
+	/** The Constant ID. */
+	public static final String ID = MediaPlayerEditor.class.getCanonicalName(); // $NON-NLS-1$
+	
+	IPlayer player;
+	
+	@Override
+	public void createPartControl(Composite parent) {
+		if ("HTML".equals(BackToMediaPreferences.getInstance().getString(BackToMediaPreferences.PLAYER))) {
+			player = new HTMLPlayer(parent, SWT.NONE);
+		} else if ("JFX".equals(BackToMediaPreferences.getInstance().getString(BackToMediaPreferences.PLAYER))) {
+			player = new JFXPlayer(parent, SWT.NONE);
+		}
+		else if ("VLC".equals(BackToMediaPreferences.getInstance().getString(BackToMediaPreferences.PLAYER))) {
+			player = new VLCPlayer(parent, SWT.NONE);
+		}
+		else {
+			player = new JFXPlayer(parent, SWT.NONE);
+		}
+	}
+	
+	public void init() {
+		
+	}
+	
+	@Override
+	public void setFocus() {
+		
+	}
+	
+	@Override
+	public void dispose() {
+		try {
+			if (player != null) player.stop();
+		}
+		catch (Exception e) {
+			e.printStackTrace();
+		}
+		
+		super.dispose();
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	@Override
+	public void doSave(IProgressMonitor monitor) {}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.part.EditorPart#doSaveAs()
+	 */
+	@Override
+	public void doSaveAs() {}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
+	 */
+	@Override
+	public void init(IEditorSite site, IEditorInput input)
+			throws PartInitException {
+		setSite(site);
+		setInput(input);
+		// VLCPlayerEditorInput ii = (VLCPlayerEditorInput) input;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
+	 */
+	@Override
+	public boolean isSaveAsAllowed() {
+		return false;
+	}
+	
+	public IPlayer getPlayer() {
+		return player;
+	}
+	
+	@Override
+	public void setPartName(String partName) {
+		super.setPartName(partName);
+	}
+	
+	@Override
+	public boolean isDirty() {
+		return false;
+	}
+	
+	/**
+	 * for more test use "player.getEmbeddedMediaPlayer()"
+	 * 
+	 * @return false if the media could not be loaded (file not found, access error...)
+	 */
+	public boolean isMediaLoaded() {
+		return player.isMediaLoaded();
+	}
+}

Property changes on: tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/MediaPlayerEditor.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/JFXPlayer.java
===================================================================
--- tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/JFXPlayer.java	(revision 0)
+++ tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/JFXPlayer.java	(revision 3192)
@@ -0,0 +1,799 @@
+package org.txm.backtomedia.editors.player;
+
+import java.io.File;
+import java.net.Authenticator;
+import java.net.PasswordAuthentication;
+import java.time.LocalTime;
+import java.time.format.DateTimeFormatter;
+import java.util.concurrent.Semaphore;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Scale;
+import org.txm.backtomedia.commands.function.TripleRangeSlider;
+import org.txm.backtomedia.preferences.BackToMediaPreferences;
+import org.txm.utils.logger.Log;
+
+import javafx.application.Platform;
+import javafx.beans.InvalidationListener;
+import javafx.beans.Observable;
+import javafx.embed.swt.FXCanvas;
+import javafx.geometry.Insets;
+import javafx.scene.Group;
+import javafx.scene.Scene;
+import javafx.scene.layout.HBox;
+import javafx.scene.media.Media;
+import javafx.scene.media.MediaPlayer;
+import javafx.scene.media.MediaPlayer.Status;
+import javafx.scene.media.MediaView;
+import javafx.scene.paint.Color;
+import javafx.util.Duration;
+import vlcplayerrcp.MessagesMP;
+
+public class JFXPlayer extends Composite implements IPlayer {
+	
+	protected static final String NOMEDIA = ""; //$NON-NLS-1$
+	
+	private MediaPlayer jfxPlayer;
+	
+	//private GLComposite videoComposite;
+	
+	private Scale rateField;
+	
+	private Label rateValueLabel;
+	
+	private Scale volumeField;
+	
+	private Label volumeValueLabel;
+	
+	private Button playButton;
+	
+	private Button repeatButton;
+	
+	protected String currentlyPlayed = ""; //$NON-NLS-1$
+	
+	// private String startTime, endTime;
+	private int start, end;
+	
+	protected boolean hasEnded = false;
+	
+	private String previouslyPlayed = ""; //$NON-NLS-1$
+	
+	private boolean repeat = false;
+	
+	protected int volume = 100;
+	
+	private Button stopButton;
+	
+	Label timeLabel;
+	
+	TripleRangeSlider timeRange;
+	
+	boolean firstLengthEvent = true;
+	
+	long previous = 0;
+	
+	long time, mins, secs;
+	
+	public MediaPlayer getEmbeddedMediaPlayer() {
+		return jfxPlayer;
+	}
+	
+	Semaphore s = new Semaphore(1);
+	
+	private FXCanvas fxCanvas;
+	
+	Point previousP;
+	
+	protected boolean userStopped;
+	
+	public JFXPlayer(Composite parent, int style) {
+		super(parent, style);
+		this.setLayout(new GridLayout(11, false));
+		
+		// very important to avoid error when re-opening the player
+		javafx.application.Platform.setImplicitExit(false);
+		
+		// THE PLAYER
+		// if (RuntimeUtil.isMac()) {
+		// try {
+		// LibC.INSTANCE.setenv("VLC_PLUGIN_PATH", "/Applications/VLC.app/Contents/MacOS/plugins", 1);
+		// }
+		// catch (Exception ex) {
+		// ex.printStackTrace();
+		// }
+		// }
+//		videoComposite = new GLComposite(this, SWT.NONE, "Video");
+//		GridData gdata = new GridData(SWT.FILL, SWT.FILL, true, true);
+//		gdata.horizontalSpan = 11;
+//		videoComposite.setLayoutData(gdata);
+//		jfxPlayer = null;
+//		
+//		fxCanvas.addDisposeListener(new DisposeListener() {
+//			
+//			@Override
+//			public void widgetDisposed(DisposeEvent e) {
+//				if (jfxPlayer != null) {
+//					jfxPlayer.dispose();
+//					jfxPlayer = null;
+//					fxCanvas.setScene(null);
+//				}
+//			}
+//		});
+		
+		fxCanvas = new FXCanvas(this, SWT.BORDER);
+		GridData gdata2 = new GridData(SWT.FILL, SWT.FILL, true, true);
+		gdata2.horizontalSpan = 11;
+
+		fxCanvas.setLayoutData(gdata2);
+		
+		fxCanvas.addMouseListener(new MouseListener() {
+			
+			@Override
+			public void mouseUp(MouseEvent e) {
+				if (jfxPlayer != null) {
+					if (jfxPlayer.getStatus().equals(Status.PAUSED)) {
+						resume();
+					}
+					else if (jfxPlayer.getStatus().equals(Status.PLAYING)) {
+						pause();
+					}
+				}
+			}
+			
+			@Override
+			public void mouseDown(MouseEvent e) {}
+			
+			@Override
+			public void mouseDoubleClick(MouseEvent e) {}
+		});
+		
+		fxCanvas.addListener(SWT.Resize, new Listener() {
+			
+			@Override
+			public void handleEvent(Event e) {
+				resizeView();
+			}
+		});
+		
+		// THE CONTROL BUTTONS
+		playButton = new Button(this, SWT.PUSH);
+		GridData playLayoutData = new GridData(SWT.FILL, SWT.CENTER, false, false);
+		playButton.setLayoutData(playLayoutData);
+		playButton.setText(MessagesMP.play);
+		playButton.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				userStopped = false;
+				if (currentlyPlayed.length() == 0) {
+					selectMedia();
+					playButton.setText(MessagesMP.pause);
+					playButton.getParent().layout();
+				}
+				else if (jfxPlayer != null && jfxPlayer.getStatus().equals(Status.PLAYING)) {
+					pause();
+				}
+				else if (jfxPlayer != null && hasEnded) {
+					if (jfxPlayer == null) return;
+					replay();
+				}
+				else {
+					resume();
+				}
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		
+		// Button browseButton = new Button(this,SWT.PUSH);
+		// browseButton.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
+		// browseButton.setText("Open...");
+		// browseButton.addSelectionListener(new SelectionListener() {
+		// @Override
+		// public void widgetSelected(SelectionEvent e) {
+		// selectMedia();
+		// }
+		//
+		// @Override
+		// public void widgetDefaultSelected(SelectionEvent e) {}
+		// });
+		
+		stopButton = new Button(this, SWT.PUSH);
+		stopButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+		stopButton.setText(MessagesMP.stop);
+		stopButton.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				if (jfxPlayer != null) {
+					userStopped = true;
+					jfxPlayer.stop();
+				}
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		
+		timeLabel = new Label(this, SWT.NONE);
+		timeLabel.setText("00:00"); //$NON-NLS-1$
+		
+		timeRange = new TripleRangeSlider(this, SWT.None);
+		timeRange.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+		timeRange.setToolTipText(MessagesMP.time_range);
+		timeRange.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				TripleRangeSlider.SELECTED_KNOB sk = timeRange.getLastSelectedKnob();
+				switch (sk) {
+					case UPPER:
+						end = timeRange.getUpperValue();
+						
+						jfxPlayer.setStopTime(Duration.seconds(end));
+						if (end < time) {
+							// System.out.println("Upper changed: fix time");
+							time = end;
+							jfxPlayer.seek(Duration.seconds(time));
+						}
+						break;
+					case LOWER:
+						start = timeRange.getLowerValue();
+						jfxPlayer.setStartTime(Duration.seconds(start));
+						if (start > time) {
+							// System.out.println("Lower changed: fix time");
+							time = start;
+							jfxPlayer.seek(Duration.seconds(time));
+						}
+						break;
+					case MIDDLE:
+						
+						time = timeRange.getMiddleValue();
+						// System.out.println("Middle changed: fix time: " + time);
+						
+						jfxPlayer.seek(Duration.seconds(time));
+						
+						break;
+					default:
+						// nothing
+				}
+				// System.out.println("time range: "+start+" -> "+end+" time="+time);
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		
+		repeatButton = new Button(this, SWT.CHECK);
+		repeatButton.setText(MessagesMP.repeat);
+		repeat = BackToMediaPreferences.getInstance().getBoolean(BackToMediaPreferences.REPEAT);
+		repeatButton.setSelection(repeat);
+		repeatButton.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				repeat = repeatButton.getSelection();
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		
+		Label l = new Label(this, SWT.NONE);
+		l.setText(MessagesMP.rate);
+		
+		rateField = new Scale(this, SWT.BORDER);
+		GridData gdata4 = new GridData(SWT.FILL, SWT.CENTER, false, false);
+		gdata4.widthHint = 100;
+		rateField.setLayoutData(gdata4);
+		rateField.setMaximum(140);
+		rateField.setMinimum(70);
+		rateField.setSelection(100);
+		rateField.setPageIncrement(5);
+		
+		rateField.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				float rate = rateField.getSelection() / 100.0f;
+				jfxPlayer.setRate(rate);
+				rateValueLabel.setText("" + rateField.getSelection() + "%");
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		
+		rateValueLabel = new Label(this, SWT.NONE);
+		rateValueLabel.setText("100%");//$NON-NLS-1$
+		
+		l = new Label(this, SWT.NONE);
+		l.setText(MessagesMP.volume);
+		
+		volumeField = new Scale(this, SWT.BORDER);
+		gdata4 = new GridData(SWT.FILL, SWT.CENTER, false, false);
+		gdata4.widthHint = 100;
+		volumeField.setLayoutData(gdata4);
+		volumeField.setMinimum(0);
+		volumeField.setMaximum(100);
+		volumeField.setSelection(volume);
+		volumeField.setPageIncrement(5);
+		volumeField.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				jfxPlayer.setVolume(volumeField.getSelection());
+				volume = volumeField.getSelection();
+				volumeValueLabel.setText("" + volume + "%");
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		
+		volumeValueLabel = new Label(this, SWT.NONE);
+		volumeValueLabel.setText("100%");
+		
+		// vlcPlayer.events().addMediaPlayerEventListener(new MediaPlayerEventAdapter() {
+		//
+		// @Override
+		// public void opening(MediaPlayer mediaPlayer) {
+		// if (videoComposite.isDisposed()) return;
+		// Log.finer("Opening media...");
+		// }
+		//
+		// @Override
+		// public void finished(MediaPlayer mediaPlayer) {
+		// if (videoComposite.isDisposed()) return;
+		// Log.finer("Finished playing media...");
+		// if (repeat) {
+		// replay();
+		// }
+		// else {
+		// hasEnded = true;
+		// }
+		// }
+		// });
+		
+		
+		//
+		// vlcPlayer.events().addMediaPlayerEventListener(new MediaPlayerEventAdapter() {
+		//
+		// @Override
+		// public void timeChanged(MediaPlayer mediaPlayer, final long arg1) {
+		//
+		// }
+		//
+		// @Override
+		// public void lengthChanged(MediaPlayer mediaPlayer, final long arg1) {
+		// if (videoComposite.isDisposed()) return;
+		//
+		// if (firstLengthEvent) {
+		// firstLengthEvent = false;
+		//
+		// // initialize time range widget limits
+		// timeRange.getDisplay().syncExec(new Runnable() {
+		//
+		// @Override
+		// public void run() {
+		// if (timeRange.isDisposed()) return;
+		// timeRange.setMaximum((int) arg1);
+		// // if (start == end) end = (int)arg1;
+		//
+		// if (end > 0 && start != end) {
+		// timeRange.setUpperValue(end);
+		// }
+		// else {
+		// timeRange.setUpperValue((int) arg1);
+		// }
+		//
+		// timeRange.setLowerValue(start);
+		// // System.out.println("Range: "+start+" -> "+end+" song length "+arg1);
+		// }
+		// });
+		// }
+		// }
+		// });
+	}
+	
+	protected void resizeView() {
+		if (view != null) {
+			Point p = fxCanvas.getSize();
+			// if (previousP == null || (p.x != previousP.x && p.y != previousP.y)) { // ensure size changed
+			view.setFitHeight(p.y);
+			view.setFitWidth(p.x);
+			previousP = p;
+			// }
+		}
+	}
+	
+	public void resume() {
+		if (jfxPlayer != null) {
+			jfxPlayer.play();
+			playButton.setText(MessagesMP.pause);
+			playButton.getParent().layout();
+		}
+	}
+	
+	public void pause() {
+		if (jfxPlayer != null) {
+			jfxPlayer.pause();
+			playButton.setText(MessagesMP.resume);
+			playButton.getParent().layout();
+		}
+	}
+	
+	private void updateTimeLabel() {
+		mins = time / 60;
+		secs = (time) % 60;
+		timeLabel.setText(String.format("%02d:%02d", mins, secs)); //$NON-NLS-1$
+		timeLabel.update();
+	}
+	
+	public void replay() {
+		if (currentlyPlayed.length() > 0) {
+			jfxPlayer.seek(Duration.seconds(start));
+			playButton.setText(MessagesMP.pause);
+			playButton.getParent().layout();
+		}
+	}
+	
+	protected void selectMedia() {
+		Log.fine(MessagesMP.select_file);
+		
+		FileDialog fd = new FileDialog(JFXPlayer.this.getShell(), SWT.OPEN);
+		fd.setText(MessagesMP.select_file_title);
+		File f = new File(previouslyPlayed);
+		if (f.isDirectory()) fd.setFilterPath(f.getPath());
+		else fd.setFilterPath(f.getParent());
+		
+		String[] filterExt = { "*.*", "*.mp3", "*.mp4", "*.avi", "*.ogg", "*.ogv" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+		fd.setFilterExtensions(filterExt);
+		String selected = fd.open();
+		if (selected == null) {
+			System.out.println(MessagesMP.cancel);
+			return;
+		}
+		
+		currentlyPlayed = selected;
+		previouslyPlayed = selected;
+		Log.fine(MessagesMP.opening + currentlyPlayed);
+		play(new File(currentlyPlayed).toURI().toString(), 0, 0);
+	}
+	
+	/**
+	 * 
+	 * @param mrl
+	 * @param time msec start time
+	 * @param endtime msec end time
+	 */
+	@Override
+	public boolean play(String mrl, int time, int endtime) {
+		Log.fine(MessagesMP.bind(MessagesMP.playing, new Object[] { mrl, time, endtime }));
+		return play(mrl, "" + time, "" + endtime); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+	
+	@Override
+	public boolean play(String mrl, int time) {
+		return play(mrl, time, time);
+	}
+	
+	public void hideStopButton() {
+		if (this.stopButton != null && !this.stopButton.isDisposed()) {
+			this.stopButton.dispose();
+		}
+	}
+	
+	DateTimeFormatter hhmmssFormatter = DateTimeFormatter.ISO_LOCAL_TIME;
+	
+	private MediaView view;
+	
+	private Group group;
+	
+	private Scene scene;
+	
+	private String mrl;
+	
+	private Media media;
+	
+	@Override
+	public final void setCredentials(String login, String mdp) {
+		Authenticator.setDefault(new Authenticator() {
+			
+			@Override
+			public PasswordAuthentication getPasswordAuthentication() {
+				// System.out.println("PA: login=" + login + " mdp=" + mdp + " mrl=" + mrl + " req=" + getRequestingHost());
+				if (login != null && mdp != null && mrl.contains("://" + getRequestingHost() + "/")) {
+					return new PasswordAuthentication(login, mdp.toCharArray());
+				}
+				return null;
+			}
+		});
+	}
+	
+	/**
+	 * 
+	 * @param mrl
+	 * @param startTime "0.0" or ""hh:mm:ss" format
+	 * @param endTime "0.0" or ""hh:mm:ss" format
+	 */
+	@Override
+	public boolean play(String mrl, String startTime, String endTime) {
+		
+		if (mrl.contains("{0}:{1}@")) {
+			mrl = mrl.replace("{0}:{1}@", "");
+		}
+		
+		this.mrl = mrl;
+		if (startTime.matches("[0-9]+.[0-9]+")) {
+			start = (int) (Float.parseFloat(startTime));
+		}
+		else if (startTime.matches("[0-9]+:[0-9]+:[0-9]+")) {
+			if (startTime.indexOf(":") == 1) {
+				startTime = "0" + startTime;
+			}
+			LocalTime time1 = LocalTime.parse(startTime, hhmmssFormatter);
+			start = ((time1.getHour() * 60 * 60) + (time1.getMinute() * 60) + time1.getSecond());
+		}
+		
+		if (endTime.matches("[0-9]+.[0-9]+")) {
+			end = (int) (Float.parseFloat(endTime));
+		}
+		else if (endTime.matches("[0-9]+:[0-9]+:[0-9]+")) {
+			if (endTime.indexOf(":") == 1) endTime = "0" + endTime;
+			LocalTime time1 = LocalTime.parse(endTime, hhmmssFormatter);
+			end = ((time1.getHour() * 60 * 60) + (time1.getMinute() * 60) + time1.getSecond());
+		}
+		
+		// if (start == end) end = -1;
+		
+		Log.finer(MessagesMP.bind(MessagesMP.playing, new Object[] { mrl, startTime, endTime }));
+		// vlcPlayer.submit(new Runnable() {
+		//
+		// @Override
+		// public void run() {
+		// String[] options = { " :live-caching=200" }; // reduce video stream cache duration to 200ms
+		
+		Log.finer("Preparing media...");
+		try {
+			javafx.application.Platform.runLater(new Runnable() {
+				
+				@Override
+				public void run() {
+					Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
+						
+						@Override
+						public void uncaughtException(Thread t, Throwable e) {
+							System.out.println("JavaFX uncaught exception: " + e);
+						}
+					});
+				}
+			});
+			media = new Media(mrl);
+			if (jfxPlayer != null) {
+				try {
+					jfxPlayer.stop();
+				}
+				catch (Exception e) {
+					
+				}
+			}
+			
+			Platform.setImplicitExit(false); // This is important to avoid Thread exception when re-opening a player
+			jfxPlayer = new MediaPlayer(media);
+			
+			if (jfxPlayer.getError() == null) {
+				jfxPlayer.setOnError(new Runnable() {
+					
+					@Override
+					public void run() {
+						System.out.println("JFX Player Error:");
+						jfxPlayer.getError().printStackTrace();
+					}
+				});
+			}
+			else {
+				System.out.println("Warning: could not retrieve media error logger");
+			}
+			
+			//initializePlayerListeners();
+			jfxPlayer.setAutoPlay(false);
+			
+			view = new MediaView(jfxPlayer);
+			
+			HBox buttonSection = new HBox(view);
+		    buttonSection.setPadding(new Insets(2));
+			group = new Group(buttonSection);
+			//group.setAutoSizeChildren(true);
+			// scene = new Scene(group, Color.rgb(fxCanvas.getBackground().getRed(), fxCanvas.getBackground().getGreen(), fxCanvas.getBackground().getBlue()));
+			scene = new Scene(group, Color.rgb(0, 0, 0));
+			
+			fxCanvas.setScene(scene);
+			
+			//view.setPreserveRatio(true);
+		}
+		catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		}
+		
+		jfxPlayer.setOnReady(new Runnable() {
+			
+			@Override
+			public void run() {
+				
+				timeRange.setMinimum(0);
+				Duration d = jfxPlayer.getMedia().getDuration();
+				if (d.toSeconds() > 0) {
+					timeRange.setMaximum((int) d.toSeconds());
+				}
+				timeRange.setLowerValue(start);
+				timeRange.setMiddleValue(start);
+				
+				jfxPlayer.setVolume(volume);
+				
+				jfxPlayer.setStartTime(Duration.seconds(start));
+				//jfxPlayer.seek(Duration.seconds(start));
+				if (end > start) {
+					timeRange.setUpperValue(end);
+					jfxPlayer.setStopTime(Duration.seconds(end));
+				}
+				else if (d.toSeconds() > 0) {
+					timeRange.setUpperValue((int) jfxPlayer.getMedia().getDuration().toSeconds());
+				}
+				Log.info("Playing media: "+media.getSource());
+				
+				jfxPlayer.play();
+				//resizeView();
+				
+				// if (new File(mrl + ".srt").exists()) { //$NON-NLS-1$
+				// vlcPlayer.sub.subpictures().setSubTitleFile(mrl + ".srt"); //$NON-NLS-1$
+				// }
+				currentlyPlayed = JFXPlayer.this.mrl;
+				previouslyPlayed = JFXPlayer.this.mrl;
+				
+				if (!playButton.isDisposed()) {
+					playButton.setText(MessagesMP.pause);
+					playButton.getParent().layout(true);
+				}
+				firstLengthEvent = true;
+			}
+		});
+		
+		return true;
+	}
+	
+	private void initializePlayerListeners() {
+		
+		jfxPlayer.currentTimeProperty().addListener(new InvalidationListener() {
+			
+			@Override
+			public void invalidated(Observable ov) {
+				if (fxCanvas.isDisposed()) return;
+				if (jfxPlayer == null) return;
+				
+				Duration currentTime = jfxPlayer.getCurrentTime();
+				time = (int) currentTime.toSeconds();
+				if (previous == time) {
+					return;
+				}
+				previous = time;
+				
+				timeLabel.getDisplay().syncExec(new Runnable() {
+					
+					@Override
+					public void run() {
+						if (timeRange.isDisposed()) {
+							return;
+						}
+						if (!timeRange.isDragMiddleKnob()) {
+							timeRange.setMiddleValue((int) time);
+						}
+						updateTimeLabel();
+						
+						// if (time >= end && end != start) {
+						// if (repeat) {
+						// vlcPlayer.seek(Duration.seconds(start));
+						// }
+						// else {
+						// vlcPlayer.stop();
+						// }
+						// }
+					}
+				});
+			}
+		});
+	}
+	
+	@Override
+	public void setRepeat(boolean repeat) {
+		this.repeat = repeat;
+		if (this.repeat) {
+			jfxPlayer.setCycleCount(Integer.MAX_VALUE);
+		}
+		else {
+			jfxPlayer.setCycleCount(0);
+		}
+		if (!repeatButton.isDisposed()) {
+			repeatButton.setSelection(repeat);
+		}
+	}
+	
+	@Override
+	public void stop() {
+		if (jfxPlayer == null) return; // nothing to do
+		
+		
+		userStopped = true;
+		jfxPlayer.stop();
+		
+		jfxPlayer.dispose();
+		jfxPlayer = null;
+		if (!fxCanvas.isDisposed()) {
+			fxCanvas.setScene(null);
+		}
+		currentlyPlayed = NOMEDIA;
+		if (!playButton.isDisposed()) {
+			playButton.setText(MessagesMP.play);
+			playButton.getParent().layout();
+		}
+	}
+	
+	@Override
+	public boolean isMediaLoaded() {
+		return jfxPlayer != null && jfxPlayer.getStatus().equals(Status.READY);
+	}
+
+	@Override
+	public void seek(float time) {
+		
+		this.jfxPlayer.seek(Duration.seconds(time));
+	}
+
+	@Override
+	public void setVolume(double volume) {
+		
+		this.jfxPlayer.setVolume(volume);
+	}
+
+	@Override
+	public void setRate(float rate) {
+		
+		this.jfxPlayer.setRate(rate);
+	}
+
+	@Override
+	public boolean isPlaying() {
+		
+		return jfxPlayer.getStatus().equals(Status.PLAYING);
+	}
+
+	@Override
+	public void setStartTime(float seconds) {
+		
+		this.jfxPlayer.setStartTime(Duration.seconds(seconds));
+		
+	}
+
+	@Override
+	public void setStopTime(float seconds) {
+		
+		this.jfxPlayer.setStopTime(Duration.seconds(seconds));
+		
+	}
+
+}

Property changes on: tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/JFXPlayer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/IPlayer.java
===================================================================
--- tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/IPlayer.java	(revision 0)
+++ tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/IPlayer.java	(revision 3192)
@@ -0,0 +1,50 @@
+package org.txm.backtomedia.editors.player;
+
+public interface IPlayer {
+	
+	public void setCredentials(String login, String mdp);
+	
+	public boolean play(String mrl, String start, String end);
+	
+	public boolean play(String mrl, int start, int end);
+	
+	public boolean play(String mrl, int start);
+	
+	/**
+	 * unload the media
+	 */
+	public void stop();
+	
+	/**
+	 * 
+	 * @param time seconds with decimals
+	 */
+	public void seek(float time);
+	public void pause();
+	public void replay();
+	public void resume();
+	
+	public boolean isMediaLoaded();
+	
+	public void setRepeat(boolean b);
+	
+	public boolean isDisposed();
+	
+	/**
+	 * 
+	 * @param volume from 0 to 100
+	 */
+	public void setVolume(double volume);
+	
+	/**
+	 * 
+	 * @param rate from 0.1 to 1.0
+	 */
+	public void setRate(float rate);
+
+	public boolean isPlaying();
+
+	public void setStartTime(float seconds);
+	
+	public void setStopTime(float seconds);
+}

Property changes on: tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/IPlayer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/SimpleMediaExample.java
===================================================================
--- tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/SimpleMediaExample.java	(revision 0)
+++ tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/SimpleMediaExample.java	(revision 3192)
@@ -0,0 +1,67 @@
+package org.txm.backtomedia.editors.player;
+import javafx.application.Application;
+import javafx.geometry.Insets;
+import javafx.scene.Scene;
+import javafx.scene.control.Button;
+import javafx.scene.control.Label;
+import javafx.scene.layout.HBox;
+import javafx.scene.layout.VBox;
+import javafx.scene.media.Media;
+import javafx.scene.media.MediaPlayer;
+import javafx.scene.media.MediaView;
+import javafx.stage.Stage;
+  
+import java.nio.file.FileSystems;
+import java.nio.file.Path;
+  
+public class SimpleMediaExample extends Application {
+
+	@Override
+    public void start(Stage primaryStage) throws Exception {
+        // Set up the audio
+        Path mediaPath = FileSystems.getDefault().getPath("/HDD800GB/HDD/Vidéos/MOV_0656.mp4");
+        Media media = new Media(mediaPath.toUri().toURL().toExternalForm());
+        MediaPlayer mediaPlayer = new MediaPlayer(media);
+        MediaView view = new MediaView(mediaPlayer);
+        String name = mediaPath.getFileName().toString();
+        Label playingStatus = new Label("Now Playing: ");
+  
+        // Set the play and stop button
+        Button playButton = new Button("Play");
+        playButton.setPrefWidth(60);
+        Button stopButton = new Button("Stop");
+        stopButton.setPrefWidth(60);
+  
+        playButton.setOnAction(e -> {
+            if (mediaPlayer.getStatus() == MediaPlayer.Status.PLAYING) {
+                mediaPlayer.stop();
+                mediaPlayer.play();
+                playingStatus.setText("Now replaying: " + name);
+            } else {
+                mediaPlayer.play();
+                playingStatus.setText("Now playing: " + name);
+            }
+        });
+  
+        stopButton.setOnAction(e -> {
+            mediaPlayer.stop();
+            playingStatus.setText("Audio stopped");
+        });
+  
+        HBox buttonSection = new HBox(playButton, stopButton, view);
+        buttonSection.setSpacing(10);
+        buttonSection.setPadding(new Insets(15));
+  
+        VBox root = new VBox(playingStatus, buttonSection);
+        root.setPadding(new Insets(50));
+  
+        primaryStage.setTitle("Simple Media Example");
+        primaryStage.setScene(new Scene(root, 300, 300));
+        primaryStage.show();
+    }
+  
+    public static void main(String[] args) {
+        launch(args);
+    }
+  
+}
\ No newline at end of file

Property changes on: tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/SimpleMediaExample.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.backtomedia.rcp/plugin.xml
===================================================================
--- tmp/org.txm.backtomedia.rcp/plugin.xml	(revision 3191)
+++ tmp/org.txm.backtomedia.rcp/plugin.xml	(revision 3192)
@@ -125,9 +125,9 @@
    <extension
          point="org.eclipse.ui.editors">
       <editor
-            class="org.txm.backtomedia.editors.vlcplayer.MediaPlayerEditor"
+            class="org.txm.backtomedia.editors.player.MediaPlayerEditor"
             default="false"
-            id="org.txm.backtomedia.editors.vlcplayer.MediaPlayerEditor"
+            id="org.txm.backtomedia.editors.player.MediaPlayerEditor"
             name="%editor.name">
       </editor>
    </extension>
Index: tmp/org.txm.backtomedia.rcp/META-INF/MANIFEST.MF
===================================================================
--- tmp/org.txm.backtomedia.rcp/META-INF/MANIFEST.MF	(revision 3191)
+++ tmp/org.txm.backtomedia.rcp/META-INF/MANIFEST.MF	(revision 3192)
@@ -22,7 +22,7 @@
 Bundle-Vendor: %Bundle-Vendor
 Export-Package: org.txm.backtomedia.commands.function,
  org.txm.backtomedia.editors.input,
- org.txm.backtomedia.editors.vlcplayer,
+ org.txm.backtomedia.editors.player,
  org.txm.backtomedia.preferences,
  uk.co.caprica.vlcj.factory.swt,
  uk.co.caprica.vlcj.player.embedded.videosurface.swt,
