Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JavaFx and correct Media_URL for jpeg streamer /none media file extension stream

FivetideAug 11 2014 — edited Aug 13 2014

This is a problem I have with HTTP Live Streaming.

I’m new to java and programming.

I’m hoping someone can help me with this.

I have tried all sorts of different ways of adding the media stream url for JPEG-streamer but nothing seems to work.

I can get it to work with cambozola as a Java applet in HTML with this code :

<applet code=com.charliemouse.cambozola.Viewer

archive=cambozola.jar width="512" height="384" style="border-width:1;

border- color:gray; border-style:solid;">

<param name="url" value="http://pi:raspberry@192.168.0.16:8080/?action=stream">

</applet>

and I have followed the tutorial

@ Incorporating Media Assets Into JavaFX Applications: Embedding Media Into a Web Page | JavaFX 2 Tutorials and Documentat…

and the standard video plays fine with this code

package embeddedmediaplayer;

import java.io.File;

import javafx.application.Application;

import javafx.scene.Group;

import javafx.scene.Scene;

import javafx.scene.media.Media;

import javafx.scene.media.MediaPlayer;

import javafx.scene.media.MediaView;

import javafx.stage.Stage;

/**

*

* @author Five

*/

public class EmbeddedMediaPlayer extends Application {

private static final String MEDIA_URL

= "http://download.oracle.com/otndocs/products/javafx/oow2010-2.flv";

// I want to replace the above URL with my media stream http://pi:raspberry@192.168.0.16:8080/?action=stream

@Override

public void start(Stage primaryStage) {

primaryStage.setTitle("Embedded Media Player");

    Group root = new Group();

    Scene scene = new Scene(root, 540, 210);

primaryStage.setScene(scene);

    // create media player

    Media media = new Media(MEDIA_URL);

    MediaPlayer mediaPlayer = new MediaPlayer(media);

mediaPlayer.setAutoPlay(true);

    // create mediaView and add media player to the viewer

    MediaView mediaView = new MediaView(mediaPlayer);

    ((Group) scene.getRoot()).getChildren().add(mediaView);

primaryStage.show();

    }

}

I also tried another method shown in stack overflow of

private final File file =

new File("http://pi:raspberry@192.168.0.16:8080/?action=stream");

private final String MEDIA_URL = file.toURI().toString();

Media media = new Media(MEDIA_URL);

This method did not work just returned a blank box.

So my problem is http://pi:raspberry@:8080/?action=stream I have read on the site about using a dummy jpeg ?

But don’t know how to implement that or if it will work.

Any help would be much appreciated.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 10 2014
Added on Aug 11 2014
2 comments
1,952 views