Click here to Skip to main content
15,913,243 members
Home / Discussions / Java
   

Java

 
AnswerRe: How to access multiple webservices in single servlet Pin
jschell25-Dec-13 8:30
jschell25-Dec-13 8:30 
QuestionArrays in Web services Pin
V.22-Dec-13 23:26
professionalV.22-Dec-13 23:26 
AnswerRe: Arrays in Web services Pin
jschell25-Dec-13 8:38
jschell25-Dec-13 8:38 
GeneralRe: Arrays in Web services Pin
V.25-Dec-13 10:11
professionalV.25-Dec-13 10:11 
QuestionJava Tutorials Pin
tgsb22-Dec-13 22:50
tgsb22-Dec-13 22:50 
AnswerRe: Java Tutorials Pin
Richard MacCutchan22-Dec-13 23:23
mveRichard MacCutchan22-Dec-13 23:23 
GeneralRe: Java Tutorials Pin
techgeek from-india29-Dec-13 17:50
techgeek from-india29-Dec-13 17:50 
GeneralRe: Java Tutorials Pin
Richard MacCutchan29-Dec-13 22:46
mveRichard MacCutchan29-Dec-13 22:46 
Questionturing machine Pin
Member 1047236322-Dec-13 0:07
Member 1047236322-Dec-13 0:07 
QuestionSending Message from Java Application to Any Cell Phone Pin
Cyber1217-Dec-13 2:27
Cyber1217-Dec-13 2:27 
AnswerRe: Sending Message from Java Application to Any Cell Phone Pin
Richard MacCutchan17-Dec-13 2:48
mveRichard MacCutchan17-Dec-13 2:48 
AnswerRe: Sending Message from Java Application to Any Cell Phone Pin
ashish nimrot4-Jan-14 6:47
ashish nimrot4-Jan-14 6:47 
QuestionSplit and Replace methods Pin
f2616-Dec-13 18:28
f2616-Dec-13 18:28 
AnswerRe: Split and Replace methods Pin
Richard MacCutchan16-Dec-13 23:11
mveRichard MacCutchan16-Dec-13 23:11 
GeneralRe: Split and Replace methods Pin
f2616-Dec-13 23:47
f2616-Dec-13 23:47 
GeneralRe: Split and Replace methods Pin
Member 1041746021-Dec-13 9:30
Member 1041746021-Dec-13 9:30 
GeneralRe: Split and Replace methods Pin
Richard MacCutchan21-Dec-13 21:16
mveRichard MacCutchan21-Dec-13 21:16 
AnswerRe: Split and Replace methods Pin
BobJanova17-Dec-13 1:58
BobJanova17-Dec-13 1:58 
GeneralRe: Split and Replace methods Pin
Richard MacCutchan17-Dec-13 2:47
mveRichard MacCutchan17-Dec-13 2:47 
Questionwebcam for java android eclipse Pin
NooobieCoder16-Dec-13 16:25
NooobieCoder16-Dec-13 16:25 
Hi, what I want to do is to capture live video from a webcam in this java application, but had an error when I run this set of code:
VB
java.io.IOException: Could not connect to capture device
javax.media.NoDataSourceException: Error instantiating class: com.sun.media.protocol.vfw.DataSource : java.io.IOException: Could not connect to capture device


I had already put the jmf.jar into the lib folder.


Java
<pre lang="java">
public class CamRecorder {

static VideoFormat videoFormat;
static AudioFormat audioFormat;
static CaptureDeviceInfo videoDevice;
static CaptureDeviceInfo audioDevice;

public static void main(String[] args) {
try {
Vector deviceList = CaptureDeviceManager.getDeviceList(new YUVFormat()); //get all media devices

CaptureDeviceInfo device = (CaptureDeviceInfo) deviceList.firstElement(); //in this computer the only capture device is in=built webcam stays at 0th position
Format[] formats = device.getFormats(); //get all formats

for (int x = 0; x < formats.length; x++) {
if (formats[x] != null && formats[x] instanceof VideoFormat) {
videoFormat = (VideoFormat) formats[x]; //take the video format
videoDevice = device;
}
/*if (formats[x] != null && formats[x] instanceof AudioFormat) {
audioFormat = (AudioFormat) formats[x]; //take the audio format
//audioDevice = device;
}*/
}
//create data sources
DataSource videoDataSource = Manager.createDataSource(device.getLocator());

deviceList = CaptureDeviceManager.getDeviceList(new VideoFormat(null)); //get all media devices
device = (CaptureDeviceInfo) deviceList.firstElement();

DataSource audioDataSource=Manager.createDataSource(device.getLocator());

DataSource[] dArray=new DataSource[1];
dArray[0]=videoDataSource;
//dArray[1]=audioDataSource;

DataSource mixedDataSource = Manager.createMergingDataSource(dArray);

//format for output

Format[] outputFormats=new Format[2];
outputFormats[0]=new VideoFormat(VideoFormat.YUV);
//outputFormats[1]=new AudioFormat(AudioFormat.LINEAR);
//output type
FileTypeDescriptor outputType=new FileTypeDescriptor(FileTypeDescriptor.MSVIDEO);

//settingup Processor
ProcessorModel processorModel=new ProcessorModel(mixedDataSource, outputFormats, outputType);
Processor processor=Manager.createRealizedProcessor(processorModel);

//settingup sink
DataSource outputDataSource=processor.getDataOutput();
MediaLocator destination=new MediaLocator("file:.\\testcam.avi");
DataSink dataSink=Manager.createDataSink(outputDataSource, destination);
dataSink.open();

//start sink + processor
Thread.sleep(4000);
dataSink.start();
processor.start();

Thread.sleep(4000);

dataSink.close();
processor.stop();
processor.close();


} catch (Exception ex) {
System.out.println(ex);
}
}
}
QuestionIntelliJ IDEA, Think like a computer scientist. import a java file Pin
David C# Hobbyist.15-Dec-13 4:18
professionalDavid C# Hobbyist.15-Dec-13 4:18 
AnswerRe: IntelliJ IDEA, Think like a computer scientist. import a java file Pin
Richard MacCutchan15-Dec-13 4:43
mveRichard MacCutchan15-Dec-13 4:43 
GeneralRe: IntelliJ IDEA, Think like a computer scientist. import a java file Pin
David C# Hobbyist.15-Dec-13 10:56
professionalDavid C# Hobbyist.15-Dec-13 10:56 
GeneralRe: IntelliJ IDEA, Think like a computer scientist. import a java file Pin
Richard MacCutchan15-Dec-13 21:11
mveRichard MacCutchan15-Dec-13 21:11 
Questionproject code Pin
Member 1045083712-Dec-13 19:45
Member 1045083712-Dec-13 19:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.