开发者

Copying Media Player Object

If I create a copy of a MediaPlayer object, which object will a callback function be 开发者_如何转开发called on. For example:

MediaPlayer mp = new MediaPlayer();
MediaPlayer mp_copy = mp;

mp.setOnBufferingUpdateListener(...);
mp_copy.setOnBufferingUpdateListener(...);

When the buffer is updated, which object will receive the callback (or will both of them)?

Thanks.


When you do this:

MediaPlayer mp_copy = mp;

you are not making a copy of a MediaPlayer object. You are making a new reference to the same object. The second call to setOnBufferingUpdateListener will undo the effect of the first call.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜