MID ÇÁ·ÎÇÊ

Package javax.microedition.media

MIDP 2.0 Media API´Â Mobile Media API (JSR-135) »ç¾çÀÇ Á÷Á¢ ȣȯ °¡´ÉÇÑ ºôµù ºí·ÏÀÔ´Ï´Ù.

See:
          Description

Interface Summary
Control Control °´Ã¼´Â ÀϺΠ¹Ìµð¾î ó¸® ±â´ÉÀ» Á¦¾îÇÏ´Â µ¥ »ç¿ëÇÕ´Ï´Ù.
Controllable ControllableÀº Player¿Í °°Àº °´Ã¼¿¡¼­ ControlÀ» °¡Á®¿À±â À§ÇÑ ÀÎÅÍÆäÀ̽º¸¦ Á¦°øÇÕ´Ï´Ù.
Player Player´Â ½Ã°£ ±â¹Ý ¹Ìµð¾î µ¥ÀÌÅÍÀÇ ·»´õ¸µÀ» Á¦¾îÇÕ´Ï´Ù.
PlayerListener PlayerListener´Â Player°¡ »ý¼ºÇÑ ºñµ¿±âÀû À̺¥Æ®¸¦ ¼ö½ÅÇϱâ À§ÇÑ ÀÎÅÍÆäÀ̽ºÀÔ´Ï´Ù.
 

Class Summary
Manager Manager´Â ¸ÖƼ¹Ìµð¾î¸¦ ó¸®ÇÏ´Â Player¿Í °°Àº ½Ã½ºÅÛ Á¾¼Ó ÀÚ¿øÀ» ¾ò±â À§ÇÑ ¾×¼¼½º Æ÷ÀÎÆ®ÀÔ´Ï´Ù.
 

Exception Summary
MediaException MediaExceptionÀº ¸Þ¼Òµå¿¡ ¿¹±âÄ¡ ¾ÊÀº ¿À·ù Á¶°ÇÀÌ ÀÖÀ½À» ³ªÅ¸³À´Ï´Ù.
 

Package javax.microedition.media Description

MIDP 2.0 Media API´Â Mobile Media API (JSR-135) »ç¾çÀÇ Á÷Á¢ ȣȯ °¡´ÉÇÑ ºôµù ºí·ÏÀÔ´Ï´Ù. ÀÌ ºôµù ºí·ÏÀº Àüü Multimedia API¿ÍÀÇ »óÀ§ ¹öÀü ȣȯ¼ºÀ» À¯ÁöÇϸ鼭 ÇØ´ç »ç¾ç¿¡ »ç¿îµå Áö¿øÀ» Æ÷ÇÔÇÏ·Á´Â J2METM ÇÁ·ÎÇÊ¿ëÀ¸·Î »ç¿ëµË´Ï´Ù. ÀÌ·¯ÇÑ »ç¾çÀÇ ¿¹·Î´Â MIDP 2.0 (JSR-118)ÀÌ ÀÖ½À´Ï´Ù. »óÈ£ ¿î¿µµÇ´Â ÀÌ·¯ÇÑ µÎ APIÀÇ °³¹ß·Î ÀÎÇØ µ¿ÀÏÇÑ API ¿ø¸®¸¦ »ç¿ëÇÏ´Â J2METM ÀåÄ¡ Á¦Ç°±º¿¡¼­ ¿Ïº®ÇÑ »ç¿îµå¿Í ¸ÖƼ¹Ìµð¾î ³»¿ë ÀÛ¼ºÀÌ °¡´ÉÇÕ´Ï´Ù.

¼Ò°³

J2METM ÀåÄ¡´Â ´Ü¼ø Åæ Àç»ý ±â´ÉÀ» °¡Áø ÈÞ´ëÆù¿¡¼­ °í±Þ ¿Àµð¿À ¹× ºñµð¿À ·»´õ¸µ ±â´ÉÀÌ ÀÖ´Â PDA ¹× À¥ ÅÂºí¸´¿¡ À̸£±â±îÁö ´Ù¾çÇÕ´Ï´Ù. ´Ù¾çÇÑ ±¸¼º°ú ¸ÖƼ¹Ìµð¾î ó¸® ±â´ÉÀ» ¼ö¿ëÇÏ·Á¸é Ãß»óÈ­ ¼öÁØÀÌ ³ôÀº API°¡ ÇÊ¿äÇÕ´Ï´Ù. MMAPI Expert GroupÀÇ È°µ¿ ¸ñÇ¥´Â ±¤¹üÀ§ÇÑ ÀÀ¿ë ÇÁ·Î±×·¥ ¿µ¿ªÀ» ´Ù·ç´Â °ÍÀÌ¸ç ±× È°µ¿ °á°ú·Î ¸¸µé¾îÁø µÎ °³ÀÇ API ÁýÇÕÀ» Á¦¾ÈÇÕ´Ï´Ù. ù ¹øÂ° API´Â °­·ÂÇÑ ¸ð¹ÙÀÏ Æù, PDA ¹× ¼ÂÅé ¹Ú½º¸¦ Æ÷ÇÔÇÏ¿© °í±Þ »ç¿îµå ¹× ¸ÖƼ¹Ìµð¾î ±â´ÉÀÌ ÀÖ´Â J2METM ÀåÄ¡¸¦ À§ÇÑ °ÍÀÔ´Ï´Ù. µÎ ¹øÂ° API´Â Á÷Á¢ ȣȯµÇ´Â Multimedia APIÀÇ ÇÏÀ§ ÁýÇÕÀ¸·Î ¹ü¿ë ½ÃÀå ¸ð¹ÙÀÏ ÀåÄ¡(MIDP 2.0 ½ÇÇà)¿Í °°ÀÌ ÀÚ¿øÀÌ Á¦¾àµÈ ÀåÄ¡¸¦ À§ÇÑ °ÍÀÔ´Ï´Ù. ¶ÇÇÑ ÀÌ ÇÏÀ§ ÁýÇÕ API´Â »ç¿îµå Áö¿øÀ» ÇÊ¿ä·Î ÇÏ´Â ´Ù¸¥ J2METM ÇÁ·ÎÇÊ¿¡ Àû¿ëµÉ ¼ö ÀÖ½À´Ï´Ù. ´ÙÀ½Àº ºôµù ºí·Ï APIÀÇ ¹è°æ Á¤º¸¿Í ¿ä±¸ »çÇ׿¡ ´ëÇÑ º¸´Ù ÀÚ¼¼ÇÑ ¼³¸íÀÔ´Ï´Ù.

Media APIÀÇ ¹è°æ Á¤º¸

ÀϺΠJ2METM ÀåÄ¡´Â ÀÚ¿øÀÌ ¸Å¿ì Á¦¾àµÇ¾î ÀÖÀ¸¹Ç·Î ÀϺΠÈÞ´ëÆùÀÇ ºñµð¿À¿Í °°Àº ¸ðµç ¸ÖƼ¹Ìµð¾î À¯ÇüÀ» Áö¿øÇÏÁö ¸øÇÒ ¼öµµ ÀÖ½À´Ï´Ù. µû¶ó¼­ ¸ðµç ÀåÄ¡°¡ »ç¿ëÀÚ Á¤ÀÇ ÇÁ·ÎÅäÄݰú ³»¿ë À¯ÇüÀ» Áö¿øÇÏ´Â È®Àå °¡´É¼º°ú °°Àº ¸ÖƼ¹Ìµð¾î APIÀÇ ¸ðµç ³»¿ëÀ» Áö¿øÇÒ ÇÊ¿ä´Â ¾ø½À´Ï´Ù.

Á¦½ÃµÈ ºôµù ºí·Ï ÇÏÀ§ ÁýÇÕ API´Â À§ÀÇ Á¦¾à Á¶°Ç¿¡ ºÎÇÕÇϵµ·Ï ¼³°èµÇ¾ú½À´Ï´Ù. ÀÌ Á¦½ÃµÈ ºôµù ºí·ÏÀº MIDP 2.0 Expert GroupÀÇ ¿ä±¸ »çÇ×À» ÃæÁ·ÇÕ´Ï´Ù. ÀÌ·¯ÇÑ ¿ä±¸ »çÇ×Àº ´ÙÀ½°ú °°½À´Ï´Ù.

ÀÌ ÇÏÀ§ ÁýÇÕÀº ´ÙÀ½°ú °°Àº ¸é¿¡¼­ Àüü Mobile Media API¿Í ´Ù¸¨´Ï´Ù.

MIDP 2.0¿¡ »ç¿ëµÈ ºôµù ºí·Ï ÇÏÀ§ ÁýÇÕÀº Àüü Mobile Media API¿¡ ÀûÇÕÇÑ ÇÏÀ§ ÁýÇÕÀ¸·Î ÇâÈÄ ¹öÀü°ú ¿ÏÀü ȣȯµË´Ï´Ù. Àüü Mobile Media API ±â´ÉÀ» MIDP 2.0¿¡¼­ »ç¿ëÇÏ·Á¸é ÇØ´ç API¿¡¼­ Ãß°¡ Ŭ·¡½º¿Í ¸Þ¼Òµå¸¦ ±¸ÇöÇϱ⸸ ÇÏ¸é µË´Ï´Ù.

±âº» °³³ä

Á¦½ÃµÈ ¿Àµð¿À ºôµù ºí·Ï ½Ã½ºÅÛÀº ´ÙÀ½ ¼¼ °¡Áö ÁÖ¿ä ºÎºÐÀ¸·Î ±¸¼ºµÇ¾î ÀÖ½À´Ï´Ù.
  • Manager
  • Player
  • Control
  • Manager´Â ¿Àµð¿À ÀÚ¿øÀÇ ÃÖ»óÀ§ ÄÁÆ®·ÑÀÔ´Ï´Ù. ÀÀ¿ë ÇÁ·Î±×·¥Àº Manager¸¦ »ç¿ëÇÏ¿© Player¸¦ ¿äûÇÏ°í µî·Ï Á¤º¸, Áö¿øµÇ´Â ³»¿ë À¯Çü ¹× Áö¿øµÇ´Â ÇÁ·ÎÅäÄÝÀ» Äõ¸®ÇÕ´Ï´Ù. °ü¸®ÀÚ´Â ¶ÇÇÑ ´Ü¼ø ÅæÀ» Àç»ýÇÏ´Â ¸Þ¼Òµå¸¦ Æ÷ÇÔÇϰí ÀÖ½À´Ï´Ù.

    Player´Â ¸ÖƼ¹Ìµð¾î ³»¿ëÀ» Àç»ýÇÕ´Ï´Ù. ÀÀ¿ë ÇÁ·Î±×·¥Àº Manager¿¡ ·ÎÄÉÀÌÅÍ ¹®ÀÚ¿­À» Á¦°øÇÏ¿© Player¸¦ ¾ò½À´Ï´Ù.

    ControlÀº Player°¡ °¡Áú ¼ö ÀÖ´Â ¼­·Î ´Ù¸¥ Á¦¾î¸¦ ¸ðµÎ ±¸ÇöÇÏ´Â µ¥ »ç¿ëµÇ´Â ÀÎÅÍÆäÀ̽ºÀÔ´Ï´Ù. ÀÀ¿ë ÇÁ·Î±×·¥Àº Áö¿øÇÏ´Â Á¦¾îÀÇ Player¸¦ Äõ¸®ÇÑ ´ÙÀ½ VolumeControl°ú °°Àº º¼·ýÀ» Á¦¾îÇÒ Æ¯Á¤ ControlÀ» ¿äûÇÒ ¼ö ÀÖ½À´Ï´Ù.

    DataSource, Player and Manager

    API ¼¼ºÎ Á¤º¸

    createPlayer ¸Þ¼Òµå´Â APIÀÇ ÃÖ»óÀ§ ½ÃÀÛÁ¡ÀÔ´Ï´Ù.
    Player Manager.createPlayer(String url)
    urlÀº µ¥ÀÌÅÍÀÇ ÇÁ·ÎÅäÄݰú ³»¿ëÀ» ¸ðµÎ ÁöÁ¤ÇÕ´Ï´Ù.
    <protocol>:<content location>
    Manager´Â URLÀ» ±¸¹® ºÐ¼®ÇÏ°í ³»¿ë À¯ÇüÀ» ÀνÄÇÏ°í µ¥ÀÌÅÍ Ç¥½Ã¸¦ ó¸®ÇÒ Player¸¦ ¸¸µì´Ï´Ù. °á°ú Player´Â ÀÀ¿ë ÇÁ·Î±×·¥¿¡¼­ »ç¿ëÇÒ ¼ö ÀÖµµ·Ï ¹ÝȯµË´Ï´Ù. createPlayer·Î ¸¸µç ¿¬°áÀº Generic Connection ÇÁ·¹ÀÓ¿öÅ© ±ÔÄ¢°ú Á¤Ã¥À» µû¸¨´Ï´Ù.

    Player´Â µ¥ÀÌÅÍ È帧°ú Ç¥½Ã¸¦ Á¦¾îÇÒ ÀϹÝÀûÀÎ ¸Þ¼Òµå¸¦ Á¦°øÇÕ´Ï´Ù. ¿¹¸¦ µé¸é ´ÙÀ½°ú °°½À´Ï´Ù.

    Player.realize() 
    Player.prefetch() 
    Player.start()
    ¹Ì¼¼ÇÑ Á¦¾î ±â´ÉÀº APIÀÇ Áß¿äÇÑ Æ¯Â¡ Áß Çϳª·Î °¢ Player´Â getControls ¹× getControl ¸Þ¼Òµå¸¦ »ç¿ëÇÏ¿© À¯Çüº°·Î ´Ù¸¥ Á¦¾î¸¦ Á¦°øÇÕ´Ï´Ù.
    Control[] Player.getControls()
    Control Player.getControl(int controlType)
    ¿©·¯ À¯ÇüÀÇ ¹Ìµð¾î´Â °¢ ÇØ´ç Player¿¡¼­ ¼­·Î ´Ù¸¥ À¯ÇüÀÇ Á¦¾î¸¦ Á¦°øÇϱ⠶§¹®¿¡ getControls ¹× getControl ¸Þ¼Òµå´Â ƯÁ¤ ¹Ìµð¾î À¯Çü¿¡ °íÀ¯ÇÑ ±â´ÉÀ» Á¦°øÇÒ ¼ö ÀÖ½À´Ï´Ù.

    Åæ »ý¼º

    Åæ »ý¼ºÀº °ÔÀÓ°ú ±âŸ ¿Àµð¿À ÀÀ¿ë ÇÁ·Î±×·¥¿¡¼­ ¸Å¿ì Áß¿äÇÕ´Ï´Ù.  ±Ø¼ÒÇü ÀåÄ¡¿¡¼­´Â Åæ »ý¼ºÀÌ À¯ÀÏÇÑ ¸ÖƼ¹Ìµð¾î ±â´É Áö¿ø Çü½ÄÀÏ ¼ö ÀÖÀ¸¹Ç·Î ƯÈ÷ Áß¿äÇÕ´Ï´Ù.   °¡Àå ´Ü¼øÇÑ Çü½Ä¿¡¼­´Â Åæ »ý¼ºÀº ´ÜÀÏ ¹öÀú³ª ÀϺΠ´Ü¼øÇÑ ¸ð³ë Åæ »ý¼ºÀ¸·Î Ãà¼ÒµË´Ï´Ù.   Manager Ŭ·¡½º´Â ÀÌ ´ÜÀÏ Åæ »ý¼ºÀÇ ´Ü¼ø Çü½ÄÀ» ó¸®ÇÒ ÃÖ»óÀ§ ¸Þ¼Òµå¸¦ Á¦°øÇÕ´Ï´Ù.
    Manager.playTone(int note, int duration, int volume)
    ÀÌ ¸Þ¼ÒµåÀÇ ±¸ÇöÀº ÀåÄ¡ÀÇ Çϵå¿þ¾î Åæ »ý¼º±â·Î Á÷Á¢ ¸ÅÇÎµÇ¾î °¡Àå ÀÀ´äÀÌ ºü¸¥ »ç¿îµå »ý¼ºÀ» Á¦°øÇÕ´Ï´Ù.

    ¶ÇÇÑ API´Â Åæ ½ÃÄö½º¸¦ ÇÕ¼ºÇϴ ƯÁ¤ À¯ÇüÀÇ Player¸¦ ¸¸µå´Â ¹æ¹ýÀ» Á¦°øÇÕ´Ï´Ù.

    Player p = Manager.createPlayer(Manager.TONE_DEVICE_LOCATOR)
    ÀÛ¼ºµÈ Player´Â Åæ ½ÃÄö½º ÇÁ·Î±×·¡¹Ö¿¡ »ç¿ëÇÒ ¼ö Àִ Ưº° À¯ÇüÀÇ Á¦¾îÀÎ ToneControlÀ» Á¦°øÇÕ´Ï´Ù.  ±×·¯¸é Á»´õ °­·ÂÇÑ ÀåÄ¡¿¡ ´ëÇØ º¸´Ù Á¤±³ÇÑ ÀÀ¿ë ÇÁ·Î±×·¥À» ÀÛ¼ºÇÒ ¼ö ÀÖ½À´Ï´Ù.

    »ç¿ë ½Ã³ª¸®¿À

    ÀÌ Àý¿¡¼­´Â ³× °³ÀÇ ÀϹÝÀûÀÎ ½Ã³ª¸®¿À¿¡¼­ API°¡ »ç¿ëµÇ´Â ¹æ¹ýÀ» º¸¿© ÁÝ´Ï´Ù.

    ½Ã³ª¸®¿À 1: ´ÜÀÏ Åæ »ý¼º

    try { Manager.playTone(ToneControl.C4, 5000 /* ms */, 100 /* max vol */); } catch (MediaException e) {}

    ½Ã³ª¸®¿À 2: ·çÇÁ¸¦ »ç¿ëÇÑ ´Ü¼ø ¹Ìµð¾î Àç»ý

    MIDP 2.0¿¡¼­ wav Çü½ÄÀº ÀåÄ¡°¡ »ùÇà ¿Àµð¿À¸¦ Áö¿øÇÏ´Â °æ¿ì¿¡¸¸ ÇÊ¿äÇÕ´Ï´Ù.
    try { Player p = Manager.createPlayer("http://webserver/music.wav"); p.setLoopCount(5); p.start(); } catch (IOException ioe) { } catch (MediaException me) {}

    ½Ã³ª¸®¿À 3: JAR¿¡ ÀúÀåµÈ ¹Ìµð¾î¿¡¼­ Àç»ý

    MIDP 2.0¿¡¼­ wav Çü½ÄÀº ÀåÄ¡°¡ »ùÇà ¿Àµð¿À¸¦ Áö¿øÇÏ´Â °æ¿ì¿¡¸¸ ÇÊ¿äÇÕ´Ï´Ù.
    try { InputStream is = getClass().getResourceAsStream("music.wav"); Player p = Manager.createPlayer(is, "audio/X-wav"); p.start(); } catch (IOException ioe) { } catch (MediaException me) {}

    ½Ã³ª¸®¿À 4: Åæ ½ÃÄö½º »ý¼º

    /** * "Mary Had A Little Lamb" has "ABAC" structure. * Use block to repeat "A" section. */ byte tempo = 30; // set tempo to 120 bpm byte d = 8; // eighth-note byte C4 = ToneControl.C4;; byte D4 = (byte)(C4 + 2); // a whole step byte E4 = (byte)(C4 + 4); // a major third byte G4 = (byte)(C4 + 7); // a fifth byte rest = ToneControl.SILENCE; // rest byte[] mySequence = { ToneControl.VERSION, 1, // version 1 ToneControl.TEMPO, tempo, // set tempo ToneControl.BLOCK_START, 0, // start define "A" section E4,d, D4,d, C4,d, E4,d, // content of "A" section E4,d, E4,d, E4,d, rest,d, ToneControl.BLOCK_END, 0, // end define "A" section ToneControl.PLAY_BLOCK, 0, // play "A" section D4,d, D4,d, D4,d, rest,d, // play "B" section E4,d, G4,d, G4,d, rest,d, ToneControl.PLAY_BLOCK, 0, // repeat "A" section D4,d, D4,d, E4,d, D4,d, C4,d // play "C" section }; try { Player p = Manager.createPlayer(Manager.TONE_DEVICE_LOCATOR); p.realize(); ToneControl c = (ToneControl)p.getControl("ToneControl"); c.setSequence(mySequence); p.start(); } catch (IOException ioe) { } catch (MediaException me) {}

    Since:
    MIDP 2.0

    MID ÇÁ·ÎÇÊ

    ÀǰßÀ̳ª Á¦¾È »çÇ× º¸³»±â MID ÇÁ·ÎÇÊ »ç¾ç ¹öÀü 2.0
    Java´Â ¹Ì±¹ ¹× ´Ù¸¥ ±¹°¡¿¡¼­ Sun Microsystems, Inc.ÀÇ »óÇ¥ ¶Ç´Â µî·Ï »óÇ¥ÀÔ´Ï´Ù. Copyright 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. ¸ðµç ±Ç¸®´Â ÀúÀÛ±ÇÀÚÀÇ ¼ÒÀ¯ÀÔ´Ï´Ù.