*There are no null fields in the Media block that launch the MediaPlayer*

I have researched this extensively and have found nothing to explain this error.

I am building a Java Swing application for a class project and am attempting to use the JFX panel and media player to host and play several mp4 videos. I have successfully got it working one time through however when I come back to the window again I run into the error.

> 
> java.lang.NullPointerException at
>  com.sun.media.jfxmediaimpl.platform.gstreamer.GSTMediaPlayer.playerSetBalance(Unknown
>  Source) at
>  com.sun.media.jfxmediaimpl.NativeMediaPlayer.setBalance(Unknown
>  Source) at javafx.scene.media.MediaPlayer.init(Unknown Source) at
>  javafx.scene.media.MediaPlayer.(Unknown Source) at
>  project.screens.TutorialPlayerScreen.initMediaPlayer(TutorialPlayerScreen.java:156)
>  at
>  project.screens.TutorialPlayerScreen.init(TutorialPlayerScreen.java:122)
>  at
>  project.screens.TutorialPlayerScreen.(TutorialPlayerScreen.java:113)
>  at
>  project.buttons.PreKModuleSelectTutorialButtons$Button$7.doAction(PreKModuleSelectTutorialButtons.java:225)
>  at
>  project.screens.PreKModuleSelect.clicked(PreKModuleSelect.java:359)
>  at project.tools.ContentPane.notifiyObserver(ContentPane.java:457)
>  at project.tools.ContentPane$1.mousePressed(ContentPane.java:272) at
>  java.awt.Component.processMouseEvent(Unknown Source) at
>  javax.swing.JComponent.processMouseEvent(Unknown Source) at
>  java.awt.Component.processEvent(Unknown Source) at
>  java.awt.Container.processEvent(Unknown Source) at
>  java.awt.Component.dispatchEventImpl(Unknown Source) at
>  java.awt.Container.dispatchEventImpl(Unknown Source) at
>  java.awt.Component.dispatchEvent(Unknown Source) at
>  java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at
>  java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at
>  java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at
>  java.awt.Container.dispatchEventImpl(Unknown Source) at
>  java.awt.Window.dispatchEventImpl(Unknown Source) at
>  java.awt.Component.dispatchEvent(Unknown Source) at
>  java.awt.EventQueue.dispatchEventImpl(Unknown Source) at
>  java.awt.EventQueue.access$500(Unknown Source) at
>  java.awt.EventQueue$3.run(Unknown Source) at
>  java.awt.EventQueue$3.run(Unknown Source) at
>  java.security.AccessController.doPrivileged(Native Method) at
>  java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown
>  Source) at
>  java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown
>  Source) at java.awt.EventQueue$4.run(Unknown Source) at
>  java.awt.EventQueue$4.run(Unknown Source) at
>  java.security.AccessController.doPrivileged(Native Method) at
>  java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown
>  Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at
>  java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
>  at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
>  at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
>  Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>  at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at
>  java.awt.EventDispatchThread.run(Unknown Source)
> 
> 
> 

Here is the code I used to start the JFX media:

' //Media Player Support
 private Group mediaRoot;
 private Scene mediaScene;

```
private Media tutorialVideo;
private MediaPlayer VideoPlayer;
private MediaView mediaViewer;
private JFXPanel fxPanel;

private int jfxPanelHeight = 394;//525;
private int jfxPanelWidth = 700;//700;

private void initMediaPlayer() throws IOException {
    this.fxPanel = new JFXPanel(); //initializes JFX variables
    fxPanel.setSize(this.jfxPanelWidth ,this.jfxPanelHeight);

    //Add JFX Panel component to the Main Window
    int padding = ((mainWindow.getPreferredSize().width - this.jfxPanelWidth) / 2);
    mainWindow.addLayer(fxPanel, MEDIA_LAYER, padding, 125);

    //Initialize FX Panel
    this.mediaRoot = new Group();
    this.mediaScene = new Scene(this.mediaRoot, 0, 0);

    //Open/prepare the file
    //String tutorialFilePath = new File("").getAbsolutePath() + DIRECTORY_PATH + "Tutorial.mp4";
    String tutorialFilePath = new File("").getAbsolutePath() + MEDIA_PATH + this.observer.getName() +"Tutorial.mp4";
    File mediaFile = new File(tutorialFilePath);
    this.tutorialVideo = new Media(mediaFile.toURI().toString());

    //Create the media player
    this.VideoPlayer = new MediaPlayer(this.tutorialVideo);  //Error here
    this.VideoPlayer.setAutoPlay(false);

    this.mediaViewer = new MediaView(this.VideoPlayer);
    this.mediaViewer.setFitHeight(this.jfxPanelHeight);
    this.mediaViewer.setFitWidth(this.jfxPanelWidth);
          ((Group)this.mediaScene.getRoot()).getChildren().add(this.mediaViewer);

    fxPanel.setScene(this.mediaScene);
}'

```

I attempt to clean up the used memory before leaving the screen. 

```
public void tearDown(){

    //Stop the JFX Player and Remove
    this.mainWindow.removeLayer(this.fxPanel);
    this.VideoPlayer.stop();
    this.VideoPlayer.dispose();
    this.fxPanel.removeAll();
    this.mediaRoot.getChildren().removeAll();

    this.mediaRoot = null;
    this.mediaScene = null;
    this.mediaViewer = null;
    this.tutorialVideo  = null;
    this.VideoPlayer = null;
    this.fxPanel = null;
}

private JLayeredPane contentPane;    //The content pane of this JFrame.
public void removeLayer(JComponent component) {
    contentPane.remove(component);
    contentPane.revalidate();
    contentPane.repaint();
}

```

Any help or comment would be much appreciated! Thank you!