Package com.rim.samples.device.mediakeysdemo.mediaplayerdemo.mediaplayerlib.MediaPlayerDemo

Examples of com.rim.samples.device.mediakeysdemo.mediaplayerdemo.mediaplayerlib.MediaPlayerDemo.MediaActionException


        }

        try {
            volumeControl.setMute(mute);
        } catch (final Exception e) {
            throw new MediaActionException("unable to " + (mute ? "" : "un")
                    + "mute audio: " + e);
        }

        final MediaPlayerDemoScreen screen = _handler.getScreen();
        if (screen != null) {
View Full Code Here


        if (player != null) {
            try {
                player.stop();
            } catch (final Exception e) {
                throw new MediaActionException("Unable to unpause player: " + e);
            }
        }

        return true;
    }
View Full Code Here

            final String url = entry.getURL();
            try {
                player = Manager.createPlayer(url);
            } catch (final Exception e) {
                throw new MediaActionException("unable to load media from "
                        + url + ": " + e);
            }
            _handler.setPlayer(player);
            player.addPlayerListener(_handler);

            try {
                player.realize();
            } catch (final Exception e) {
                throw new MediaActionException("unable to fetch media: " + e);
            }

            // Cause playback to begin as soon as possible once start()
            // is called on the Player.
            final StreamingBufferControl sbc =
                    (StreamingBufferControl) player
                            .getControl("net.rim.device.api.media.control.StreamingBufferControl");
            sbc.setBufferTime(0);

            Control control = player.getControl("VolumeControl");
            if (control instanceof VolumeControl) {
                final VolumeControl volumeControl = (VolumeControl) control;
                _handler.setVolumeController(volumeControl);

                // Unmute the application on the assumption that if the user
                // asks to
                // play a track they actually want to hear it.
                try {
                    doMute(false);
                } catch (final Exception e) {
                    _handler.setVolumeController(null);
                    control = null;
                }

                // Set the volume to match the last-selected level
                try {
                    _handler.changeVolume(_handler.getVolume());
                } catch (final Exception e) {
                    _handler.setVolumeController(null);
                    control = null;
                }
            }
        }

        if (player != null) {
            try {
                player.start();
            } catch (final Exception e) {
                throw new MediaActionException("unable start player: " + e);
            }
        }
        return true;
    }
View Full Code Here

            if (timeInMicroSeconds > 2000000L) {
                try {
                    player.setMediaTime(0);
                    return true;
                } catch (final Exception e) {
                    throw new MediaActionException(
                            "unable to go back to beginning: " + e);
                }
            }
        }
View Full Code Here

        }

        try {
            player.close();
        } catch (final Exception e) {
            throw new MediaActionException("closing Player failed: " + e);
        }

        return true;
    }
View Full Code Here

TOP

Related Classes of com.rim.samples.device.mediakeysdemo.mediaplayerdemo.mediaplayerlib.MediaPlayerDemo.MediaActionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.