Play a local file using URLDataSource

Hi,
I need to play a local video file using URLDataSource, but i dont know why im getting the next error: Error loading the video: NoPlayerException. Cannot find a player.
But, with a file video on internet it works perfectly.
import javax.media.protocol.URLDataSource;
import java.net.URL;
import java.io.*;
public class TestDataSource extends URLDataSource {
     TestDataSource (URL url) throws IOException{
          super(url);
import java.awt.*;
import java.awt.event.*;
import java.util.Vector;
import java.io.*;
import javax.swing.*;
import javax.media.*;
import javax.media.protocol.ContentDescriptor;
import javax.media.protocol.DataSource;
import javax.media.protocol.URLDataSource;
import java.net.URL;
public class VideoPlayer extends JFrame {
     Player player = null;
     private JPanel contentPane;
     TestDataSource mcds = null;
     public static void main(String args[]){     
          String locator = "C:/video.avi";
          (new VideoPlayer(locator)).setVisible(true);
     public VideoPlayer(String locator) {
          super("Example");
          setSize(400,400);
          contentPane = (JPanel) this.getContentPane();
          addWindowListener(new myWindowAdapter());
          File file = new File(locator);
          URL url = null;
          try{
               if(file.exists()){
                    url = file.toURI().toURL();
                    System.out.println("exist");
          }catch(Exception e){
               System.err.println("Error: "+e);
          try{
               mcds = new TestDataSource(url);
               mcds.connect();
          }catch(Exception e){
               System.err.println("Error: "+e);
          try {
               player = Manager.createPlayer(mcds);
               player.addControllerListener(new controllerUpdate());
          }catch(Exception e){
               System.err.println("Error loading the media. ("+e+")");
          if(player != null) player.realize();      
     class controllerUpdate implements ControllerListener {      
          public synchronized void controllerUpdate(ControllerEvent e) {      
               if(e instanceof RealizeCompleteEvent) {
                    Component visualArea = player.getVisualComponent();      
                    Component controlPanel = player.getControlPanelComponent();      
                    if(visualArea!= null)      
                         contentPane.add(visualArea, BorderLayout.CENTER);      
                    if(controlPanel != null)      
                         contentPane.add(controlPanel, BorderLayout.SOUTH);      
                    validate();      
                    player.prefetch();
               if(e instanceof PrefetchCompleteEvent) {
                    player.start();
     class myWindowAdapter extends WindowAdapter {
          public void windowClosing(WindowEvent e){
               if(player != null) player.close();
                    System.exit(0);
}Sorry for my bad english
Thanks in advance

vagosvagos wrote: I need to play a local video file using URLDataSource, but i dont know why im getting the next error: Error loading the video: NoPlayerException. Cannot find a player.
But, with a file video on internet it works perfectly.
The difference is not between file system and internet, it is the format of the file itself that is the problem. When I run your code here, the only (significant) difference in this line..
String locator = "C:/video.avi"; .. and it works perfectly. I used the file you originally linked to on the internet (I had downloaded it to work with the earlier example - since my connection is sooo slow), so it became..
String locator = "dsr_arrow.mpg"; The problem in this case is that apparently that AVI was encoded using a codec that JMF does not support.
Check the [JMF Supported Formats|http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/formats.html] page for further details of the codecs or media types that JMF will recognize.
What encoding is your AVI?

Similar Messages

  • Capturing EPC error List into a local file using BDC

    Can anyone let me know the Code for downloading the EPC check Results into a local File using BDC...[<b></b>

    You can use the function module
    EXTENDED_PROGRAM_CHECK to get the errors and warnigs of a epc for a program.
    then you can download that internal table information using GUI_DOWNLOAD fm.
    Regards,
    Ravi

  • How to browse local file using web dynpro

    hi everyone
    How can I browse local file using Web Dynpro?And read file names into Context or array. I have tried the following code but its not working
    String resourcePath = WDURLGenerator.getResourcePath();
    String depObjResourcePath = WDURLGenerator.getResourcePath(“Test”);
    WDDeployableObjectPart appPart = WDDeployableObject.getPart(“Test”, “TestApp”, WDDeployableObjectPart.APPLICATION);
    help required urgently
    Thanks & Regards
    Jaspreet Kaur

    Reply in
    how to browse local file using web dynpro
    Regards,
    Ashwani Kr Sharma

  • Heading  during downloading into local file using GUI_DOWNLOAD fun.module

    Hi Guru's
    we have a requirement that we want the plant description as a heading (first line of the file) in the local file. iam using "GUI_DOWNLOAD" function module for downloading data for which iam passing the charecter type internal table. before downloading iam passing all the filed headings to that table and then appending the internal table data into it. now iam getting data properly with field headings . but before that heading i want one more description for a plant field which iam using in my selection screen
    in the fun.module "GUI_DOWNLAOD"
    we have HEADER file but it is of XSTRING type so it is taking only 2 char.
    so how to use this . Plz help me.
    thanks well in advance.
    UR's
    GSANA

    Hi,
    Please check the below link,
    header in 'gui_download'
    Also check Manoj kumar's reply in the link,
    header information to gui_download
    Hope this helps.
    Best Regards.

  • How do I get itunes to play the local file instead of streaming it?

    I have my iTunes Library on an external FW800 drive.  Recently I didn't realize the drive was not attached and tried to play a song.  iTunes couldn't find the file and started streaming it from iTunes Match.  I've since reattached the drive, but iTunes won't recognize the local file.
    Is there a way to get iTunes to recognize the existing local file or is my only option to redownload the file and delete the old one?

    Hi,
    Close Itunes and then hold option key whilst launching Itunes. Select choose library from pop and select the library on your external drive.
    Jim

  • File open menu will not open local files using open command but the same files will open if I double click them (permissions seem fine)

    Under File menu Open File will not open local files even those downloaded to the desktop by Firefox 5.
    If I double click on HTML file it does open
    Reinstalled. Same behaviour. Default Browser set correctly.
    Permissions set correctly. Odd behaviour.

    Are you sure it hasn't imported?
    Check for the track names (trackname only, not Album or Artist)) and see if they have a blank Artist and Album, because WAV files have no MetaData, so are kind of stupid as far as knowing anything about the Artist, Album & track id.
    You can't search by 'Untitled' either as there is literally, no name at all, but iTunes does pick up the actual physical track name in Finder and uses that. As an example, if you renamed your Aerosmith WAV file from say 'Toys In The Attic' to 'Love Song' it would import the track as 'Love Song' as that's all it can go by.
    There are a few iTunes AppleScripts that let you import from a file of WAV music, by looking at the enclosing Album in the enclosing Artist as that's how most PC progs create the WAV file structure.
    Mike

  • Walkman : how to play only local files and no network related media.

    Hello All.
    The Walkman app is a nice player.
    But...how can i configure it that it only shows local files on my sdcard1 ?
    I don't want to use network streaming, i just want to listen to my local stored (huge) collection flac files.
    Is disabling 'music unlimited' all i need to do? (i use a €3,- for 3 months action from playstation4)
    ∆○×□ PSP1004 (Phat 1st gen.) 5.00 M33-6 (+1.50) + 32GB Pro-Duo.
    ∆○×□ PS4 1.7X + 500GB hdd + Dualshock4 + PS4 Camera,
    Xperia-Z1 Android 4.4.X + 32GB microSD + Philips SHB9100
    Solved!
    Go to Solution.

    Thanks for the fast reply.
    Cool, it saves my mobile data bundle when i'm on the bike. (out of wifi range)
    I was a bit confused about artists i don't know, but those are the demo songs, i'll remove them using AndExplorer.
    ∆○×□ PSP1004 (Phat 1st gen.) 5.00 M33-6 (+1.50) + 32GB Pro-Duo.
    ∆○×□ PS4 1.7X + 500GB hdd + Dualshock4 + PS4 Camera,
    Xperia-Z1 Android 4.4.X + 32GB microSD + Philips SHB9100

  • Download local file using Servlet and JSP

    Hello,
    I will like to use a browser to download file on local system using serlvet and Jsp technology. Does anyone have any idea how to do it?
    Any comment will be appreciate.
    Thanks

    Well you can just put the file in a folder that is accessible to the web server. Then have a link point to that file. That will cause the web browser to download the file.
    hattan

  • Opening local files using a URLRequest

    is it possible to open a file from say C drive when your flash file is in C:\somefolder?

    I suppose if it's in the same folder as the requesting swf you can, but after that you're likely to run into sandbox security issues that you would have to deal with. Here's a fuller discussion of what's happening in Flash 10, which opens some possibilities:
    http://www.mikechambers.com/blog/2008/08/20/reading-and-writing-local-files-in-flash-playe r-10/

  • How to play Windows AVI file using Teststand

    Hi,
    I'm trying to play a Windows AVI (*.avi) file using the Windows Media Player, launched by
    a Teststand CallExecutable type step.
    When the step executes, the Windows Media Player app. starts o.k., but the file to be played
    causes an error which states the file type is not recognised.
    Yet if the AVI file is selected in Windows Explorer, it runs fine, i.e. the file type is associated with
    Windows Media Player.
    If the 1st error is ignored, a 2nd is displayed. This states the file cannot be played, and suggests that
    the path may be incorrect or the server is unavailable.
    When configuring the Teststand CallExecutable step, the Argument Expression field contains the full
    absolute address of the AVI (*.avi) file to load and play.
    I have also tried using an expression and also placing the AVI file in the same directory as the
    Windows Media Player .exe, but the file will still not play.
    If I use the Run utility from the Windows Start menu, I can enter the same details on a single command
    line, and the AVI (*.avi) loads and plays just fine.
    What should I do to get Windows Media Player to run the AVI (*.avi) file using the Teststand CallExecutable step ?
    thanks,
    Gary.

    Gary -
    FYI, with TS 3.5, the MessagePopup step can also display html files. The html file can reference the player control and tell it to run immediately. The html code looks like this:
    <HTML>
    <HEAD>
    <TITLE>Multimedia Control Page</TITLE>
    </HEAD>
    <BODY LANGUAGE = VBScript>
    <p>
    My header text
    <p>
    <object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA​6" id="WindowsMediaPlayer1" width="300" height="200">
     <param name="URL" value="c:\windows\clock.avi">
     <param name="rate" value="1">
     <param name="balance" value="0">
     <param name="currentPosition" value="0">
     <param name="defaultFrame" value>
     <param name="playCount" value="1">
     <param name="autoStart" value="-1">
     <param name="currentMarker" value="0">
     <param name="invokeURLs" value="-1">
     <param name="baseURL" value>
     <param name="volume" value="50">
     <param name="mute" value="0">
     <param name="uiMode" value="full">
     <param name="stretchToFit" value="-1">
     <param name="windowlessVideo" value="0">
     <param name="enabled" value="-1">
     <param name="enableContextMenu" value="-1">
     <param name="fullScreen" value="0">
     <param name="SAMIStyle" value>
     <param name="SAMILang" value>
     <param name="SAMIFilename" value>
     <param name="captioningID" value>
     <param name="enableErrorDialogs" value="0">
    </object>
    </p>
    My footer text
    </BODY>
    </HTML>
    Scott Richardson
    National Instruments

  • Open local file using fileReference in AIR

    I just started to build an AIR application and am facing a
    very basic problem. I need a File->Open menu that pops up a file
    open dialog and returns the location (including folder) of a file
    to edit.
    - I tried the fileReference.browse() but this does not seem
    to provide the full path to the file
    - I tried fileReferenceList.browse() but the SELECT event
    does not fire on my Mac under (seem to be a bug reported last
    October:
    http://bugs.adobe.com/jira/browse/SDK-13220)
    Now, how can I achieve this in AIR? I assume opening local
    file is a pretty standard operation for desktop application, any
    suggestion/tip?
    thanks
    *P

    You don't want to use FileReference in AIR for what you are
    doing. Check the documentation for the mx.controls.FileSystemTree.
    There are actually a handful of AIR-specific controls for accessing
    the file system. There isn't a "File Open" dialog per se; you can
    build your own out of the controls given. I will say that the
    controls will have the flavor of the OS (so on a Mac the controls
    will behave similarly to the way a Mac accessses and browses for
    files).

  • How to play an audio file using applicationMusicPlayer ?

    It's easy to play a file using AVAudioPlayer
    NSBundle *mainBundle = [NSBundle mainBundle];
    NSError *error;
    NSURL *tickURL = [NSURL fileURLWithPath:[mainBundle pathForResource:@"tmp" ofType:@"amr"]];
    tickPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:tickURL error:&error];
    [tickPlayer play];
    But how to play a file using applicationMusicPlayer?
    I know setQueueWithItems, but how to prepare the items for it?

    seems not a good question

  • Can't play a local file in firefox

    I'm trying to have a src for an embedded quicktime object on a page be a file on my local drive. it works fine when using IE, but the pluginstatus stays at 'waiting' when i test in firefox.
    to view the problem, go to http://veotag.blenderbox.com/create/ in firefox and select a local .mov file and click next. the file will not play. If you do the same thing in IE, the file plays, no problem.
    has anyone seen this before? do i need to add some parameter to the embed tag?
    PLEASE HELP!!!
    thanks
    Dell   Windows XP Pro  

    From the first page:
    Please note: Since this is a beta launch, there are a few features we are still working on.
    Veotag is currently only compatible with Windows Media and Flash Video, however, a number of new features including support for Quicktime and Real Media are coming soon.
    More trouble for such tools:
    http://developer.apple.com/internet/ieembedprep.html

  • Unable to open local file using af:goLink and anchor link in JSF page.

    Hi,
    I want to open a file at a perticular location on client machine. I am using af:goLink to openg the file. But when i tried to click on the link it is not opening the file. If i give any other value like name of other site, it opens the link. It is not giving any exception also. I tried by puting notmal HTML anchor link. That is also not working. But if i put this anchor link in normal HTML page, it works.
    Following is the JSPX page that i have created. Here c:\dmmsi.log is a temp file on my local system.
    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=windows-1252"/>
    <f:view>
    <af:document title="File Upload">
    <af:form usesUpload="true">
    File Uploader Test
    <af:inputFile label="Input File" autoSubmit="true"/>
    <af:spacer height="20" width="50"/>
    <af:goLink targetFrame="_new" destination="file:///c:/dmmsi.log" text="Test"/>
    <af:spacer height="20" width="50"/>
    <!--a id="you" href="c:\dmmsi.log" target="_new">Open File</a-->
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>
    HTML Page i tried using anchor link
    <html>
    <body>
    <form>
    Please specify a file from your local machine</b>
    <input name="file" type="file" onblur="document.forms[0].hello.value = document.forms[0].file.value; document.getElementById('you').innerHTML =document.forms[0].file.value; document.getElementById('you').href = 'file://'+document.forms[0].file.value;">
    <br><br>
    <input type="text" name="hello" value="">
    <br><br>
    <!-- a id="you" href="c:\dmmsi.log" target="_new">Click Me to Open file< / a -->
    </form>
    </body>
    </html>
    (Note: Please remove the comments that i have added in creating anchor link. I was facing some issue in putting my code in this editor. It was creating the HTML link when i see the preview.)
    I hope you will be able to reproduce my problem.
    Sujay

    What version of IE are you using? IIRC, IE 7 is supposed to prompt you. ("The web site is attempting to open a page in your Trusted Zone. This can let hax0rs pwnz0r you. Continue?" or something to that effect.)
    If you use the verbatim tags, do you get an actual error message? That might help diagnose the problem.

  • How to read a local file using as3 in a flash object in HTML? [urgent]

    My web site contains a flash object.
    I want to use as3 to read some local .txt file
    by getting the user directory of the file.
    i know AIR can support this by sth like:
    File.desktopDirectory.resolvePath
    but when i open a AIR file for this, it seems
    the action cant be run when i embed it in html.
    And i tried to use the above function in a normal
    flash file in the action script.
    But it cant recognize the File. class..
    How can it be done ?
    It's reli urgent,
    please help...
    Thanks !

    a web based flash app can't detect user directories.  you can use the filereference class'es browse method to let the user locate a file in any directory the user wants.  flash can then retrieve the file's name and type.  but, as mentioned before,  flash can't determine the file's directory.

Maybe you are looking for

  • Error Calling Web Service from ADF (Fusion 11g)

    Hello, I am getting the below error message in the IE while running ADF application from JDeveloper 11g Application Details: 1. Developed a Web Services Data Control (Web Service is from Oracle Applications R12 Integrated SOA Gateway) 2. Added a JSF

  • Issue with eth0 interface

    Have a rh9 system, with /etc/sysconfig/network-scripts/ifcfg-eth0 contents : DEVICE=eth0 IPADDR=140.... NETMASK=255.255.254.0 BROADCAST=140... GATEWAY=140.... BOOTPROTO=static ONBOOT=yes During system bootup, eth0 never comes up automatically. "servi

  • ITunes has stopped working error message while downloading iOS 5

    I am having issues with iTunes stopping while im in the middle of the new iOS 5 download. It never fails while im just using itunes for anything except downloading the new software. Im not sure how to fix it and im hoping someone else might be able t

  • Selection Screen skipped in RSRT/BEX

    We have upgraded our systems to BI7. In the upgrade checkouts - we are facing this issue - While running a query through RSRT or BEX, the selection screen is skipped and the results in an error saying.. 'Variables contain invalid..' However it runs f

  • Sales Order Confirmation through Email

    Dear Friends, Can i ask you to give me a quick idea on what need to be done to establish the functionality to send the order confirmation through emails. Thanks in advance. Ravi