×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Super Contributor
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    814

    MediaException: cannot create player (while trying to play a midi)

    Hi all,

    i am trying to play a midi file, using an s60 emulator, and i get a
    javax.microedition.media.MediaException: cannot create player.
    bellow is the code i use.
    replacing the midi by a wav, it works, so i don't understand.
    i checked the supported content types, and midi is supported, and also resource is a protocol that suports midi.
    Code:
        try{
    //i tried this
    		Player p = (Manager.createPlayer("resource:/Nintendo_Tetris_Intro_19371.mid"));
    //and this
    InputStream in = getClass().getResourceAsStream("/Nintendo_Tetris_Intro_19371.mid");
    		Player p = Manager.createPlayer(in, "audio/midi");
    
    		p.realize();
    		p.prefetch();
    		
    		p.setLoopCount(1);
    		p.setMediaTime(0);
    		p.start();
    	}catch(Exception me){
    		me.printStackTrace();
    		me.getMessage();
    	}
    the file is found, but the player cannot be created, which i don't understand
    Thanks for any help

  2. #2
    Registered User
    Join Date
    Mar 2005
    Posts
    3
    Be careful by using setMediaTime(0); This could also throw an exception.
    /Brian

  3. #3
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Moscow/Russia
    Posts
    258
    Perhaps the name of your resource is too long for S60

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×