playing/viewing file from a url

I have looked over the url tutorials in the java tutorials, and i was wondering if it is possible to play a file from a url. for instance. have a videoplayer, and give it a file to play that is a url. i didn't test the below code but it was an idea of what i was thinking, just modified how to display a webcam.

i am basically looking for a way to play or stream a video file from one computer to another, thought this might work. if not anyone can point me to a better way. thanks.

also would like to do the same thing with sound and images if possible

try{

//CaptureDeviceInfo device = getMyWebCam();

MediaLocator ml = url?//device.getLocator();

player = Manager.createRealizedPlayer(ml);

player.start();

Component videoScreen = player.getVisualComponent();

pnVideo.setLayout(new BorderLayout());

if(player !=null && videoScreen !=null){

pnVideo.add(videoScreen);

System.out.println("added visual component");

pnVideo.add(player.getControlPanelComponent(), BorderLayout.SOUTH);

}

}catch(Exception e){

JOptionPane.showMessageDialog(null,"You have not connected your webcam");

System.out.println(e);

}

Message was edited by:

developprograms

[1753 byte] By [developprogramsa] at [2007-11-27 3:42:49]
# 1

I have looked over the url tutorials in the java tutorials, and i was wondering if it is possible to play a file from a url.

Yes

for instance. have a videoplayer, and give it a file to play that is a url. i didn't test the below code but it was an idea of what i was thinking, just modified how to display a webcam.

Ok, url coult be:

URL("file:///c:\mymusics\redhotchilipeppers\scartissue.mp3") come from a file (protocol file)

URL("rpt://192.168.1.5:5858/audio/1") como from streaming Rtp protocol

....

i am basically looking for a way to play or stream a video file from one computer to another, thought this might work. if not anyone can point me to a better way. thanks.

also would like to do the same thing with sound and images if possible

this can works.

Player pl = null ;

pl = Manager.createPlayer("file:///c:\files\video.avi");

pl.start();

I hope help you.

player.start();

dreampeppers99a at 2007-7-12 8:46:26 > top of Java-index,Java Essentials,New To Java...
# 2
pl = Manager.createPlayer("file:///c:\files\video.avi");will that work with this...(i know not proper syntax but the idea is there)URL("rpt://192.168.1.5:5858/audio/1") pl = Manager.createPlayer(URL);thanks for your help
developprogramsa at 2007-7-12 8:46:26 > top of Java-index,Java Essentials,New To Java...
# 3
It works to you?
dreampeppers99a at 2007-7-12 8:46:26 > top of Java-index,Java Essentials,New To Java...
# 4
this site will help you more than me. http://www.cs.odu.edu/~cs778/jmflects/
dreampeppers99a at 2007-7-12 8:46:26 > top of Java-index,Java Essentials,New To Java...