private BufferedPlaybackScreen() {
// Set the title of the window
setTitle("Buffered Playback Demo");
// Create and add the field for the URL to be retrieved
_urlField = new BasicEditField("Media URL: ", "");
add(_urlField);
// Create and add the field for the MIME type of the remote file
_mimeField =
new BasicEditField("Mime: ", "audio/mpeg", 10,
Field.NON_FOCUSABLE);
add(_mimeField);
// Create the START, STOP and RESET buttons
_startPlayingButton =
new ButtonField("Play", ButtonField.CONSUME_CLICK);
_stopPlayingButton =
new ButtonField("Stop", ButtonField.CONSUME_CLICK);
_resetField = new ButtonField("Reset", ButtonField.CONSUME_CLICK);
_startPlayingButton.setChangeListener(this);
_stopPlayingButton.setChangeListener(this);
_resetField.setChangeListener(this);
// Add the player control buttons to the screen
final HorizontalFieldManager buttonlist =
new HorizontalFieldManager();
buttonlist.add(_startPlayingButton);
buttonlist.add(_stopPlayingButton);
buttonlist.add(_resetField);
add(buttonlist);
// Create and add the field with the load progress
_loadStatusField =
new BasicEditField("Load: ", "0 Bytes", 10,
Field.NON_FOCUSABLE);
add(_loadStatusField);
// Create and add the field with the player status
_playStatusField =
new BasicEditField("Play: ", "Stopped", 10,
Field.NON_FOCUSABLE);
add(_playStatusField);
// Create and add the field with the starting buffer
_startBufferField =
new BasicEditField("Starting Buffer: ", "200000", 10,
BasicEditField.FILTER_INTEGER | Field.NON_FOCUSABLE);
add(_startBufferField);
// Create and add the field with the minimum pause buffer
_pauseBytesField =
new BasicEditField("Pause At: ", "64000", 10,
BasicEditField.FILTER_INTEGER | Field.NON_FOCUSABLE);
add(_pauseBytesField);
// Create and add the field with the minimum resume buffer
_resumeBytesField =
new BasicEditField("Resume At: ", "128000", 10,
BasicEditField.FILTER_INTEGER | Field.NON_FOCUSABLE);
add(_resumeBytesField);
// Create and add the field with the read limit
_readLimitField =
new BasicEditField("Read Limit: ", "32000", 10,
BasicEditField.FILTER_INTEGER | Field.NON_FOCUSABLE);
add(_readLimitField);
}