Flex to Change NetStream.Publish perameter from save to publish - actionscript-3

I am implementing one live audio video web app using flex sdk. I have successfully created a feature, where user can start a live sharing of web cam with others. But i want to add a feature where user can change live streaming to record a video in between a live sharing. Below is a code that i am using in live streaming.
var room_service:RoomService = RoomService.getInstance();
var publishStream:NetStream = room_service.startStream();
_publishStream = publishStream;
if(_camera)
{
_camera.setQuality(0, 80);
_camera.setMode(120, 90, 30);
publishStream.attachCamera(_camera);
}
if(_microphone)
{
publishStream.attachAudio(_microphone);
}
publishStream.publish(room_service.loggedInUser.broadcastID, "live");
is there any way i can change the last line "live" perameter to "record" while the stream being publish.

Related

How to add stream to live channels

I’m developing a tvml app that has live tv, news and on-demand programs.
Wondering how can I add that to the tv app. I have been looking around but I didn’t seem to find anything...
In tvOS, there is a TV app, with suggestions on shows to watch, Trendings, and sports. Some of those channels like news, and sports, have live content. I am trying to add my live content to the Apple TV app, and not sure what to do.
Btw, I did find the guild for Android TV,
https://developer.android.com/training/tv/tif/
AppleTV uses Apple's HTTP Live Stream (HLS).
You should create a server that serves the live stream in .m3u8 with type EVENT
And then in your AppleTV app
// create a player
const player = new Player();
// create a playlist
player.playlist = new Playlist();
// create video mediaItem
var video = new MediaItem('video', "https://myserver.example.com/video/live.m3u8");
// add it to the playlist
player.playlist.push(video);
// hit play
player.play();

How to auto load URL through SWF banner in the background?

I am new here just signed up and I did not find information on how to classify this topic on specific section.
I am using adobe flash professional to create a small banner to auto load one of my own URL for analytics. Is this possible? I found one solution on another user's topic which was (AS 3):
var req:URLRequest("http://your_request");
var loader:URLLoader = new URLLoader ();
loader.addEventListener(Event.COMPLETE, onLoadComplete);
loader.load(req);
private function onLoadComplete(ev:Event):void
{
var result:String = ev.target.data;
}
But this doesn't seem to work. How can I test that the full webpage is loaded 'invisibly' in the background? If "http://your_request" has cookies for example, I can check if the cookies were created, but I do not know if with this method I'll load the cookies to check if this is working at the first place.
There is no way to get http-cookies natively. But you can do this with a js-helper-function and an ExternalInterface.call. See this answer: How do I access cookies within Flash?

Record sound of a webaudio api's audio context

I am using web audio api in my project. Is there a way to record the audio data that's being sent to webkitAudioContext.destination?
.wav files are playing in my browser, so there should be some way to store that data into a (.wav) file . i know this is possible, but not yet find any solution :(
recorder.js can help me, but upto now i found it is only recording the microphone live input, is it possible to record my audio(.wav files) with the help of recorder.js? plz help
i am using this sample for recording https://github.com/mattdiamond/Recorderjs
I have managed to achieve this through a pure WebAudio solution (no Recorderjs needed). You can see it working fully on my discJS project and use the relevant source file to see how my complete code is working. I imagine this is only relevant to recording WebAudio nodes that you are playing yourself programmatically.
First you will need an HTML <audio> to use as a final destination. In this case I choose to show the controls so that the user may easily download the resulting file.
<audio id='recording' controls='true'></audio>
Now for the Javascript mojo:
const CONTEXT = new AudioContext();
var recorder=false;
var recordingstream=false;
function startrecording(){
recordingstream=CONTEXT.createMediaStreamDestination();
recorder=new MediaRecorder(recordingstream.stream);
recorder.start();
}
function stoprecording(){
recorder.addEventListener('dataavailable',function(e){
document.querySelector('#recording').src=URL.createObjectURL(e.data);
recorder=false;
recordingstream=false;
});
recorder.stop();
}
Now the final glue is that whenever you play an audio source, you also need to connect it to your recording stream:
function play(source){
let a=new Audio(source);
let mediasource=CONTEXT.createMediaElementSource(a);
mediasource.connect(CONTEXT.destination);//plays to default context (speakers)
mediasource.connect(recordingstream);//connects also to MediaRecorder
a.play();
}
This is a relatively primitive setup that works fine (tested on Firefox 52 and Chrome 70). For a more proper implementation, see MediaRecorder on MDN.
As found on the github: var rec = new Recorder(source [, config]), where source is an audio node. So it's up to you to put in the right node. If you play .wav files using <audio>, you can send it to the recorder:
<audio id="audio" src="" controls></audio>
var a = document.getElementById('audio');
var context = new webkitAudioContext();
var sourceNode = context.createMediaElementSource(a);
var rec = new Recorder(sourceNode);

Capture video without sound in Windows Store App

I want to write a Windows Store App that can capture video (without any sound) and take pictures. Imagine a digital camera: you can preview the picture on the screen of your device before pushing the button which takes the pic.
The problem I'm facing now is the fact that the Windows.Media.Capture namespace has only classes for objects that capture video with sound (CameraCaptureUI, MediaCapture). I'm not troubled by the objects' capabilities, but by the fact that I will have to include in the manifest of the app the Microphone capability and it does not make sense for the app to use it. I need a class that uses only the Webcam capability.
Any ideas?
I found the answer and I thought I should share it. I'm sorry for answering my own question, but here goes:
One can specify in the settings of the MediaCapture object, when initializing it, that it will use only the Video part:
var mediaCaptureMgr = new MediaCapture();
var captureSettings = new MediaCaptureInitializationSettings();
captureSettings.StreamingCaptureMode = StreamingCaptureMode.Video;
await mediaCaptureMgr.InitializeAsync(captureSettings);
RTFM!

AS3 AIR mobile urlloader progress bar

I have an app (for iOS and Android) which has the ability for users to select an image from the cameraroll or take an image using the cameraui. After selecting the image it is then uploaded to a server using urlloader and urlrequestwrapper class. This all works great but I need to display a percentage uploaded progress text/bar to the user but having real trouble finding a solution.
Thanks
Listen ProgressEvent.PROGRESS:
var loader = new URLLoader();
loader.addEventListener(ProgressEvent.PROGRESS,progressHandler);
function progressHandler(e:ProgressEvent):void {
trace(e.bytesLoaded/e.bytesTotal);
}
But notice, that your server has to support dispatching progress event for flash. Read the same problem here link