EZMusicBoxSDK/src/main/java/com/wms/ezmusicbox/sdk/streaming/StreamingMediaPlayer.java
/**  
     * Progressively download the media to a temporary location and update the MediaPlayer as new content becomes available.
     * A progress dialog will be displayed to block user operations if the content is not play-able yet. The dialog will be
     * dismissed when the downloaded content becomes play-able.
     */
Progressively download the media to a temporary location and update the MediaPlayer as new content becomes available.
A progress dialog will be displayed to block user operations if the content is not play-able yet. The dialog will be
dismissed when the downloaded content becomes play-able.
Progressively download the media to a temporary location and update the MediaPlayer as new content becomes available . A progress dialog will be displayed to block user operations if the content is not play - able yet . The dialog will be dismissed when the downloaded content becomes play - able .
public void startStreaming(final String mediaUrl, int mediaSizeInKB, int mediaDurationInSeconds, String mediaName, final ProgressDialog progressDialog) throws IOException {    	
    	this.mediaSizeInKB = mediaSizeInKB;
    	this.mediaDurationInSeconds = mediaDurationInSeconds;
    	this.mediaName = mediaName;
    	this.progressDialog = progressDialog;
		Runnable r = new Runnable() {   
	        public void run() {   
	            try {   
	        		downloadMediaIncrement(mediaUrl);
	            } 
	            catch (IOException e) {
	            	if(progressDialog.isShowing()) {
	            		progressDialog.dismiss();
	            	}
	        		Runnable updater = new Runnable() { 
	        			public void run() {
					        isDownloadingNewFile = false;
	        				DialogUtil.showExceptionAlertDialog(context, context.getString(R.string.retrievalFailedTitle), "Unable to initialize the MediaPlayer for " + mediaUrl);
	        	        }
	        	    };
	        	    handler.post(updater);
	            }
	        }   
	    };   
	    new Thread(r).start();
    }
public void startStreaming ( final String mediaUrl , int mediaSizeInKB , int mediaDurationInSeconds , String mediaName , final ProgressDialog progressDialog ) throws IOException { this . mediaSizeInKB = mediaSizeInKB ; this . mediaDurationInSeconds = mediaDurationInSeconds ; this . mediaName = mediaName ; this . progressDialog = progressDialog ; Runnable r = new Runnable ( ) { public void run ( ) { try { downloadMediaIncrement ( mediaUrl ) ; } catch ( IOException e ) { if ( progressDialog . isShowing ( ) ) { progressDialog . dismiss ( ) ; } Runnable updater = new Runnable ( ) { public void run ( ) { isDownloadingNewFile = false ; DialogUtil . showExceptionAlertDialog ( context , context . getString ( R . string . retrievalFailedTitle ) , "Unable to initialize the MediaPlayer for " + mediaUrl ) ; } } ; handler . post ( updater ) ; } } } ; new Thread ( r ) . start ( ) ; }
Progressively download the media to a temporary location and update the MediaPlayer as new content becomes available.
Progressively download the media to a temporary location and update the MediaPlayer as new content becomes available .