Android/App개발2009. 5. 12. 18:30
MediaPlayerDemo_Video.java 참조

           switch (Media) {
                case LOCAL_VIDEO:
                    /*
                     * TODO: Set the path variable to a local media file path.
                     */
                    //path = "sdcard/[PV] YUI - SUMMER SONG.avi"; // failed
                    //path = "sdcard/2008-01-11 02_01_00.3gp"; // ok
                    //path = "sdcard/FighterPilot_H264_720_480_30fps_4.1Mbps_AAC256Q100.mp4"; // fail
                    //path = "sdcard/leekunho_goal6.mp4"; // ok : frame skip
                    //path = "sdcard/Qpang.avi"; // fail
                    path = "sdcard/[M35_700]sample.avi"; // fail
                    if (path == "") {
                        // Tell the user to provide a media file URL.
                        Toast
                                .makeText(
                                        MediaPlayerDemo_Video.this,
                                        "Please edit MediaPlayerDemo_Video Activity, "
                                                + "and set the path variable to your media file path."
                                                + " Your media file must be stored on sdcard.",
                                        Toast.LENGTH_LONG).show();

                    }
                    break;
                case STREAM_VIDEO:

                    /*
                     * TODO: Set path variable to progressive streamable mp4 or
                     * 3gpp format URL. Http protocol should be used.
                     * Mediaplayer can only play "progressive streamable
                     * contents" which basically means: 1. the movie atom has to
                     * precede all the media data atoms. 2. The clip has to be
                     * reasonably interleaved.
                     *
                     */
                    path = "";
                    if (path == "") {
                        // Tell the user to provide a media file URL.
                        Toast
                                .makeText(
                                        MediaPlayerDemo_Video.this,
                                        "Please edit MediaPlayerDemo_Video Activity,"
                                                + " and set the path variable to your media file URL.",
                                        Toast.LENGTH_LONG).show();

                    }

                    break;


            }

            // Create a new media player and set the listeners
            mMediaPlayer = new MediaPlayer();
            mMediaPlayer.setDataSource(path);
            mMediaPlayer.setDisplay(holder);
            mMediaPlayer.prepare();
            mMediaPlayer.setOnBufferingUpdateListener(this);
            mMediaPlayer.setOnCompletionListener(this);
            mMediaPlayer.setOnPreparedListener(this);
            mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);

MediaPlayer
  -> setDataSource(path)  : URI로 content의 path가 전달 -> MediaPlayer service로부터 해당 path로 IMediaPlayer생성 -> 생성된 IMediaPlayer내부에 유지
  -> prepare()
      -> prepareAsync_I()
          -> setAudioStreamType() : 생성된 IMediaPlayer의 setAudioStreamType()임
                  in IMediaPlayer.cpp
 status_t setAudioStreamType(int type)
{
        Parcel data, reply;
        data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor());
        data.writeInt32(type);
        remote()->transact(SET_AUDIO_STREAM_TYPE, data, &reply);
        return reply.readInt32();
}
          -> prepareAsync() : 생성된 IMediaPlayer의 prepareAsync()임.
                  in IMediaPlayer.cpp
    status_t prepareAsync()
    {
        Parcel data, reply;
        data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor());
        remote()->transact(PREPARE_ASYNC, data, &reply);
        return reply.readInt32();
    }
     -> wait for prepare done
         if (mPrepareSync) {
            mSignal.wait(mLock);  // wait for prepare done
            mPrepareSync = false;
         }
  -> start()


Posted by 삼스

댓글을 달아 주세요

  1. Marine Le Pen, http://www.moncleroutletespain.com/ http://www.moncleroutletespain.com/, candidate à la succession de son père à la tête du Front national (extrême-droite), a estimé qu'Isra, http://www.moncleroutletespain.com/ moncler?l n'avait pas à lui donner de le?on concernant le racisme, http://www.moncleroutletespain.com/ moncler españa, dans une longue interview publiée vendredi par le quotidien israélien de gauche Haaretz, http://www.moncleroutletespain.com/ moncler chaquetas. Politique Jacob soucieux du "respect du statut des fonctionnaires" Politique Delano, http://www.moncleroutletespain.com/ moncler online? se "fout" de Paris (Jean-Fran, http://www.moncleroutletespain.com/ moncler outlet?ois Lamour)Related articles:


    http://www.foodstoryist.com/107 http://www.foodstoryist.com/107

    http://scjbible.tistory.com/1233 http://scjbible.tistory.com/1233

    2013.01.05 17:21 [ ADDR : EDIT/ DEL : REPLY ]
  2. 당신은 내가사랑할 만한 사람이 아니예요,사랑하지 않으면 안될 사람이예요.

    2013.07.14 16:59 [ ADDR : EDIT/ DEL : REPLY ]
  3. 슬퍼서 우는거 아니야..바람이 불어서 그래..눈이 셔서..

    2013.07.16 12:05 [ ADDR : EDIT/ DEL : REPLY ]
  4. 지금은 반짝반짝 빛이 나겠지,, 하지만 시간이 흐르면 그빛은 사라저버릴거야,지금 우리처럼

    2013.07.18 13:56 [ ADDR : EDIT/ DEL : REPLY ]