• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

how can I invoke a JSF bean method on a GET to get the video?

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to upload video files automatically that were recording on my WildFly server. This is my code. How can I upload the video on my server? how can I invoke a JSF bean method on a GET to get the video?
<html xmlns="http://www.w3.org/1999/xhtml";
<h:form id="form">
<h:button id='request' value="Request Camera">

<h:button id='start' value=" Start Recording">
<h:button id='stop' value="Stop Recording">

<h:inputText type="text" id="inputid" />
<a id='ul'>Downloads List: </a>
<video id='video' autoplay="autoplay"></video>

var video, reqBtn, startBtn, stopBtn, ul, stream, recorder;
video = document.getElementById('video');
reqBtn = document.getElementById('form:request');
startBtn = document.getElementById('form:start');
stopBtn = document.getElementById('form:stop');
ul = document.getElementById('ul');
input = document.getElementById('form:inputid');
reqBtn.onclick = requestVideo;
startBtn.onclick = startRecording;
stopBtn.onclick = stopRecording;
startBtn.disabled = true;
ul.style.display = 'none';
stopBtn.disabled = true;

function requestVideo() {
video: true,audio: true}).then(stm => {
stream = stm;
reqBtn.style.display = 'none';
video.src = URL.createObjectURL(stream);
}).catch(e = > console.error(e));

function startRecording() {
recorder = new MediaRecorder(stream, {
mimeType: 'video/mp4'});
startBtn.disabled = true;

function stopRecording() {
recorder.ondataavailable =e => {
ul.style.display = 'block';
var a = document.createElement('a'), li = document.createElement('li'), myObject, newpath;
a.download = ['video_', (new Date() + '').slice(4, 28), '.flv'].join('');
a.href = URL.createObjectURL(e.data);
a.textContent = a.download;
input = e.Date;
stopBtn.disabled = true;
Saloon Keeper
Posts: 22483
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Yassine!

There's a "Code" button on our message editor that you can use to wrap special tags around pre-formatted data (like Java code or XML). It makes the code easier to read and prevents the HTML process from ruining the natural spacing.

I'm not clear on your uploading process. JSF does have the ability to upload files (including video files) from a client. It does not support things like having the server directly manage a video source such as a camera or video recorder device. As a general rule, nothing HTML-based can do that.
Ranch Hand
Posts: 57
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hmm i didn't know if is this what you want...

on the fileuploadlistener you can set the path of the file wich you want to upload

maybe it helps you


I want my playground back. Here, I'll give you this tiny ad for it:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic