All Downloads are FREE. Search and download functionalities are using the official Maven repository.

bichromate.audio.sTestPlayAudioFactory Maven / Gradle / Ivy

Go to download

Java, Selenium, Appium, Winium, Extend, and TestNG automated testing framework. Bichromate integrates the best of these frameworks and takes automation to the next level. With Bichromate there is one function call that builds any type of Web,IOS Mobile, Android, and Windows App driver on any platform (Windows, Mac, Linux). From Local web drivers, to SauceLabs, Browserstack, and Selenium grid. Build data driven tests is never easier. Bichromate also gives you built in Factories that, access DBs, Video Capture, FTP, POM Generation, Hilite element.

The newest version!
package bichromate.audio;

import java.io.File;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.zip.ZipException;


import javax.media.MediaException;
import bichromate.core.sTestOSInformationFactory;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.embed.swing.JFXPanel;
//import javafx.util.Duration;

@SuppressWarnings("restriction")
public class sTestPlayAudioFactory {
	
	private static ResourceBundle resources;
	private sTestOSInformationFactory path = null;
	private String wavSample = null;
	private String mp3Sample = null;
	private MediaPlayer mediaPlayer = null;
	
	static
	 {
			try
			{
				resources = ResourceBundle.getBundle("audio.sTestPlayAudioFactory",Locale.getDefault());
			} catch (MissingResourceException mre) {
				System.out.println("sTestPlayAudioFactory.properties not found: "+mre);
				System.exit(0);
			}
	 }

	
	 @SuppressWarnings("unused")
	public sTestPlayAudioFactory(){
		 
		 path = new sTestOSInformationFactory();
		 wavSample = new String(resources.getString("sTestPlayAudioFactory.testWav"));
		 mp3Sample = new String(resources.getString("sTestPlayAudioFactory.testMP3"));
		 
		 final JFXPanel fxPanel = new JFXPanel();
		  
	 }
	public void playWavFile(String file){
		
	}
	public void playMP3File(String file){
		
	}
	public void playWavFileFromPropertiesFile(){
		
	}
	public void playMP3FileFromPropertiesFile(){
		
	}
	private void playFile(String bip) throws MediaException {
		
		
		Media hit = new Media(new File(bip).toURI().toString());
		
		MediaPlayer mediaPlayer = new MediaPlayer(hit);
		
		if(null != mediaPlayer){
			mediaPlayer.play();
			
		}
			
	}
	public void stopMediaPlayer(){
		if(null != mediaPlayer)
			mediaPlayer.stop();
	}
	private void test(){
		String fileToPlay = new String(path.getAudioDirectory()+mp3Sample);
		String fileToPlay2 = new String(path.getAudioDirectory()+wavSample);
		try{
			playFile(fileToPlay);
			System.out.println("Playing file: " +fileToPlay);
			this.wait(3000);
			stopMediaPlayer();
			System.out.println("Playing file: " +fileToPlay2);
			playFile(fileToPlay2);
		}catch (InterruptedException | MediaException e){
			System.out.println("Error reading file: " +fileToPlay2);
		}
		
	}
	 //
	 // Inner class for testing on the command line
	 //
	 public static class Test
	 {
		 public static void main(String[] args) throws ZipException {
			 
			 sTestPlayAudioFactory pAudio = new sTestPlayAudioFactory();
			 if(pAudio != null){
				 pAudio.test();
			 }
			 
		 }//main
	 }// Test
}// sTestPlayAudioFactory




© 2015 - 2024 Weber Informatics LLC | Privacy Policy