Play video and display an image at the same time

Hi all

I'm new to JavaFX and I would like to know if it is possible to read a video simultaneously and display an image above him in the same scene.

In particular, I want the image to display in a fixed position.

I tried to use a StackPane layout, but I get an error in the following line:

sp.getChildren().add(mediaPlayer);

because the mediaPlayer object cannot be considered to be a parameter and a node object is necessary

I also tried to add the video and the image in the same scene as seen below, without success (the video is playing, but the image is not displayed)

root.getChildren().add(imageView);

Is what I'm trying to do possible? And if so, what methods should I use?

Thanks in advance for any answer!

I tried to use a StackPane layout, but I get an error in the following line:

  1. sp.getChildren () .add (mediaPlayer);

because the mediaPlayer object cannot be considered to be a parameter and a node object is necessary

Wrap the mediaPlayer in a MediaView and add the media view to the container. Do not use a group as the component root as in the code example in the example, though.

I also tried to add the video and the image in the same scene as seen below, without success (the video is playing, but the image is not displayed)

I think it is because you are using a StackPane, that stacks on top of the other nodes (in the Z-order); so if you add the video first it will be hidden by the image. Use a different presentation pane: VBox is the simplest. The tutorial has a summary of all the components of integrated layout .

If you are going to do something like this:

public void start(Stage primaryStage) {
     Media media = new Media(...);
     MediaPlayer player = new MediaPlayer(media);
     MediaView mediaView = new MediaView(player);

     Image image = new Image(...);
     ImageView imageView = new ImageView(image);

     VBox root = new VBox(5);
     root.getChildren().add(mediaView);
     root.getChildren().add(imageView);

     Scene scene = new Scene(root);
     primaryStage.setScene(scene);
     primaryStage.show();
}

Tags: Java

Similar Questions

  • How to display multiple images at the same time in CS6?

    How to display multiple images at the same time in CS6?

    Hello

    If you go to window > reorganize you can choose from several display options. Below, I have chosen two horizontal spaces since I have two images, but you can select other options if you have more than one image.

  • How to hide a control and change a background image at the same TIME

    Hello

    I made a slideshow on LabView VI, who also monitors data in real time to a data logger.

    The program works like this: -.

    Start/Page 1:-bottom pane displays a nice screenshot. A set of indicators displays the data in real time. Switches to Page 2 after 20 seconds.

    Page 2:-background to an another screenshot. Hide indicators in real time and a set of three graphs appear, displaying historical data. Switches after 20 years.

    Page 3 etc:-hide charts and indicators, a 'slide show' appears by changing the history pane. Back to page 1 after the sequence.

    Everything works fine, except for one thing: I can't hide indicators and background to change at once, resulting in a clumsy "discrepancy" between the two.

    I did one VI example to illustrate this. Simply select two separate images to the façade, run the VI and toggle the Boolean control to see what I mean.

    Any idea how to get indicators and background of change at the same time?

    Thanks in advance,

    Hello

    Hi Jin,

    have you tried to "DeferPanelUpdates" when you power on? This is a property of the component...

    So David value = TRUE, do all the switching, to redefine Defer to FALSE!

  • iPhone 6 s - photo app does not allow users to take pictures and listen to music at the same time

    The repro steps:

    • iPhone 6 s - photo app does not allow the user to take pictures and listen to music at the same time

      Music app vs photo app

    (1) play a sound track in the music app
    (2) the swtich to app photo (on the "Photo" mode)
    (3) music stops

    Pandora app vs photo app

    1) turn on pandora
    2) switch to the camera on the 6s iphone app
    (3) stopping the music

    PLEASE FIX AS SOON AS POSSIBLE *.

    My iPhone stopped playing music when you take photos?

    Nothing to trouble since he was not taken in charge.

  • How to open two different images at the same time to work on it together please?

    Please help, I am at a loss to open the two images at the same time to work together on them. can someone help please

    I suspect that, in this point of you familiar with the functionality of Photoshop, you may prefer the following:

    Choose Preferences > Interface > and uncheck open as tabs Documents

    Then, when you open two images they both will appear on the screen.

    At a later time, you may want to work with her alternate: the tabs option.

  • Resizing of the images at the same time

    I have a lot of images I want to resize. The images are all rectangles and same size. I want the images to be smaller and square. Is there a quick way to do it with all the images at the same time?

    If your native images are rectangles and square, you must use the crop tool to get the defined areas. Otherwise, your images will appear distorted.  Unfortunately, batch cropping rarely works well less that all the images are perfectly framed and centered.  From my experience, cropping requires human judgment.

    That said, you can create a crop tool Preset (size & resolution) that can help further your workflow.

    Nancy O.

  • can I display different tables at the same time?

    Hi all

    It is probably a newbie question, but is it possible to display different tables at the same time? I use SQL Developer 1.5.5 and I seem to be unable to display several tables at the same time, whenever I chose to open another table, the old table disappears. In other words, the Bulletin Board only switches to your new choice in the table list navigation. Any ideas anyone?

    Kind regards
    WF

    Menu item "Tools-> Preferences-> database-> ObjectViewer Parameters"; Make sure that "automatically freeze object viewer Windows" is checked.

    HTH.

    Hrsg.:.

  • So, now that the iPhone 7 no longer a listener, how can we charge the iPhone and listen to music at the same time?  There is an adapter that will be a separator so that the two things are possible?

    So, now that the iPhone 7 no longer a listener, how will we be able to charge phone and listen to music at the same time?  Will it be a card which will be a dispatcher?

    You can use a dock of lightning to reload everything using plug the dock integrated headset for listening to music.

    http://www.MacRumors.com/2016/09/08/lightning-dock-iPhone-7-charging-with-music/

  • iPhone 7: how to charge and listen to music at the same time...

    The new iPhone is great! But a quick question that I can't find the answer to... In the car, I use the TomTom app and listen to the music on my phone. Because it must be reloaded when I use TomTom, I have a cable for music and one for the load. The new iPhone means that I can't load and listen to music at the same time? Or will there be some accessory available?

    Thank you!

    You can read what is known on the Apple site.

  • If I click on "PIN to the browser" the sensitive axis is unselected and vice versa. I need object "PIN at the top of the browser" and 'sensitive pine' work at the same time. Any suggestions?

    In the latest version of muse to adobe, I have me against "PIN at the top of the browser" and 'sensitive pine' work at the same time.

    Now if I choose an object and the axis 'browser', "sensitive pine" is unselected and vice versa.

    The need is for the header with the logo and menu bar to be pinned to the top of the browser, so that the page scrolls in the header bar.

    Now when I click on the sensitive left axis for the logo and the sensitive right pin for the navigation bar, the "pin at the top of the browser" gets deselected.

    Any suggestions or workarounds will be appreciated.

    Kind regards

    Vijay

    Hi all

    Thanks for that bring to our attention. We will consider adding this feature in the future.

    RyanDoyle - it's an interesting hack you have found! Unfortunately, I wouldn't count on that it works like this in the future, as a bug which is to operate. If you drag the screen to change the width of the browser as a Muse, you'll see that the behavior of the elements in the status button (a menu, for example) is different from when exported. However, if you make a small change to your hack, so it should always work: set button "width sensitive" State instead. In addition, I don't see why all parts must be in separate to this job state buttons, but I've only tried a simple example myself.

    An another workaround I used is to create another, more breakpoint. For example, if I have a menu that is pinned to the top left of the browser in the dots stop, then in a breakpoint, I would pin in the center top of the browser. Normally, I wouldn't add more breakpoints, but there is a way that I found to work around the problem. Ryan workaround is perhaps the best way to go if you take my advice and use a status button sensitive width instead of the width of the browser.

    Hope this helps,

    Anna

  • Buy two planes? Photographic for 9.99 and 19.99 Indesign at the same time? It s less expensive than 49.99 with applications and I only need this two software

    Buy two planes? Photographic for 9.99 and 19.99 Indesign at the same time? It s less expensive than 49.99 with applications and I only need this two software

    Hello

    Yes, you can buy the plan of photography as well as one app In-design under the same account.

    Please check the link for purchase https://creative.adobe.com/plans

    Please go through the Adobe - General conditions of subscription as well.

    Hope this helps!

  • I can't have multiple files open at the same time! I need to compare the content from one to the other. How to display two files at the same time?

    I can't have multiple files open at the same time! I need to compare the content from one to the other. How to display two files at the same time?

    Hi sindres79946597,

    Open Acrobat Reader DC, navigate to the Edit-> Preferences-> General-> uncheck "Open Documents in the new tab in the same window.

    Now, reboot your system, when you open multiple PDFs that all will open in a new window so that you can easily compare.

    Kind regards
    Nicos

  • Copy and paste multiple fields at the same time?

    Is it possible to copy and paste several fields at the same time as in the employment history section or reference to an employment application?

    Hello Glenn,.

    You can right click on the domain and select 'Copy field' and can then slide it into position suitable in the document so that in the preview page.

    Let me know if that helps!

    Kind regards

    -Usman

  • Template file - y at - it an easy way to update the files related to a model, and download them (put) at the same time?

    First of all, I am a user of Adobe software for 20 years now.  I love the adobe range. I want to just clarify.

    Question... Template Files - y at - it an easy way to update the files related to a model, and download them (put) at the same time?

    Its been bothering me since I started using Dreamwever 10 years now, when you use template files to create small, who later turn wholesale websites. Whenever I update a template file I have to find each file in the files Panel, then download them. When I navigate through a lot of directories to find it can get a lot of time and boring.  Whey cant be just a button that does it? See the attached file.

    Is there a way to do this?  Any help would be appreciated.

    Thank you very much

    Andy

    Dreamweaver-Updated-Template-File.jpg

    The sync tool should do what you want (second "circular arrows" icon in the files window).

    Who checks your files against the files of the current server and download all that is changed. By default, is also download any file from the server which is more recent than your local files at the same time, but you can set it to 'Put the latest files remotely' rather than 'get and put newer files' and you should be good to go.

  • Stream video to Apple TV and listen to music at the same time iMac

    Can I stream media (audio + video) for Apple TV and listen to music on my iMac at the same time? (While my TV and my iMac will play two different audio streams).

    For example, my parents would watch a movie of my iMac on their TV HARD drive (connected Apple TV via HDMI) while I work (or music) on my iMac.

    AppleTV can receive mirror airplay and can access a shared iTunes lib

    If you mirror the iMac to the appletv airplay it good mirror mac and not you won't be able to listen to or do something else as it would have mirrored to the appeltv too

    If you of the appletv access shared lib iTunes mac is free to be used for other things at the same time sharing iTunes lib works in the same way if it is the appletv that access or if it's another ios device or another computer

    You can read more

    https://www.Apple.com/support/iTunes/sharing/

    Use AirPlay to stream content from your iPhone, iPad or iPod touch - Apple Support Wireless

Maybe you are looking for

  • Problem with URL localhost Web Server page

    I can not open my Web server via the browser page, but he had a different address when I click it? When I click on it it gives me: file:///applications/XAMPP/xamppfiles/htdocs/mytestwebsite%20/index.htm If I want to open it, it should be sufficient t

  • Issues of user Firefox Touch base...

    I use FF Touch for a few days now - and love! Since I'd like even more when it is available in the Windows store so I can install it on my RT of Surface. However I have a few basic questions of the user:1. the only way I can find to access the Favori

  • Fastest FF?

    When FireFox will become as fast as Chrome?What do you do to make this happen? I like FF, but I must admit that C is faster and...

  • Child account connection issues

    Help, please! It's driving me crazy!  for months I tried to access my account of son microsoft to make some changes, but every time I try to connect its wonder like the p [aren't connect you and to allow him permission to use the account (which has b

  • First hard drive 0 not found on Dell Windows XP computer

    Original title: Hard Drive not found I have a Dell Dimension 4550 Series computer using Windows XP SP3.  At startup the following message now "Primary Hard Disk Drive 0 not found".  Only the option F1 or F2 gives me or what appears to be a viable sol