开发者

Facing problem in Android Video streaming

I created a simple application which will stream video from an URL, it works fine when i point to some local URL like,

http://192.168.X.XX:XXX/Tutorial/TestVideo.mp4

But when try to point some external URL like,

http://122.183.X.XX/Tutorial/TestVideo.mp4

the app is not working. In both the URLs i am having the same video file. When i work with the external URL i am getting the following logcat info

08-17 17:34:28.772: INFO/Prefetcher(34): max duration reached, size = 960201 bytes

Please find my code below:

public void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    preview=(VideoView)findViewById(R.id.surface);
   开发者_C百科 preview.setEnabled(true);
    preview.bringToFront();
    MediaController mc=new MediaController(playerActivity.this);
    mc.setMediaPlayer(player_interface);
    mc.show(50);
    preview.setMediaController(mc );
    holder=preview.getHolder();

    holder.setFixedSize(400, 400);
    b=(Button)findViewById(R.id.cmd_play);
    pb=(ProgressBar)findViewById(R.id.progress);
    b.setOnClickListener(new View.OnClickListener()
    {
    public void onClick(View v)
    {
        try
        {       
            mp.setDisplay(holder);
            mp.setAudioStreamType(AudioManager.STREAM_MUSIC);               
            mp.setOnBufferingUpdateListener(playerActivity.this);
            mp.setOnPreparedListener(playerActivity.this);
            mp.prepare();           
            mp.start();
            mp.seekTo(20000);
        }
        catch(Exception e)
        {

        }
}

I don't know what is the problem, please some body help me if you know the solution for this.

Thanks and Regards,

Rajapandian


If this is occurring on the emulator try this solution and try it on an actual phone. If this isn't the problem, you'll need to post the code you are using to load the video.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜