Rotating logos
I need to find out how to make a rotating design like the one on this website: http://www.carouselindustries.com/
The logos are cycling through. I have been searching the net to try to find a tutorial on how to do this and I cant seem to find one.
Any help would be much appreciated.
Thanks,
cp
Have a look here http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&extid=2141541
Similar Messages
-
Can you make a 3d rotating logo with illustrator to put on a website?
Hello! I need to make a rotating 3d logo for a website. Sort of like flash without flash. I tried gif builder but it didn't offer a rototing image. The logo is prettty much 3d already just need someway of getting it to rotate on a webpage. Any suggestions greatly appreciated!!!
As has already been mentioned, making the ubiquitous spinning extruded logo is considerably less tedious in other (and much cheaper) programs, like Xara 3D or Xara Designer. The lighting & shading is also better, because its output is raster.
But let's face it; spinning icons stopped being exciting about 15 years ago. It's about as stimulating these days as a slide transition in Powerpoint. There is no "wow" factor anymore. So one has to ask, what is worth the bother of doing it in Illustrator?
Three things:
First, if scaleability on the web page is required, the output frames need to be vector. (But don't go crazy with it. Instant-gratification features that try to do the illustrator's work for him [like 3D Effect] usually generate absurdly complicated constructs with far too many objects for practical vector animation.)
Second, practically speaking, Illustrator's value in this regard is limited to what must be frame-by-frame animations. For example, this simple animation is vector, and it's arguably more intersting than yet another logo spinning on its axis. But it's inadvisable for this animation to be built as frame-by-frame. There's nothing about it that requires frame-by-frame. It's just two vector paths that change over time in scale and rotation. Rotation and scale be scripted in Flash. The result is smoother and more supple animation, more efficient file size, and the real power of Flash, which is interactvity.
Example
Third, if you're going to justify the tedium of Illustrator, look for things that actually require Illustrator. For example, there's certainly nothing special about Blends. But one of the most important differentiating aspects of Blends in AI is that you can blend between live effects (and not just 3D Effect). The next example below exploits the peculiar nature of a Warp Effect's remaining oriented to the page as the object to which it is applied rotates. The example will be rasterized upon output, but the live vector Envelope and its blending expedites its creation. (The animation is on page 11 of the PDF. Allow the yellow alert to enable embedded media. Click in the middle of the page to start the SWF) :
Example.
Another Example.
Jay,
I don't know which of the above-described steps you are having trouble with. If it's the concept of using top-level Layers and removing the unwanted extra at the end of the loop, see this example:
Example
PDF
JET -
CC Cylinder (Coca Cola effect)- Rotating logo
Hello everyone,
I am having problems trying to copy this Coca Cola effect at the end of the video.[http://www.youtube.com/watch?feature=player_embedded&v=LGh0Uuo895c | http://www.youtube.com/watch?feature=player_embedded&v=LGh0Uuo895c]
I did it with the CC Cylinder effect on the logo and use alpha matte to the bottle.
The problem appears when I do the zoom in (adding a 3d null object to the precomposition also in 3d). The image don't look sharp, but I cannot activate the Continuous Rasterization because that needs every layer to be in 3d, and then the CC CYLINDER CORRUPTS.
I would really appreciate your help.
THANK YOU VERY MUCH,
Elbire -
Flash 8 xml rotator.swf and main timeline frame looping
Hi Y'all -
I have a purchased swf file that randomly rotates images (90
or them) located in an external xml file. It works fine in it's own
swf file.
The author suggested dragging the movie clip to the library
and to the stage. I did that in frame one, on its own layer of my
main swf file, followed by empty keyframes for all other frames in
the main swf. That works too, only showing the rotating logos in
frame one.
However, the stop(); actions on each of the other frames are
ignored, so that going to frame two on the main timeline starts
with the proper content and then continues on to the next frame and
the next. Without the rotator, buttons control the action and I
have no problem.
This link shows the problem -
http://uniconexed.org/bigflash/unicon-05-17-08-newlook.swf
I've tried attaching the swf file and unloading it, using
"create empty movie clip" (my current attempt outlined in the
code), and about a half dozen other ways to no avail.
I think I need to kill "play movie" when someone leaves frame
one (or enters any other frame) even though not all of the 90
images have displayed. It could be some depth issue, or lock root,
I dunno.
To restate, one of two things happen -
1) the scene continues to display the files randomly over top
of the content in the other frames (wrong) but the navigation
buttons work (correct)
or
2) the random images do not display in the other frames
(correct) but the navigation stops at each frame do not work
(wrong) - the swf file scrolls through each of the frames, ignoring
the stop(); at the top of each frame.
Any help that leads to success would be greatly appreciated.
DanHi there,
Try using...
unloadClip(myContent);
instead of
unloadMovie(myContent);
unloadClip is the proper method to use when removing content
created with the MovieClipLoader class -
Flash 10.2.159 installed but doesn't play
Doing my best to provide question and system info:
Finally got Flash Player 10.2.159.1 to install. I can see the rotating logo on your "about" page. However, cannot get video to play on other sites, including AOL, where it worked before.
I am running:
HP laptop on unsecured network. 64-bit machine. 32bit IE9 version 9.0.8112.16421 which was installed two days ago (4/20) and started the problem. Have deliberately invoked IE9 from start menu to insure using 32bit version.
I have uninstalled Flash, reinstalled, rebooted, etc. multiple times. Have tried both Manager and manual install. Last was via Manager.
I have no "kill bit" entry in the registry (did not delete, it wasn't there).
I have no install error log.
Files in windows/syswow64/macromed/Flash/
Flash10p.ocx
FlashInstall.txt
FlashUtil10p_ActiveX.dll
FlashUtil10p_ActiveX.exe
IE9 Manage Addons shows Adobe Shockwave Flash Object enabled, but with blank load time.
I run Norton Utilities (v 14.5.0.120) and Norton Internet Security (v 18.5.0.125). I have had no virus/malware/etc. errors since buying machine.
Cannot find any means in these packages to check on pop-up blockers. But don't see any notices of any, either. Registry analysis under Utilities shows no errors
I turned off the hardware accelerator.
I admit to being a mainframe programmer with little knowledge of PCs but have read other posts and tried to follow instructions. So, not knowledgable but may be capable.
Wouldn't have your job for all the tea in China, but will appreciate any help or suggestions. Currently unemployed and would really rather avoid $40 fee.Oh for crying out loud.
This appears to have solved the problem. AOL videos and others now work. Thank you.
Maybe this could be added to the instructions on installation/troubleshooting? Seems much simpler than checking kill bits in the registry. -
How to post and get data from server using Get Webrequest
Hi:-)
I'm trying to send a username and password argument my server and the server is suppose to send some string back. The following code, that I got of the web, just dies. I think this line:
HttpWebRequestpreq = result.AsyncState
asHttpWebRequest;
is null. Can you kindly fix this for me? Thank you in advance:-)
notes: I have a few textboxes with the values for the request params
I'm targeting Windows Phone 8.0 and Windows Phone 8.1 devices
privatevoidBtnSignUpSubmit_Tab(objectsender,
RoutedEventArgse)
//show error if Username == Username
if(TbUN.Text.ToString() ==
"Username")
MessageBox.Show("You
must fill in your Username in the Username textbox.\nThank you.");
return;
//make sure all fields are filled in
if(TbUN.Text.ToString() ==
""|| TbPW.Text.ToString()
== ""|| TbCPW.Text.ToString()
== "")
MessageBox.Show("All
fields must be filled in.\nThank you.");
return;
//make sure Password is the same as Confirm Password
if(TbPW.Text.CompareTo(TbCPW.Text) !=
0)
MessageBox.Show("Your
Password should be the same as Confirm Password.\nThank you.");
return;
//make sure Username contains valid characters
boolbValid = IsUsernameValid(TbUN.Text);
if(bValid)
bSignUp =
true;
//disable textboxes
TbUN.IsEnabled =
false;
TbPW.IsEnabled =
false;
TbCPW.IsEnabled =
false;
TbEmail.IsEnabled =
false;
BtnSignUpSubmit.IsEnabled =
false;
title.Text =
"requesting...";
//make Post request top-server
//add parameters
stringdata =
"username="+TbUN.Text+"&Password="+TbPW.Text;
if(TbEmail.Text.Contains("@")
&& TbEmail.Text.Contains("."))
data +=
"&email="+ TbEmail.Text;
System.
UriURL =
newUri("http://www.iclips.co.za/RegisterUsernameAndPassword.php");
WebRequestwebRequest =
WebRequest.Create(URL);
webRequest.Method =
"POST";
webRequest.ContentType =
"application/x-www-form-urlencoded";
webRequest.ContentLength = data.Length;
//we first obtain an input stream to which to write the body of the HTTP POST
webRequest.BeginGetRequestStream((
IAsyncResultresult) =>
HttpWebRequestpreq = result.AsyncState
asHttpWebRequest;
if(preq !=
null)
StreampostStream = preq.EndGetRequestStream(result);
//guess one could just accept a byte[] [via function argument] for arbitrary data types - images, audio,...
byte[] dataStream =
Encoding.UTF8.GetBytes(data);
postStream.Write(dataStream, 0, dataStream.Length);
postStream.Close();
//we can then finalize the request...
preq.BeginGetResponse((
IAsyncResultfinal_result) =>
HttpWebRequestreq = final_result.AsyncState
asHttpWebRequest;
if(req !=
null)
try
//we call the success callback as long as we get a response stream
WebResponseresponse = req.EndGetResponse(final_result);
success_callback(response.GetResponseStream());
catch(WebExceptionwe)
//otherwise call the error/failure callback
error_callback(we.Message);
return;
}, preq);
}, URL);
privatevoiderror_callback(stringp)
if(bSignUp)
bSignUp =
false;
// Show error message
MessageBox.Show("Connection
Error!\n\n"+ p);
//enable input
//disable textboxes
TbUN.IsEnabled =
true;
TbPW.IsEnabled =
true;
TbCPW.IsEnabled =
true;
TbEmail.IsEnabled =
true;
BtnSignUpSubmit.IsEnabled =
false;
title.Text =
"try again";
privatevoidsuccess_callback(Streamstream)
if(bSignUp)
bSignUp =
false;
// Open the stream using a StreamReader for easy access.
StreamReaderreader =
newStreamReader(stream);
// Read the content.
stringresponse = reader.ReadToEnd();
// Display the content.
MessageBox.Show(response);
// Clean up the streams.
reader.Close();// Directives
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using iClips.Resources;
using System.ComponentModel;
using System.Threading;
using System.IO;
using System.IO.IsolatedStorage;
using Microsoft.Devices;
using System.Windows.Media;
using Microsoft.Xna.Framework.Media;
using System.Windows.Media.Imaging;
using System.Threading.Tasks;
using System.Text;
using Windows.Storage;
using System.Windows.Threading;
using System.Diagnostics;
using System.Globalization;
namespace iClips
public partial class MainPage : PhoneApplicationPage
Boolean bSignUp;
HyperlinkButton BtnSignIn, BtnSignUp, BtnSignUpSubmit;
TextBox TbUN, TbPW, TbCPW, TbEmail;
TextBlock un, title;
System.DateTime startTime;
// Viewfinder for capturing video.
private VideoBrush videoRecorderBrush;
// Source and device for capturing video.
private CaptureSource captureSource;
private CaptureDevice vcDevice;
double w, h;
// File details for storing the recording.
private IsolatedStorageFileStream isoVideoFile;
private FileSink fileSink;
private string isoVideoFileName = "CameraMovie.mp4";
// For managing button and application state.
private enum ButtonState { Initialized, Stopped, Ready, Recording, Playback, Paused, NoChange, CameraNotSupported };
private ButtonState currentAppState;
//create reference to SocketClient
SocketClient sock = new SocketClient();
// Constructor
public MainPage()
InitializeComponent();
//setup recording
// Prepare ApplicationBar and buttons.
PhoneAppBar = (ApplicationBar)ApplicationBar;
PhoneAppBar.IsVisible = true;
StartRecording = ((ApplicationBarIconButton)ApplicationBar.Buttons[0]);
StopPlaybackRecording = ((ApplicationBarIconButton)ApplicationBar.Buttons[1]);
StartPlayback = ((ApplicationBarIconButton)ApplicationBar.Buttons[2]);
PausePlayback = ((ApplicationBarIconButton)ApplicationBar.Buttons[3]);
//display a welcome message
txtDebug.Text = "Welcome to iClips.";
string result = sock.Connect("197.189.214.116", 5000);
txtOutput.Text = result;
if(result.Contains("success")){
sock.Send("#testing_");
SetScreenResolution();
//set image on load friends
/*Uri uri = new Uri("/Assets/home_icons/myFriends.png", UriKind.Relative);
BitmapImage imgSource = new BitmapImage(uri);
Image image = new Image();
image.Source = imgSource;
load_friends.Content = image;*/
SignIn();
private void SignIn()
// remove all elements inside sign grid
for (int index = MyGrid.Children.Count - 1; index >= 0; index--)
MyGrid.Children.RemoveAt(index);
BtnSignIn = new HyperlinkButton();
BtnSignIn.Content = "<< Sign In >>";
BtnSignIn.Click += new RoutedEventHandler(SignIn_Tab);
BtnSignIn.VerticalAlignment = VerticalAlignment.Bottom;
BtnSignUp = new HyperlinkButton();
BtnSignUp.Content = "<< I'm new here. Sign Up. >>";
BtnSignUp.Click += new RoutedEventHandler(SignUp_Tab);
BtnSignUp.VerticalAlignment = VerticalAlignment.Bottom;
un = new TextBlock();
un.Text = "Enter your Username:";
un.VerticalAlignment = VerticalAlignment.Bottom;
un.HorizontalAlignment = HorizontalAlignment.Center;
TextBlock pw = new TextBlock();
pw.Text = "Enter your Password:";
pw.VerticalAlignment = VerticalAlignment.Bottom;
pw.HorizontalAlignment = HorizontalAlignment.Center;
//setup username textbox
TbUN = new TextBox();
TbUN.Opacity = 0.5;
TbUN.Text = "";
TbUN.FontSize = 16;
TbUN.FontWeight = FontWeights.ExtraBold;
TbUN.Foreground = new SolidColorBrush(Colors.Black);
TbUN.Background = new SolidColorBrush(Colors.Transparent);
TbUN.VerticalAlignment = VerticalAlignment.Top;
TbUN.Height = 70;
TbUN.Tap += TbUN_Tap;
//setup password textbox
TbPW = new TextBox();
TbPW.Opacity = 0.5;
TbPW.Text = "";
TbPW.FontSize = 16;
TbPW.FontWeight = FontWeights.ExtraBold;
TbPW.Foreground = new SolidColorBrush(Colors.Black);
TbPW.Background = new SolidColorBrush(Colors.Transparent);
TbPW.VerticalAlignment = VerticalAlignment.Top;
TbPW.Height = 70;
TbPW.Tap += TbPW_Tap;
//Show the background color of MyGrid
MyGrid.Background = new SolidColorBrush(Colors.Blue);
// Create Row for Username Textblock
RowDefinition gridRow0 = new RowDefinition();
gridRow0.Height = new GridLength(60);
MyGrid.RowDefinitions.Add(gridRow0);
// Create Row for Username
RowDefinition gridRow1 = new RowDefinition();
gridRow1.Height = new GridLength(60);
MyGrid.RowDefinitions.Add(gridRow1);
//create row for password Textblock
RowDefinition gridRow2a = new RowDefinition();
gridRow2a.Height = new GridLength(60);
MyGrid.RowDefinitions.Add(gridRow2a);
//create row for password
RowDefinition gridRow2 = new RowDefinition();
gridRow2.Height = new GridLength(60);
MyGrid.RowDefinitions.Add(gridRow2);
//create row for << Sign In >>
RowDefinition gridRow3 = new RowDefinition();
gridRow3.Height = new GridLength(60);
MyGrid.RowDefinitions.Add(gridRow3);
//create row for << Sign Up >>
RowDefinition gridRow4 = new RowDefinition();
gridRow4.Height = new GridLength(120);
MyGrid.RowDefinitions.Add(gridRow4);
Grid.SetRow(un, 0);
Grid.SetColumn(un, 0);
Grid.SetRow(TbUN, 1);
Grid.SetColumn(TbUN, 0);
Grid.SetRow(pw, 2);
Grid.SetColumn(pw, 0);
Grid.SetRow(TbPW, 3);
Grid.SetColumn(TbPW, 0);
Grid.SetRow(BtnSignIn, 4);
Grid.SetColumn(BtnSignIn, 0);
Grid.SetRow(BtnSignUp, 5);
Grid.SetColumn(BtnSignUp, 0);
MyGrid.Children.Add(un);
MyGrid.Children.Add(TbUN);
MyGrid.Children.Add(pw);
MyGrid.Children.Add(TbPW);
MyGrid.Children.Add(BtnSignIn);
MyGrid.Children.Add(BtnSignUp);
private void SignUp_Tab(object sender, RoutedEventArgs e)
MessageBox.Show("Welcome to Sign up.\n\nYou need 3 things to create an account:\n1. A unique Case-Sensitive Username. ex 'iClips' is not the same as 'Iclips'\n2. A password to secure you account. \n3. A profile photo for easy recognition.\nThank you.");
// remove all elements inside sign grid
for (int index = MyGrid.Children.Count - 1; index >= 0; index--)
MyGrid.Children.RemoveAt(index);
//repopulate grid with Sign Up elements
//create title
title = new TextBlock();
title.Text = "--- Sign Up 1/2 ---";
title.VerticalAlignment = VerticalAlignment.Top;
title.HorizontalAlignment = HorizontalAlignment.Center;
//field for Username
TbUN = new TextBox();
TbUN.Opacity = 0.5;
TbUN.Text = "Username";
TbUN.FontSize = 16;
TbUN.FontWeight = FontWeights.ExtraBold;
TbUN.Foreground = new SolidColorBrush(Colors.Black);
TbUN.Background = new SolidColorBrush(Colors.Transparent);
TbUN.VerticalAlignment = VerticalAlignment.Top;
TbUN.Height = 70;
TbUN.Tap += TbUN_Tap;
//field for Password
TbPW = new TextBox();
TbPW.Opacity = 0.5;
TbPW.Text = "Password";
TbPW.FontSize = 16;
TbPW.FontWeight = FontWeights.ExtraBold;
TbPW.Foreground = new SolidColorBrush(Colors.Black);
TbPW.Background = new SolidColorBrush(Colors.Transparent);
TbPW.VerticalAlignment = VerticalAlignment.Top;
TbPW.Height = 70;
TbPW.Tap += TbPW_Tap;
//field Confirm for Password
TbCPW = new TextBox();
TbCPW.Opacity = 0.5;
TbCPW.Text = "Confirm Password";
TbCPW.FontSize = 16;
TbCPW.FontWeight = FontWeights.ExtraBold;
TbCPW.Foreground = new SolidColorBrush(Colors.Black);
TbCPW.Background = new SolidColorBrush(Colors.Transparent);
TbCPW.VerticalAlignment = VerticalAlignment.Top;
TbCPW.Height = 70;
TbCPW.Tap += TbCPW_Tap;
//field for Optional Email
TbEmail = new TextBox();
TbEmail.Opacity = 0.5;
TbEmail.Text = "Email (Optional)";
TbEmail.FontSize = 16;
TbEmail.FontWeight = FontWeights.ExtraBold;
TbEmail.Foreground = new SolidColorBrush(Colors.Black);
TbEmail.Background = new SolidColorBrush(Colors.Transparent);
TbEmail.VerticalAlignment = VerticalAlignment.Top;
TbEmail.Height = 70;
TbEmail.Tap += TbEmail_Tap;
HyperlinkButton BtnGoBack = new HyperlinkButton();
BtnGoBack.Content = "<< Go Back ";
BtnGoBack.Click += new RoutedEventHandler(BtnGoBack_Tab);
BtnGoBack.VerticalAlignment = VerticalAlignment.Bottom;
BtnSignUpSubmit = new HyperlinkButton();
BtnSignUpSubmit.Content = "<< Sign Up >>";
BtnSignUpSubmit.Click += new RoutedEventHandler(BtnSignUpSubmit_Tab);
BtnSignUpSubmit.VerticalAlignment = VerticalAlignment.Bottom;
// Create Row for title
RowDefinition gridRow0 = new RowDefinition();
gridRow0.Height = new GridLength(60);
MyGrid.RowDefinitions.Add(gridRow0);
// Create Row for Username
RowDefinition gridRow1 = new RowDefinition();
gridRow1.Height = new GridLength(60);
MyGrid.RowDefinitions.Add(gridRow1);
//create row for password Textblock
RowDefinition gridRow2a = new RowDefinition();
gridRow2a.Height = new GridLength(60);
MyGrid.RowDefinitions.Add(gridRow2a);
//create row for Confirm password
RowDefinition gridRow2 = new RowDefinition();
gridRow2.Height = new GridLength(60);
MyGrid.RowDefinitions.Add(gridRow2);
//create row for email
RowDefinition gridRow3 = new RowDefinition();
gridRow3.Height = new GridLength(60);
MyGrid.RowDefinitions.Add(gridRow3);
//create row for << Sign Up >>
RowDefinition gridRow4 = new RowDefinition();
gridRow4.Height = new GridLength(120);
MyGrid.RowDefinitions.Add(gridRow4);
//create row for << Go Back >>
RowDefinition gridRow5 = new RowDefinition();
gridRow5.Height = new GridLength(120);
MyGrid.RowDefinitions.Add(gridRow5);
Grid.SetRow(title, 0);
Grid.SetColumn(title, 0);
Grid.SetRow(TbUN, 1);
Grid.SetColumn(TbUN, 0);
Grid.SetRow(TbPW, 2);
Grid.SetColumn(TbPW, 0);
Grid.SetRow(TbCPW, 3);
Grid.SetColumn(TbCPW, 0);
Grid.SetRow(TbEmail, 4);
Grid.SetColumn(TbEmail, 0);
Grid.SetRow(BtnSignUpSubmit, 5);
Grid.SetColumn(BtnSignUpSubmit, 0);
Grid.SetRow(BtnGoBack, 6);
Grid.SetColumn(BtnGoBack, 0);
MyGrid.Children.Add(title);
MyGrid.Children.Add(TbUN);
MyGrid.Children.Add(TbPW);
MyGrid.Children.Add(TbCPW);
MyGrid.Children.Add(TbEmail);
MyGrid.Children.Add(BtnSignUpSubmit);
MyGrid.Children.Add(BtnGoBack);
BtnSignUp.Content = "<< Sign Up >>";
private bool IsUsernameValid(string str)
int d;
if (str.Length > 30)
MessageBox.Show("You may only use a maximum of 30 characters for your Username.\nThank you.");
return false;
for (d = 0; d < str.Length; d++)
if (str.Contains("~") || str.Contains("!") || str.Contains("@") || str.Contains("$")
|| str.Contains("#") || str.Contains("%") || str.Contains("|") || str.Contains("_"))
MessageBox.Show("Your Username may not contain any of the follwing characters: \n~ ! @ # $ % | _\nThank you.");
return false;
return true;
private void BtnSignUpSubmit_Tab(object sender, RoutedEventArgs e)
//show error if Username == Username
if (TbUN.Text.ToString() == "Username")
MessageBox.Show("You must fill in your Username in the Username textbox.\nThank you.");
return;
//make sure all fields are filled in
if (TbUN.Text.ToString() == "" || TbPW.Text.ToString() == "" || TbCPW.Text.ToString() == "")
MessageBox.Show("All fields must be filled in.\nThank you.");
return;
//make sure Password is the same as Confirm Password
if (TbPW.Text.CompareTo(TbCPW.Text) != 0)
MessageBox.Show("Your Password should be the same as Confirm Password.\nThank you.");
return;
//make sure Username contains valid characters
bool bValid = IsUsernameValid(TbUN.Text);
if (bValid)
bSignUp = true;
//disable textboxes
TbUN.IsEnabled = false;
TbPW.IsEnabled = false;
TbCPW.IsEnabled = false;
TbEmail.IsEnabled = false;
BtnSignUpSubmit.IsEnabled = false;
title.Text = "requesting...";
//make Post request top-server
//add parameters
string data = "username="+TbUN.Text+"&Password="+TbPW.Text;
if(TbEmail.Text.Contains("@") && TbEmail.Text.Contains("."))
data += "&email=" + TbEmail.Text;
System.Uri URL = new Uri("http://www.iclips.co.za/RegisterUsernameAndPassword.php");
WebRequest webRequest = WebRequest.Create(URL);
webRequest.Method = "POST";
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.ContentLength = data.Length;
//we first obtain an input stream to which to write the body of the HTTP POST
webRequest.BeginGetRequestStream((IAsyncResult result) =>
HttpWebRequest preq = result.AsyncState as HttpWebRequest;
if (preq != null)
Stream postStream = preq.EndGetRequestStream(result);
//guess one could just accept a byte[] [via function argument] for arbitrary data types - images, audio,...
byte[] dataStream = Encoding.UTF8.GetBytes(data);
postStream.Write(dataStream, 0, dataStream.Length);
postStream.Close();
//we can then finalize the request...
preq.BeginGetResponse((IAsyncResult final_result) =>
HttpWebRequest req = final_result.AsyncState as HttpWebRequest;
if (req != null)
try
//we call the success callback as long as we get a response stream
WebResponse response = req.EndGetResponse(final_result);
success_callback(response.GetResponseStream());
catch (WebException we)
//otherwise call the error/failure callback
error_callback(we.Message);
return;
}, preq);
}, URL);
private void error_callback(string p)
if (bSignUp)
bSignUp = false;
// Show error message
MessageBox.Show("Connection Error!\n\n" + p);
//enable input
//disable textboxes
TbUN.IsEnabled = true;
TbPW.IsEnabled = true;
TbCPW.IsEnabled = true;
TbEmail.IsEnabled = true;
BtnSignUpSubmit.IsEnabled = false;
title.Text = "try again";
private void success_callback(Stream stream)
if (bSignUp)
bSignUp = false;
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader(stream);
// Read the content.
string response = reader.ReadToEnd();
// Display the content.
MessageBox.Show(response);
// Clean up the streams.
reader.Close();
private void BtnGoBack_Tab(object sender, RoutedEventArgs e)
SignIn();
private void TbEmail_Tap(object sender, System.Windows.Input.GestureEventArgs e)
TbEmail.SelectAll();
private void TbCPW_Tap(object sender, System.Windows.Input.GestureEventArgs e)
TbCPW.SelectAll();
private void SignIn_Tab(object sender, RoutedEventArgs e)
if (TbUN.Text.ToString() == "" || TbPW.Text.ToString() == "")
MessageBox.Show("Your Username or Password cannot be empty.\nThank you.");
return;
private void TbUN_Tap(object sender, System.Windows.Input.GestureEventArgs e)
TbUN.SelectAll();
un.Text = "Usernames are Case-Sensitive.\n'Iclips' is not the same as 'iClips'.";
private void TbPW_Tap(object sender, System.Windows.Input.GestureEventArgs e)
TbPW.SelectAll();
protected override void OnNavigatedTo(NavigationEventArgs e)
base.OnNavigatedTo(e);
// Initialize the video recorder.
InitializeVideoRecorder();
CameraButtons.ShutterKeyHalfPressed += OnButtonHalfPress;
// The event is fired when the shutter button receives a full press.
CameraButtons.ShutterKeyPressed += OnButtonFullPress;
// The event is fired when the shutter button is released.
CameraButtons.ShutterKeyReleased += OnButtonRelease;
protected override void OnNavigatedFrom(NavigationEventArgs e)
// Dispose of camera and media objects.
DisposeVideoPlayer();
DisposeVideoRecorder();
base.OnNavigatedFrom(e);
CameraButtons.ShutterKeyHalfPressed -= OnButtonHalfPress;
CameraButtons.ShutterKeyPressed -= OnButtonFullPress;
CameraButtons.ShutterKeyReleased -= OnButtonRelease;
// Ensure that the viewfinder is upright in LandscapeRight.
protected override void OnOrientationChanged(OrientationChangedEventArgs e)
if (vcDevice != null)
if (e.Orientation == PageOrientation.LandscapeLeft)
txtDebug.Text = "LandscapeLeft";
videoRecorderBrush.RelativeTransform =
new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 90 };
//rotate logo
if (logo != null)
RotateTransform rt = new RotateTransform();
rt.Angle = 90;
//default rotation is around top left corner of the control,
//but you sometimes want to rotate around the center of the control
//to do that, you need to set the RenderTransFormOrigin
//of the item you're going to rotate
//I did not test this approach, maybe You're going to need to use actual coordinates
//so this bit is for information purposes only
logo.RenderTransformOrigin = new Point(0.5, 0.5);
logo.RenderTransform = rt;
//rotate sign in link
if (MyGrid != null)
RotateTransform rt = new RotateTransform();
rt.Angle = 90;
//default rotation is around top left corner of the control,
//but you sometimes want to rotate around the center of the control
//to do that, you need to set the RenderTransFormOrigin
//of the item you're going to rotate
//I did not test this approach, maybe You're going to need to use actual coordinates
//so this bit is for information purposes only
MyGrid.RenderTransformOrigin = new Point(0.5, 0.5);
MyGrid.RenderTransform = rt;
if (e.Orientation == PageOrientation.PortraitUp)
txtDebug.Text = "PortraitUp";
videoRecorderBrush.RelativeTransform =
new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 0 };
//rotate logo
if (logo != null)
RotateTransform rt = new RotateTransform();
rt.Angle = 0;
//default rotation is around top left corner of the control,
//but you sometimes want to rotate around the center of the control
//to do that, you need to set the RenderTransFormOrigin
//of the item you're going to rotate
//I did not test this approach, maybe You're going to need to use actual coordinates
//so this bit is for information purposes only
logo.RenderTransformOrigin = new Point(0.5, 0.5);
logo.RenderTransform = rt;
//rotate sign in link
if (MyGrid != null)
RotateTransform rt = new RotateTransform();
rt.Angle = 0;
//default rotation is around top left corner of the control,
//but you sometimes want to rotate around the center of the control
//to do that, you need to set the RenderTransFormOrigin
//of the item you're going to rotate
//I did not test this approach, maybe You're going to need to use actual coordinates
//so this bit is for information purposes only
MyGrid.RenderTransformOrigin = new Point(0.5, 0.5);
MyGrid.RenderTransform = rt;
if (e.Orientation == PageOrientation.LandscapeRight)
txtDebug.Text = "LandscapeRight";
// Rotate for LandscapeRight orientation.
//videoRecorderBrush.RelativeTransform =
//new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 180 };
//rotate logo
if (logo != null)
RotateTransform rt = new RotateTransform();
rt.Angle = -90;
//default rotation is around top left corner of the control,
//but you sometimes want to rotate around the center of the control
//to do that, you need to set the RenderTransFormOrigin
//of the item you're going to rotate
//I did not test this approach, maybe You're going to need to use actual coordinates
//so this bit is for information purposes only
logo.RenderTransformOrigin = new Point(0.5, 0.5);
logo.RenderTransform = rt;
//rotate sign in link
if (MyGrid != null)
RotateTransform rt = new RotateTransform();
rt.Angle = -90;
//default rotation is around top left corner of the control,
//but you sometimes want to rotate around the center of the control
//to do that, you need to set the RenderTransFormOrigin
//of the item you're going to rotate
//I did not test this approach, maybe You're going to need to use actual coordinates
//so this bit is for information purposes only
MyGrid.RenderTransformOrigin = new Point(0.5, 0.5);
MyGrid.RenderTransform = rt;
if (e.Orientation == PageOrientation.PortraitDown)
txtDebug.Text = "PortraitDown";
videoRecorderBrush.RelativeTransform =
new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 270 };
// Provide auto-focus with a half button press using the hardware shutter button.
private void OnButtonHalfPress(object sender, EventArgs e)
// Focus when a capture is not in progress.
try
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = "Half Button Press: Auto Focus";
catch (Exception focusError)
// Cannot focus when a capture is in progress.
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = focusError.Message;
// Capture the image with a full button press using the hardware shutter button.
private void OnButtonFullPress(object sender, EventArgs e)
// Focus when a capture is not in progress.
try
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = "Full Button Press: Auto Focus";
catch (Exception focusError)
// Cannot focus when a capture is in progress.
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = focusError.Message;
// Cancel the focus if the half button press is released using the hardware shutter button.
private void OnButtonRelease(object sender, EventArgs e)
try
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = "Shutter is released: Auto Focus";
catch (Exception focusError)
// Cannot focus when a capture is in progress.
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = focusError.Message;
// Update the buttons and text on the UI thread based on app state.
private void UpdateUI(ButtonState currentButtonState, string statusMessage)
// Run code on the UI thread.
Dispatcher.BeginInvoke(delegate
switch (currentButtonState)
// When the camera is not supported by the phone.
case ButtonState.CameraNotSupported:
StartRecording.IsEnabled = false;
StopPlaybackRecording.IsEnabled = false;
StartPlayback.IsEnabled = false;
PausePlayback.IsEnabled = false;
break;
// First launch of the application, so no video is available.
case ButtonState.Initialized:
StartRecording.IsEnabled = true;
StopPlaybackRecording.IsEnabled = false;
StartPlayback.IsEnabled = false;
PausePlayback.IsEnabled = false;
break;
// Ready to record, so video is available for viewing.
case ButtonState.Ready:
StartRecording.IsEnabled = true;
StopPlaybackRecording.IsEnabled = false;
StartPlayback.IsEnabled = true;
PausePlayback.IsEnabled = false;
break;
// Video recording is in progress.
case ButtonState.Recording:
StartRecording.IsEnabled = false;
StopPlaybackRecording.IsEnabled = true;
StartPlayback.IsEnabled = false;
PausePlayback.IsEnabled = false;
break;
// Video playback is in progress.
case ButtonState.Playback:
StartRecording.IsEnabled = false;
StopPlaybackRecording.IsEnabled = true;
StartPlayback.IsEnabled = false;
PausePlayback.IsEnabled = true;
break;
// Video playback has been paused.
case ButtonState.Paused:
StartRecording.IsEnabled = false;
StopPlaybackRecording.IsEnabled = true;
StartPlayback.IsEnabled = true;
PausePlayback.IsEnabled = false;
break;
default:
break;
// Display a message.
txtDebug.Text = statusMessage;
// Note the current application state.
currentAppState = currentButtonState;
public void InitializeVideoRecorder()
if (captureSource == null)
// Create the VideoRecorder objects.
captureSource = new CaptureSource();
fileSink = new FileSink();
vcDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();
// Add eventhandlers for captureSource.
captureSource.CaptureFailed += new EventHandler<ExceptionRoutedEventArgs>(OnCaptureFailed);
// Initialize the camera if it exists on the phone.
if (vcDevice != null)
// Create the VideoBrush for the viewfinder.
videoRecorderBrush = new VideoBrush();
videoRecorderBrush.SetSource(captureSource);
// Display the viewfinder image on the rectangle.
viewfinderRectangle.Fill = videoRecorderBrush;
// Start video capture and display it on the viewfinder.
captureSource.Start();
// Set the button state and the message.
UpdateUI(ButtonState.Initialized, "Tap record to start recording...");
else
// Disable buttons when the camera is not supported by the phone.
UpdateUI(ButtonState.CameraNotSupported, "A camera is not supported on this phone.");
// Set recording state: start recording.
private void StartVideoRecording()
try
// Connect fileSink to captureSource.
if (captureSource.VideoCaptureDevice != null
&& captureSource.State == CaptureState.Started)
captureSource.Stop();
// Connect the input and output of fileSink.
fileSink.CaptureSource = captureSource;
fileSink.IsolatedStorageFileName = isoVideoFileName;
// Begin recording.
if (captureSource.VideoCaptureDevice != null
&& captureSource.State == CaptureState.Stopped)
captureSource.Start();
// Set the button states and the message.
UpdateUI(ButtonState.Recording, "Recording...");
StartTimer();
// If recording fails, display an error.
catch (Exception e)
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = "ERROR: " + e.Message.ToString();
//start the timer
private void StartTimer()
dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
dispatcherTimer.Start();
startTime = System.DateTime.Now;
private void StopTimer()
dispatcherTimer.Stop();
private void dispatcherTimer_Tick(object sender, EventArgs e)
System.DateTime now = System.DateTime.Now;
txtRecTime.Text = now.Subtract(startTime).ToString();
// Set the recording state: stop recording.
private void StopVideoRecording()
try
// Stop recording.
if (captureSource.VideoCaptureDevice != null
&& captureSource.State == CaptureState.Started)
captureSource.Stop();
// Disconnect fileSink.
fileSink.CaptureSource = null;
fileSink.IsolatedStorageFileName = null;
// Set the button states and the message.
UpdateUI(ButtonState.Stopped, "Preparing viewfinder...");
StopTimer();
StartVideoPreview();
// If stop fails, display an error.
catch (Exception e)
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = "ERROR: " + e.Message.ToString();
// Set the recording state: display the video on the viewfinder.
private void StartVideoPreview()
try
// Display the video on the viewfinder.
if (captureSource.VideoCaptureDevice != null
&& captureSource.State == CaptureState.Stopped)
// Add captureSource to videoBrush.
videoRecorderBrush.SetSource(captureSource);
// Add videoBrush to the visual tree.
viewfinderRectangle.Fill = videoRecorderBrush;
captureSource.Start();
// Set the button states and the message.
UpdateUI(ButtonState.Ready, "Ready to record.");
// If preview fails, display an error.
catch (Exception e)
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = "ERROR: " + e.Message.ToString();
// Start the video recording.
private void StartRecording_Click(object sender, EventArgs e)
// Avoid duplicate taps.
StartRecording.IsEnabled = false;
StartVideoRecording();
// Handle stop requests.
private void StopPlaybackRecording_Click(object sender, EventArgs e)
// Avoid duplicate taps.
StopPlaybackRecording.IsEnabled = false;
// Stop during video recording.
if (currentAppState == ButtonState.Recording)
StopVideoRecording();
// Set the button state and the message.
UpdateUI(ButtonState.NoChange, "Recording stopped.");
// Stop during video playback.
else
// Remove playback objects.
DisposeVideoPlayer();
StartVideoPreview();
// Set the button state and the message.
UpdateUI(ButtonState.NoChange, "Playback stopped.");
// Start video playback.
private void StartPlayback_Click(object sender, EventArgs e)
// Avoid duplicate taps.
StartPlayback.IsEnabled = false;
// Start video playback when the file stream exists.
if (isoVideoFile != null)
VideoPlayer.Play();
// Start the video for the first time.
else
// Stop the capture source.
captureSource.Stop();
// Remove VideoBrush from the tree.
viewfinderRectangle.Fill = null;
// Create the file stream and attach it to the MediaElement.
isoVideoFile = new IsolatedStorageFileStream(isoVideoFileName,
FileMode.Open, FileAccess.Read,
IsolatedStorageFile.GetUserStoreForApplication());
VideoPlayer.SetSource(isoVideoFile);
// Add an event handler for the end of playback.
VideoPlayer.MediaEnded += new RoutedEventHandler(VideoPlayerMediaEnded);
// Start video playback.
VideoPlayer.Play();
// Set the button state and the message.
UpdateUI(ButtonState.Playback, "Playback started.");
// Pause video playback.
private void PausePlayback_Click(object sender, EventArgs e)
// Avoid duplicate taps.
PausePlayback.IsEnabled = false;
// If mediaElement exists, pause playback.
if (VideoPlayer != null)
VideoPlayer.Pause();
// Set the button state and the message.
UpdateUI(ButtonState.Paused, "Playback paused.");
private void DisposeVideoPlayer()
if (VideoPlayer != null)
// Stop the VideoPlayer MediaElement.
VideoPlayer.Stop();
// Remove playback objects.
VideoPlayer.Source = null;
isoVideoFile = null;
// Remove the event handler.
VideoPlayer.MediaEnded -= VideoPlayerMediaEnded;
private void DisposeVideoRecorder()
if (captureSource != null)
// Stop captureSource if it is running.
if (captureSource.VideoCaptureDevice != null
&& captureSource.State == CaptureState.Started)
captureSource.Stop();
// Remove the event handler for captureSource.
captureSource.CaptureFailed -= OnCaptureFailed;
// Remove the video recording objects.
captureSource = null;
vcDevice = null;
fileSink = null;
videoRecorderBrush = null;
// If recording fails, display an error message.
private void OnCaptureFailed(object sender, ExceptionRoutedEventArgs e)
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = "ERROR: " + e.ErrorException.Message.ToString();
// Display the viewfinder when playback ends.
public void VideoPlayerMediaEnded(object sender, RoutedEventArgs e)
// Remove the playback objects.
DisposeVideoPlayer();
StartVideoPreview();
public void SetScreenResolution()
w = Application.Current.Host.Content.ActualWidth;
h = Application.Current.Host.Content.ActualHeight;
setResViewF(w, h);
public void setResViewF(double width, double height)
viewfinderRectangle.Width = width;
viewfinderRectangle.Height = height;
resMI.Content = "resolution: " + width + "*" + height;
private void resMI_Click(object sender, RoutedEventArgs e)
switch (resMI.Content.ToString())
case "resolution: 176*220":
setResViewF(240, 320);
break;
case "resolution: 240*320":
setResViewF(360, 480);
break;
case "resolution: 360*480":
setResViewF(480, 800);
break;
case "resolution: 480*800":
setResViewF(1440, 720);
break;
case "resolution: 1440*720":
setResViewF(1920, 1080);
break;
case "resolution: 1920*1080":
setResViewF(176, 220);
break;
default:
setResViewF(176, 220);
break;
public void WriteToFile(string key, string value)
var Iso_settings = System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings;
if (!Iso_settings.Contains(key))
Iso_settings.Add(key, value);
Iso_settings.Save();//This will save your data in isolated storage.
public string ReadFromFile(string key)
var Iso_settings = System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings;
if (Iso_settings.Contains(key))
return (string)Iso_settings[key];
else
return null;
public DispatcherTimer dispatcherTimer { get; set; }
private void ToggleZoom(MediaElement media)
if (media.Stretch != Stretch.UniformToFill)
// zoom
media.Stretch = Stretch.UniformToFill;
else
// unzoom
media.Stretch = Stretch.Uniform;
BtnSignUpSubmit_Tab is the HyperLinkButton that would trigger the web request process. I need this code to work perfectly because a lot of people will use this. If you can simplify the http web request that already feels so good. Thank you. -
Error while loading a swf created in flash cs4, inside a flex application
Hi there,
I have created a rotating logo in flash cs4 using motion presets, named logoRotar.swf. I have used this inside my flex application:
<mx:SWFLoader width="33.33%" height="100%" source="assets/logoRotar.swf">
When I execute the flex application, I get this runtime error message:
VerifyError: Error #1014: Class flash.geom::Matrix3D could not be found.
at global$init()
at fl.motion::AnimatorFactory3D/getNewAnimator()
at fl.motion::AnimatorFactoryBase/addTargetInfo()
at logoRotar_fla::MainTimeline()
I also tried adding import flash.geom.*; statement in my flex application, I still get the same message.
Flash player 10,0,22,87 is running in my browser.
Please help me out....
Cheers!
DeepakGet Flex 3.3 and use -target-player=10
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
Blog: http://blogs.adobe.com/aharui -
IPod classic won't synch...or eject
Hello all,
I think my iPod has somehow become 'unsynched' with iTunes. I noticed recently that when I connect to iTunes my iPod itself says it's synching, and I get the little rotating logo (I'm set up in iTunes to synch manually) before it settles. When I then try to synch I get a message saying '...cannot be synched. The required disk cannot be found'.
When I then try to eject, my iPod disappears from iTunes but it still says it's connected, and the icon is still on my desktop and I cannot eject it via Finder. The only way I can get rid of it from my desktop is to shut down my computer. I've already done this a few times but it hasn't cleared the problem. Is my only option now to restore my iPod to factory settings? I have just updated to the latest version of iTunes, but the problem occurred just before that anyway.
Thanks in advance.Hi,
I've since discovered that my iPod will synch / eject properly if I turn off my computer while the iPod is still connected to it. I obviously don't won't to have to keep turning my computer off and on just to update my iPod files every time, though. Can nobody really answer this? Please? :-( -
AlivePDF seems to flip image alond axis?
Hi,
In my flash file, I allow the user to rotate an image. After the image is rotated, the user can save the edited image as a PDF. I'm using AlivePDF for saves.
Here is the problem: If the user rotates in the X or Y, the pdf image looks flipped along the respective axis(for example, if I rotate in the X, the image looks like it rotated properly, but the perspective is reversed). If the rotation is in the Z, there is no issue. The event listeners are attached to slider components.
Here is an image to clarify-
My question: How can I get the image to render properly in the PDF?
Rotate Code:
//rotate logo around the X axis
logoRotX.text = "Rotate X: 0"
logoRotateX.value = 0;
logoRotateX.addEventListener(SliderEvent.CHANGE, logoRotateXPos);
function logoRotateXPos (event:SliderEvent): void
logoRotX.text = "Rotate X: " + event.target.value;
container.rotationX = event.target.value;
//rotate logo around the Y axis
logoRotY.text = "Rotate Y: 0"
logoRotateY.value = 0;
logoRotateY.addEventListener(SliderEvent.CHANGE, logoRotateYPos);
function logoRotateYPos (event:SliderEvent): void
logoRotY.text = "Rotate Y: " + event.target.value;
container.rotationY = event.target.value;
//rotate logo around the Z axis
logoRotateZ.value = 0;
logoRotateZ.addEventListener(SliderEvent.CHANGE, logoRotateZPos);
function logoRotateZPos (event:SliderEvent): void
logoRotZ.text = "Rotate Z: " + event.target.value;
container.rotationZ = event.target.value;
Save PDF code:
createPdfBTN.addEventListener(MouseEvent.CLICK, makePDF);
function makePDF(evt: MouseEvent)
var myPDF : PDF = new PDF (Orientation.PORTRAIT,Unit.INCHES, Size.LETTER);
myPDF.setDisplayMode(Display.FULL_PAGE);
myPDF.addPage();
// add a background image
var PDFsampleData: BitmapData = new BitmapData(BGContain.width, BGContain.height);
PDFsampleData.draw(BGContain);
var PDFjpg:JPGEncoder = new JPGEncoder(100);
var PDFba:ByteArray = PDFjpg.encode(PDFsampleData);
var timesbold:IFont = new CoreFont(FontFamily.TIMES_BOLD);
myPDF.addImage(BGContain);
myPDF.setFont(timesbold, 12);
myPDF.addText("Disclaimer: This image is for visualization purposes only and is not a proof.",.5,10);
// save PDF
var fileReference:FileReference = new FileReference();
var pdfByteArray = myPDF.save(Method.LOCAL);
fileReference.save(pdfByteArray, 'Your Sample.PDF');I fixed this by using ScaleX and ScaleY instead of rotateX and rotateY. Now, the PDF renders fine.
-
Hi. Which Directive/Class will be the better choice if your app is mainly a video camera app. I saw about 3 different Classes to capture videos. I'm currently using Microsoft.Devices/CaptureDevice to capture video. It looks limited to me because found
out I can't pause==>resume a recording. And what about Zooming? Can you tell me which way I want to go if I want to make sure my camera functionality is powerful? Which directive/class and if possible some code example on how to use it and maybe how to
zoom, focus ect. Thank you very muchI'm now using AudioVideoCaptureDevice to capture video and I can do that but the app crash when I try to set the source for the capture device in InitializeVideoRecorder(). Can you take a look and tell me what I'm doing wrong?
Here's some code snippet:
// Viewfinder for capturing video.
private VideoBrush videoRecorderBrush;
// Source and device for capturing video.
private CaptureSource _cs;
private VideoCaptureDevice _cd;
private AudioVideoCaptureDevice vcDevice;
double w, h;
// File details for storing the recording.
private IsolatedStorageFileStream isoVideoFile;
private FileSink fileSink;
private string isoVideoFileName = "iClips_Video.mp4";
private StorageFile sfVideoFile;
// For managing button and application state.
private enum ButtonState { Initialized, Stopped, Ready, Recording, Playback, Paused, NoChange, CameraNotSupported };
private ButtonState currentAppState;
// Constructor
public MainPage()
try
InitializeComponent();
//setup recording
// Prepare ApplicationBar and buttons.
PhoneAppBar = (ApplicationBar)ApplicationBar;
PhoneAppBar.IsVisible = true;
StartRecording = ((ApplicationBarIconButton)ApplicationBar.Buttons[0]);
StopPlaybackRecording = ((ApplicationBarIconButton)ApplicationBar.Buttons[1]);
StartPlayback = ((ApplicationBarIconButton)ApplicationBar.Buttons[2]);
PausePlayback = ((ApplicationBarIconButton)ApplicationBar.Buttons[3]);
SetScreenResolution();
//initialize the camera task
cameraCaptureTask = new CameraCaptureTask();
cameraCaptureTask.Completed += new EventHandler<PhotoResult>(cameraCaptureTask_Completed);
if (isFilePresent("username") && isFilePresent("Password"))
if (isFilePresent("IsProfilePhotoOnServer"))
connectToSocket();
else
SignUpProfilePhoto();
else
SignIn();
catch (Exception ex)
this.Dispatcher.BeginInvoke(delegate()
MessageBox.Show("Constructor Error:\n"+ ex.Message);
protected override void OnNavigatedTo(NavigationEventArgs e)
base.OnNavigatedTo(e);
// Initialize the video recorder.
InitializeVideoRecorder();
//prepare shutter hot keys
CameraButtons.ShutterKeyHalfPressed += OnButtonHalfPress;
CameraButtons.ShutterKeyPressed += OnButtonFullPress;
CameraButtons.ShutterKeyReleased += OnButtonRelease;
protected override void OnNavigatedFrom(NavigationEventArgs e)
// Dispose of camera and media objects.
DisposeVideoPlayer();
DisposeVideoRecorder();
base.OnNavigatedFrom(e);
CameraButtons.ShutterKeyHalfPressed -= OnButtonHalfPress;
CameraButtons.ShutterKeyPressed -= OnButtonFullPress;
CameraButtons.ShutterKeyReleased -= OnButtonRelease;
protected override void OnOrientationChanged(OrientationChangedEventArgs e)
if (vcDevice != null)
if (e.Orientation == PageOrientation.LandscapeLeft)
txtDebug.Text = "LandscapeLeft";
videoRecorderBrush.RelativeTransform =
new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 90 };
//rotate logo
if (logo != null)
RotateTransform rt = new RotateTransform();
rt.Angle = 90;
//default rotation is around top left corner of the control,
//but you sometimes want to rotate around the center of the control
//to do that, you need to set the RenderTransFormOrigin
//of the item you're going to rotate
//I did not test this approach, maybe You're going to need to use actual coordinates
//so this bit is for information purposes only
logo.RenderTransformOrigin = new Point(0.5, 0.5);
logo.RenderTransform = rt;
//rotate sign in link
if (MyGrid != null)
RotateTransform rt = new RotateTransform();
rt.Angle = 90;
//default rotation is around top left corner of the control,
//but you sometimes want to rotate around the center of the control
//to do that, you need to set the RenderTransFormOrigin
//of the item you're going to rotate
//I did not test this approach, maybe You're going to need to use actual coordinates
//so this bit is for information purposes only
MyGrid.RenderTransformOrigin = new Point(0.5, 0.5);
MyGrid.RenderTransform = rt;
if (e.Orientation == PageOrientation.PortraitUp)
txtDebug.Text = "PortraitUp";
videoRecorderBrush.RelativeTransform =
new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 90 };
//rotate logo
if (logo != null)
RotateTransform rt = new RotateTransform();
rt.Angle = 0;
//default rotation is around top left corner of the control,
//but you sometimes want to rotate around the center of the control
//to do that, you need to set the RenderTransFormOrigin
//of the item you're going to rotate
//I did not test this approach, maybe You're going to need to use actual coordinates
//so this bit is for information purposes only
logo.RenderTransformOrigin = new Point(0.5, 0.5);
logo.RenderTransform = rt;
//rotate sign in link
if (MyGrid != null)
RotateTransform rt = new RotateTransform();
rt.Angle = 0;
//default rotation is around top left corner of the control,
//but you sometimes want to rotate around the center of the control
//to do that, you need to set the RenderTransFormOrigin
//of the item you're going to rotate
//I did not test this approach, maybe You're going to need to use actual coordinates
//so this bit is for information purposes only
MyGrid.RenderTransformOrigin = new Point(0.5, 0.5);
MyGrid.RenderTransform = rt;
if (e.Orientation == PageOrientation.LandscapeRight)
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = "LandscapeRight";
// Rotate for LandscapeRight orientation.
//videoRecorderBrush.RelativeTransform =
//new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 180 };
//rotate logo
if (logo != null)
RotateTransform rt = new RotateTransform();
rt.Angle = -90;
//default rotation is around top left corner of the control,
//but you sometimes want to rotate around the center of the control
//to do that, you need to set the RenderTransFormOrigin
//of the item you're going to rotate
//I did not test this approach, maybe You're going to need to use actual coordinates
//so this bit is for information purposes only
logo.RenderTransformOrigin = new Point(0.5, 0.5);
logo.RenderTransform = rt;
//rotate MyGrid
if (MyGrid != null)
RotateTransform rt = new RotateTransform();
rt.Angle = -90;
//default rotation is around top left corner of the control,
//but you sometimes want to rotate around the center of the control
//to do that, you need to set the RenderTransFormOrigin
//of the item you're going to rotate
//I did not test this approach, maybe You're going to need to use actual coordinates
//so this bit is for information purposes only
MyGrid.RenderTransformOrigin = new Point(0.5, 0.5);
MyGrid.RenderTransform = rt;
if (e.Orientation == PageOrientation.PortraitDown)
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = "PortraitDown";
videoRecorderBrush.RelativeTransform =
new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 270 };
// Hardware shutter button Hot-Actions.
private void OnButtonHalfPress(object sender, EventArgs e)
//toggle between video- play and pause
try
this.Dispatcher.BeginInvoke(delegate()
if (StartPlayback.IsEnabled)
PlayVideo();
if (PausePlayback.IsEnabled)
PauseVideo();
catch (Exception focusError)
// Cannot focus when a capture is in progress.
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = focusError.Message;
private void OnButtonFullPress(object sender, EventArgs e)
// Focus when a capture is not in progress.
try
this.Dispatcher.BeginInvoke(delegate()
if (vcDevice != null)
//stopVideoPlayer if it's playing back
if (currentAppState == ButtonState.Playback || currentAppState == ButtonState.Paused)
DisposeVideoPlayer();
StartVideoPreview();
if (StartRecording.IsEnabled)
StartVideoRecording();
else
StopVideoRecording();
catch (Exception focusError)
// Cannot focus when a capture is in progress.
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = focusError.Message;
private void OnButtonRelease(object sender, EventArgs e)
try
this.Dispatcher.BeginInvoke(delegate()
catch (Exception focusError)
// Cannot focus when a capture is in progress.
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = focusError.Message;
// Update the buttons and text on the UI thread based on app state.
private void UpdateUI(ButtonState currentButtonState, string statusMessage)
// Run code on the UI thread.
Dispatcher.BeginInvoke(delegate
switch (currentButtonState)
// When the camera is not supported by the phone.
case ButtonState.CameraNotSupported:
StartRecording.IsEnabled = false;
StopPlaybackRecording.IsEnabled = false;
StartPlayback.IsEnabled = false;
PausePlayback.IsEnabled = false;
break;
// First launch of the application, so no video is available.
case ButtonState.Initialized:
StartRecording.IsEnabled = true;
StopPlaybackRecording.IsEnabled = false;
StartPlayback.IsEnabled = false;
PausePlayback.IsEnabled = false;
break;
// Ready to record, so video is available for viewing.
case ButtonState.Ready:
StartRecording.IsEnabled = true;
StopPlaybackRecording.IsEnabled = false;
StartPlayback.IsEnabled = true;
PausePlayback.IsEnabled = false;
break;
// Video recording is in progress.
case ButtonState.Recording:
StartRecording.IsEnabled = false;
StopPlaybackRecording.IsEnabled = true;
StartPlayback.IsEnabled = false;
PausePlayback.IsEnabled = false;
break;
// Video playback is in progress.
case ButtonState.Playback:
StartRecording.IsEnabled = false;
StopPlaybackRecording.IsEnabled = true;
StartPlayback.IsEnabled = false;
PausePlayback.IsEnabled = true;
break;
// Video playback has been paused.
case ButtonState.Paused:
StartRecording.IsEnabled = false;
StopPlaybackRecording.IsEnabled = true;
StartPlayback.IsEnabled = true;
PausePlayback.IsEnabled = false;
break;
default:
break;
// Display a message.
txtDebug.Text = statusMessage;
// Note the current application state.
currentAppState = currentButtonState;
public async void InitializeVideoRecorder()
try
if (_cs == null)
_cs = new CaptureSource();
fileSink = new FileSink();
_cd = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();
CameraSensorLocation location = CameraSensorLocation.Back;
var captureResolutions =
AudioVideoCaptureDevice.GetAvailableCaptureResolutions(location);
vcDevice = await AudioVideoCaptureDevice.OpenAsync(location, captureResolutions[0]);
vcDevice.RecordingFailed += OnCaptureFailed;
vcDevice.VideoEncodingFormat = CameraCaptureVideoFormat.H264;
vcDevice.AudioEncodingFormat = CameraCaptureAudioFormat.Aac;
// Initialize the camera if it exists on the phone.
if (vcDevice != null)
//initialize fileSink
await InitializeFileSink();
// Create the VideoBrush for the viewfinder.
videoRecorderBrush = new VideoBrush();
videoRecorderBrush.SetSource(_cs);
// Display the viewfinder image on the rectangle.
viewfinderRectangle.Fill = videoRecorderBrush;
_cs.Start();
// Set the button state and the message.
UpdateUI(ButtonState.Initialized, "Tap record to start recording...");
else
// Disable buttons when the camera is not supported by the phone.
UpdateUI(ButtonState.CameraNotSupported, "A camera is not supported on this phone.");
catch(Exception ex)
MessageBox.Show("InitializeVideoRecorder Error:\n" + ex.Message);
public async Task InitializeFileSink()
StorageFolder isoStore = ApplicationData.Current.LocalFolder;
sfVideoFile = await isoStore.CreateFileAsync(
isoVideoFileName,
CreationCollisionOption.ReplaceExisting);
private void OnCaptureFailed(AudioVideoCaptureDevice sender, CaptureFailedEventArgs args)
MessageBox.Show(args.ToString());
private void OnCaptureSourceFailed(object sender, ExceptionRoutedEventArgs e)
MessageBox.Show(e.ErrorException.Message.ToString());
// Set the recording state: display the video on the viewfinder.
private void StartVideoPreview()
try
// Display the video on the viewfinder.
if (_cs.VideoCaptureDevice != null
&& _cs.State == CaptureState.Stopped)
// Add captureSource to videoBrush.
videoRecorderBrush.SetSource(_cs);
// Add videoBrush to the visual tree.
viewfinderRectangle.Fill = videoRecorderBrush;
_cs.Start();
// Set the button states and the message.
UpdateUI(ButtonState.Ready, "Ready to record.");
//Create optional Resolutions
// If preview fails, display an error.
catch (Exception e)
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = "ERROR: " + e.Message.ToString();
// Set recording state: start recording.
private void StartVideoRecording()
try
// Connect fileSink to captureSource.
if (_cs.VideoCaptureDevice != null
&& _cs.State == CaptureState.Started)
_cs.Stop();
// Connect the input and output of fileSink.
fileSink.CaptureSource = _cs;
fileSink.IsolatedStorageFileName = isoVideoFileName;
// Begin recording.
if (_cs.VideoCaptureDevice != null
&& _cs.State == CaptureState.Stopped)
_cs.Start();
// Set the button states and the message.
UpdateUI(ButtonState.Recording, "Recording...");
StartTimer();
// If recording fails, display an error.
catch (Exception e)
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = "ERROR: " + e.Message.ToString();
// Set the recording state: stop recording.
private void StopVideoRecording()
try
// Stop recording.
if (_cs.VideoCaptureDevice != null
&& _cs.State == CaptureState.Started)
_cs.Stop();
// Disconnect fileSink.
fileSink.CaptureSource = null;
fileSink.IsolatedStorageFileName = null;
// Set the button states and the message.
UpdateUI(ButtonState.Stopped, "Preparing viewfinder...");
StopTimer();
StartVideoPreview();
// If stop fails, display an error.
catch (Exception e)
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = "ERROR: " + e.Message.ToString();
// Start the video recording.
private void StartRecording_Click(object sender, EventArgs e)
// Avoid duplicate taps.
StartRecording.IsEnabled = false;
StartVideoRecording();
private void DisposeVideoRecorder()
if (_cs != null)
// Stop captureSource if it is running.
if (_cs.VideoCaptureDevice != null
&& _cs.State == CaptureState.Started)
_cs.Stop();
// Remove the event handler for captureSource.
_cs.CaptureFailed -= OnCaptureFailed;
// Remove the video recording objects.
_cs = null;
vcDevice = null;
fileSink = null;
videoRecorderBrush = null;
Thanks in advance. -
I have a javascript for an array of rotating logos. Each logo is associated with a link. When you click on the logo, the corporate website linked to the logo opens but it does not open in a new page. How do I get it to open in a new page?
The website link is http://lexedfoundation.org
the code calling the links is
<a href=" " onClick="clickLink(); return false;" onMouseOver="descript(); return true;" onMouseOut="window.status=' ' " target="_blank"><img src="images/corp.gif" border=0 name="corp></a>Gramps,
I'm relatively new to web development and I'm afraid I don't understand what static address I'm supposed to change. I tried substituting the http://www.externalsite.com with clickLink() but that resulted in a "page not found" message. I don't understand what "http://www.externalsite.com" represents since there is a different address for each logo. Could you please be more specific?
Thanks for your help. -
Single user mode . using tail -f (command not found)
Have an empty computer with no systems disk as the installation CD start up will not go past the grey screen with the rotating logo before the panic crash page comes up and tells me to restart the computer.
Trying to boot into single user mode and then use the command tail -f to see contents of some of the logs... BUT I get the reply tail command not found ????If the hard drive is empty, then you can only boot from the CD. Regardless of whether or not it has "tail," it won't do you any good. There are no logs.
-
Can anyone explain what just happened?
I was just watching a video on Youtube and then all of a sudden my entire machine freezes, and it logged out me out completely to the main login screen? There was that tiny loading rotate logo in the screen also.
What could have caused this?Hello Iftt,
Thank you for using Apple Support Communities!
It sounds like after updating to iOS 4.2.1 your phone is not picking up the cellular signal.
I would recommend the steps from this article named:
iPhone: Troubleshooting No Service
http://support.apple.com/kb/ts4429
Try turning iPhone off and then on again.
Remove the SIM card and verify that it is a valid, carrier-manufactured SIM. Also verify that it is not damaged, worn, or modified. Then reinsert it.
Check for a carrier settings update. Tap Settings > General > About while connected to a Wi-Fi network. If an update is available, a prompt should appear soon. If Wi-Fi is not available, connect your device to iTunes.
Update your iPhone to the latest version of iOS.
Restore the iPhone.
If you're still experiencing No Service issues, contact your carrier to check for any network or account issues that could cause this issue.
Regards,
Sterling -
How to make VideoRecorderBrush scollable?
Hi. My root layout is a Grid and I'm using a Rectangle to display the AudioVideoCaptureDevice's viewfinder. I have a option to set the capture resolution to any resolution that is available by the API. When the capture resolution is
greater that the rectangle a lot of the information of the recording (video picture) is unseen. I know I can later see it by playing it back with a fill stretch. Can you teach me how to see it while recording i.a.w make some control scrollable like
the video recorder brush? Thanks in advance:-)I followed the "how to capture videos in Windows Phone" tutorial and it used VideoCaptureDevice API from Microsoft.Devices namespace. I edited the code and where able to capture videos using AudioVideoCaptureDevice (It took me a long time to get
it right). Here is the relevant code:
XAML:
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot"
Background="Transparent">
<!--Camera viewfinder >-->
<Rectangle x:Name="viewfinderRectangle" Width="auto" Height="auto" Stroke="White" Tap="ToggleZoom_Tap" StrokeThickness="5" HorizontalAlignment="Center" VerticalAlignment="Center">
<Rectangle.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black" Offset="0"/>
<GradientStop Color="White" Offset="1"/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<MediaElement x:Name="VideoPlayer" AutoPlay="True" Width="800" Height="480" RenderTransformOrigin="0.72,0.479" VerticalAlignment="Center" HorizontalAlignment="Center" Stretch="None"/>
Code behind:
// Viewfinder for capturing video.
private VideoBrush videoRecorderBrush;
private AudioVideoCaptureDevice vcDevice;
// File details for storing the recording.
private string isoVideoFileName = "iClips_Video";
private StorageFolder isoStore;
private StorageFile sfVideoFile;
//Reference for vibrate Control
VibrateController testVibrateController = VibrateController.Default;
// For managing button and application state.
private enum ButtonState
Initialized, Stopped, Ready, Recording, Playback, Paused, NoChange, CameraNotSupported
private ButtonState currentAppState;
public MainPage()
InitializeComponent();
//setup recording
// Prepare ApplicationBar and buttons.
PhoneAppBar = (ApplicationBar)ApplicationBar;
PhoneAppBar.IsVisible = true;
StartRecording = ((ApplicationBarIconButton)ApplicationBar.Buttons[0]);
StopPlaybackRecording = ((ApplicationBarIconButton)ApplicationBar.Buttons[1]);
StartPlayback = ((ApplicationBarIconButton)ApplicationBar.Buttons[2]);
PausePlayback = ((ApplicationBarIconButton)ApplicationBar.Buttons[3]);
//Life Cycle
protected async override void OnNavigatedTo(NavigationEventArgs e)
try
// Initialize the video recorder.
CameraSensorLocation location = CameraSensorLocation.Back;
captureResolutions =
AudioVideoCaptureDevice.GetAvailableCaptureResolutions(location);
await InitializeVideoRecorder(location, captureResolutions.FirstOrDefault());
RotateUI();
//prepare shutter hot keys
CameraButtons.ShutterKeyHalfPressed += OnButtonHalfPress;
CameraButtons.ShutterKeyPressed += OnButtonFullPress;
CameraButtons.ShutterKeyReleased += OnButtonRelease;
base.OnNavigatedTo(e);
catch (Exception ex)
MessageBox.Show("On Navigated To In Main Error:\n"+ex.Message.ToString());
protected override void OnNavigatedFrom(NavigationEventArgs e)
try
//enable screen locking
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Enabled;
// Dispose of camera and media objects.
DisposeVideoPlayer();
DisposeVideoRecorder();
base.OnNavigatedFrom(e);
CameraButtons.ShutterKeyHalfPressed -= OnButtonHalfPress;
CameraButtons.ShutterKeyPressed -= OnButtonFullPress;
CameraButtons.ShutterKeyReleased -= OnButtonRelease;
catch (Exception ex)
MessageBox.Show("On Navigated From In Main Error:\n" + ex.Message.ToString());
protected override void OnOrientationChanged(OrientationChangedEventArgs e)
RotateUI();
private void RotateUI()
try
this.Dispatcher.BeginInvoke(delegate()
if (vcDevice != null)
RotateTransform rt = new RotateTransform();
//Set a perfect orientation to capture with
if (this.Orientation == PageOrientation.LandscapeLeft)
txtDebug.Text = "LandscapeLeft";
if (vcDevice != null)
//rotate video camera
if (vcDevice.SensorLocation == CameraSensorLocation.Back)
vcDevice.SetProperty(KnownCameraGeneralProperties.EncodeWithOrientation, sensor_angle + 90);
else
vcDevice.SetProperty(KnownCameraGeneralProperties.EncodeWithOrientation, sensor_angle - 90);
if (videoRecorderBrush != null)
if (vcDevice.SensorLocation == CameraSensorLocation.Back)
videoRecorderBrush.RelativeTransform =
new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 90 };
else
videoRecorderBrush.RelativeTransform =
new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = -90 };
else
txtDebug.Text = "Video Recorder Brush not fully initialized.";
if (videoRecorderBrush != null)
videoRecorderBrush.RelativeTransform =
new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 90 };
//rotate logo
if (logo != null)
rt.Angle = 90;
logo.RenderTransformOrigin = new Point(0.5, 0.5);
logo.RenderTransform = rt;
//rotate record time ellapse
if (txtRecTime != null)
rt.Angle = 90;
txtRecTime.RenderTransformOrigin = new Point(0.2, 0.5);
txtRecTime.RenderTransform = rt;
//rotate sign in link
if (MyGrid != null)
rt.Angle = 90;
MyGrid.RenderTransformOrigin = new Point(0.5, 0.5);
MyGrid.RenderTransform = rt;
//rotate CanvasVideoInfo
rt.Angle = 90;
VideoInfoGrid.RenderTransformOrigin = new Point(0.5, 0.5);
VideoInfoGrid.RenderTransform = rt;
if (this.Orientation == PageOrientation.PortraitUp)
txtDebug.Text = "PortraitUp";
if (videoRecorderBrush != null)
videoRecorderBrush.RelativeTransform =
new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 90 };
//rotate logo
if (logo != null)
rt.Angle = 0;
logo.RenderTransformOrigin = new Point(0.5, 0.5);
logo.RenderTransform = rt;
//rotate record time ellapsed
if (txtRecTime != null)
rt.Angle = 0;
txtRecTime.RenderTransformOrigin = new Point(0.5, 0.5);
txtRecTime.RenderTransform = rt;
//rotate sign in link
if (MyGrid != null)
rt.Angle = 0;
MyGrid.RenderTransformOrigin = new Point(0.5, 0.5);
MyGrid.RenderTransform = rt;
//rotate CanvasVideoInfo
rt.Angle = 0;
VideoInfoGrid.RenderTransformOrigin = new Point(0.5, 0.5);
VideoInfoGrid.RenderTransform = rt;
if (this.Orientation == PageOrientation.LandscapeRight)
this.Dispatcher.BeginInvoke(delegate()
txtDebug.Text = "LandscapeRight";
// Rotate for LandscapeRight orientation.
if (videoRecorderBrush != null)
videoRecorderBrush.RelativeTransform =
new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 90 };
//rotate logo
if (logo != null)
rt.Angle = -90;
logo.RenderTransformOrigin = new Point(0.5, 0.5);
logo.RenderTransform = rt;
//rotate record time ellapsed
if (txtRecTime != null)
rt.Angle = -90;
txtRecTime.RenderTransformOrigin = new Point(0.2, 0.5);
txtRecTime.RenderTransform = rt;
//rotate MyGrid
if (MyGrid != null)
rt.Angle = -90;
MyGrid.RenderTransformOrigin = new Point(0.5, 0.5);
MyGrid.RenderTransform = rt;
//rotate CanvasVideoInfo
rt.Angle = -90;
VideoInfoGrid.RenderTransformOrigin = new Point(0.5, 0.5);
VideoInfoGrid.RenderTransform = rt;
catch (Exception ex)
MessageBox.Show("On Orientation Changed Error:\n" + ex.Message.ToString());
// Update the buttons and text on the UI thread based on app state.
private void UpdateUI(ButtonState currentButtonState, string statusMessage)
try
// Run code on the UI thread.
Dispatcher.BeginInvoke(delegate
switch (currentButtonState)
// When the camera is not supported by the phone.
case ButtonState.CameraNotSupported:
StartRecording.IsEnabled = false;
StopPlaybackRecording.IsEnabled = false;
StartPlayback.IsEnabled = false;
PausePlayback.IsEnabled = false;
break;
// First launch of the application, so no video is available.
case ButtonState.Initialized:
StartRecording.IsEnabled = true;
StopPlaybackRecording.IsEnabled = false;
StartPlayback.IsEnabled = false;
PausePlayback.IsEnabled = false;
break;
// Ready to record, so video is available for viewing.
case ButtonState.Ready:
StartRecording.IsEnabled = true;
StopPlaybackRecording.IsEnabled = false;
StartPlayback.IsEnabled = true;
PausePlayback.IsEnabled = false;
break;
// Video recording is in progress.
case ButtonState.Recording:
StartRecording.IsEnabled = false;
StopPlaybackRecording.IsEnabled = true;
StartPlayback.IsEnabled = false;
PausePlayback.IsEnabled = false;
break;
// Video Recording Stopped.
case ButtonState.Stopped:
StartRecording.IsEnabled = true;
StopPlaybackRecording.IsEnabled = false;
StartPlayback.IsEnabled = true;
PausePlayback.IsEnabled = false;
break;
// Video playback is in progress.
case ButtonState.Playback:
StartRecording.IsEnabled = false;
StopPlaybackRecording.IsEnabled = true;
StartPlayback.IsEnabled = false;
PausePlayback.IsEnabled = true;
break;
// Video playback has been paused.
case ButtonState.Paused:
StartRecording.IsEnabled = false;
StopPlaybackRecording.IsEnabled = true;
StartPlayback.IsEnabled = true;
PausePlayback.IsEnabled = false;
break;
default:
break;
// Display a message.
txtDebug.Text = statusMessage;
// Note the current application state.
currentAppState = currentButtonState;
catch (Exception ex)
MessageBox.Show("UpdateUI Error:\n" + ex.Message.ToString());
private async Task InitializeVideoRecorder(CameraSensorLocation sensorLocation, Windows.Foundation.Size sz)
try
string[] dimensions = sz.ToString().Split(',');
//open video camera device in this resolution
vcDevice = await AudioVideoCaptureDevice.OpenAsync(sensorLocation, sz);
vcDevice.RecordingFailed += OnCaptureFailed;
vcDevice.VideoEncodingFormat = CameraCaptureVideoFormat.H264;
vcDevice.AudioEncodingFormat = CameraCaptureAudioFormat.Aac;
// Initialize the camera if it exists on the phone.
if (vcDevice != null)
//initialize fileSink
await InitializeFileSink();
// Create the VideoBrush for the viewfinder.
videoRecorderBrush = new VideoBrush();
videoRecorderBrush.SetSource(vcDevice);
this.Dispatcher.BeginInvoke(delegate()
// Display the viewfinder image on the rectangle.
viewfinderRectangle.Fill = videoRecorderBrush;
//set the resolution
viewfinderRectangle.Width = Convert.ToDouble(dimensions[1]);
viewfinderRectangle.Height = Convert.ToDouble(dimensions[0]);
VideoPlayer.Width = Convert.ToDouble(dimensions[1]);
VideoPlayer.Height = Convert.ToDouble(dimensions[0]);
resMI.Content = Convert.ToString(dimensions[0]) + "*" + Convert.ToString(dimensions[1]);
resMI_Shadow.Content = Convert.ToString(dimensions[0]) + "*" + Convert.ToString(dimensions[1]);
// Set the button state and the message.
UpdateUI(ButtonState.Initialized, "Tap record to start recording...");
else
// Disable buttons when the camera is not supported by the phone.
UpdateUI(ButtonState.CameraNotSupported, "A camera is not supported on this phone.");
/*Create Picture Perfect
//orient preview picture size from the computed anle.
var tmp = new CompositeTransform() { Rotation = ComputeAngle(this.Orientation) };
var previewSizeW = tmp.TransformBounds(new Rect(new Point(), new Size(vcDevice.PreviewResolution.Width, vcDevice.PreviewResolution.Height))).Width;
var previewSizeH = tmp.TransformBounds(new Rect(new Point(), new Size(vcDevice.PreviewResolution.Width, vcDevice.PreviewResolution.Height))).Height;
var previewSize = tmp.TransformBounds (new Rect(new Point(), new Size(m_captureDevice.PreviewResolution.Width, vcDevice.PreviewResolution.Height))).Size;
double s1 = viewfinderRectangle.Width / (double)previewSizeW;
double s2 = viewfinderRectangle.Height / (double)previewSizeH;
if (sensorLocation == CameraSensorLocation.Back)
videoRecorderBrush.Transform = new CompositeTransform()
Rotation = ComputeAngle(this.Orientation),
CenterX = viewfinderRectangle.Width / 2,
CenterY = viewfinderRectangle.Height / 2,
ScaleX = s1,
ScaleY = s2
else
videoRecorderBrush.Transform = new CompositeTransform()
Rotation = ComputeAngle(this.Orientation),
CenterX = viewfinderRectangle.Width / 2,
CenterY = viewfinderRectangle.Height / 2,
ScaleX = s1,
ScaleY = -1 * s2
};//Y mirror
catch (Exception ex)
MessageBox.Show("InitializeVideoRecorder Error:\n" + ex.Message);
double ComputeAngle(PageOrientation orientation)
if ((orientation & PageOrientation.Portrait) == PageOrientation.Portrait)
return vcDevice.SensorRotationInDegrees;
else if ((orientation & PageOrientation.LandscapeLeft) == PageOrientation.LandscapeLeft)
return vcDevice.SensorRotationInDegrees - 90;
else //PageOrientation.LandscapeRight
return vcDevice.SensorRotationInDegrees + 90;
//setup iClips video file creation
private async Task InitializeFileSink()
try
isoStore = await ApplicationData.Current.LocalFolder.GetFolderAsync("Shared");
sfVideoFile = await isoStore.CreateFileAsync(isoVideoFileName + ".mp4",
CreationCollisionOption.ReplaceExisting);
s = await sfVideoFile.OpenAsync(FileAccessMode.ReadWrite);
catch (Exception ex)
MessageBox.Show("Initialize File Sink Error:\n" + ex.Message.ToString());
// Set the recording state: display the video on the viewfinder.
private void StartVideoPreview()
try
// Display the video on the viewfinder.
if (vcDevice != null)
if (videoRecorderBrush == null)
// Create the VideoBrush for the viewfinder.
videoRecorderBrush = new VideoBrush();
videoRecorderBrush.SetSource(vcDevice);
// Display the viewfinder image on the rectangle.
viewfinderRectangle.Fill = videoRecorderBrush;
// Set the button states and the message.
UpdateUI(ButtonState.Ready, "Ready to record.");
txtRecTime.Visibility = Visibility.Collapsed;
// If preview fails, display an error.
catch (Exception e)
MessageBox.Show("Start Video Preview Exception:\n " + e.Message.ToString());
// Set recording state: start recording.
private async void StartVideoRecording()
try
//disable screen locking
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
if (vcDevice != null)
VideoInfoGrid.Visibility = Visibility.Collapsed;
if (s == null)
s = await sfVideoFile.OpenAsync(FileAccessMode.ReadWrite);
await vcDevice.StartRecordingToStreamAsync(s);
rState = 1;
logo.Opacity = 1.0; //brighten logo to indicate that the recording started
signForm_Shadow.Opacity = 1.0;
resMI_Shadow.Opacity = 1.0;
cOrientation.Opacity = 1.0;
ToggleCameraShadow.Opacity = 1.0;
StartTimer(); //show time ellapsed on UI
// Set the button states and the message.
UpdateUI(ButtonState.Recording, "Recording...");
// If recording fails, display an error.
catch (Exception e)
MessageBox.Show("Start Video Recording Error:\n" + e.Message.ToString());
// Set the recording state: stop recording.
private async void StopVideoRecording()
try
//enable screen locking
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Enabled;
await vcDevice.StopRecordingAsync();
rState = 0;
logo.Opacity = 0.1;
signForm_Shadow.Opacity = 0.5;
resMI_Shadow.Opacity = 0.5;
ToggleCameraShadow.Opacity = 0.5;
cOrientation.Opacity = 0.5;
StopTimer();
txtRecTime.Visibility = Visibility.Collapsed;
// Set the button states and the message.
UpdateUI(ButtonState.Stopped, "Recording stopped.");
DisplayVideoInformation();
// If stop fails, display an error.
catch (Exception e)
MessageBox.Show("Stop Video Recording:\n " + e.Message.ToString());
private void DisplayVideoInformation()
try
VideoInfoGrid.Visibility = Visibility.Visible;
txtVideoDate.Text = "Date: " + System.DateTime.Now;
txtVideoDuration.Text = "Duration: " + txtRecTime.Text;
txtVideoName.Text = "Name: " + sfVideoFile.Name;
txtVideoSize.Text = "Size: ";
txtVideoType.Text = "Type: " + "MP4";
catch (Exception ex)
MessageBox.Show("Display Video Information Error:\n" + ex.Message.ToString());
// Start the video recording.
private void StartRecording_Click(object sender, EventArgs e)
// Avoid duplicate taps.
StartRecording.IsEnabled = false;
StartVideoRecording();
private void DisposeVideoRecorder()
try
//enable screen locking
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Enabled;
if (vcDevice != null)
// Remove the event handler for captureSource.
vcDevice.RecordingFailed -= OnCaptureFailed;
if (s != null)
s.Dispose();
if (sfVideoFile != null)
sfVideoFile = null;
if (videoRecorderBrush != null)
videoRecorderBrush = null;
// Remove the video recording objects.
vcDevice.Dispose();
//vcDevice = null;
catch (Exception ex)
MessageBox.Show("Dispose Video Recorder Error:\n" + ex.Message.ToString());
private void OnCaptureFailed(AudioVideoCaptureDevice sender, CaptureFailedEventArgs args)
try
//enable screen locking
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Enabled;
MessageBox.Show("Recording Failed!");
rState = 0;
logo.Opacity = 0.1;
signForm_Shadow.Opacity = 0.5;
resMI_Shadow.Opacity = 0.5;
ToggleCameraShadow.Opacity = 0.5;
cOrientation.Opacity = 0.5;
catch (Exception ex)
MessageBox.Show("On Capture Failed Error:\n " + ex.Message.ToString());
I added some other methods that are related to the Video Capturing but you can just look in InitializeVideoRecorder to see how I'm binding the AudioVideoCaptureDevice preview to the rectangle...Tell me if you need more info and thanks so long -
Captivate 4 bombs with 3D motion SWF
I have a small AS3 swf of a roatating logo that drives Captivate 4 crazy. I have no problem with other AS3 swfs but the rotating logo won't work. It plays fine with a Flash 10 viewer or even in the Captivate library previewer. When I try to publish or preview the slide show I get a flashing Captivate preloader and stills of the logo movie. Does Captivate 4 have an incompatibility with the 3D motion tool in Flash? It can't be duplicated in AS2.
Here's the as3 code. Think of your logo as a business card that has a font and a back. This card gets rotated on the Y axis 360 degrees. The ENTER_FRAME event is what triggers the rotation. All you need to do is create assets named mcFront and mcBack and place them on stage.
import flash.events.*
this.addEventListener(Event.ENTER_FRAME, EnteringFrame);
//Start out the rotation with edge facing you
mcFront.rotationY = -90;
mcBack.rotationY = -90;
var bol:Boolean = true;
function EnteringFrame(e:Event) {
//check boolean value
if (bol) {
mcFront.visible = true;
mcFront.rotationY += 4; //adjust this number for speed of rotation
if (mcFront.rotationY >= 90) {
mcFront.visible = false;
mcFront.rotationY = -90;
bol = false;
else {
mcBack.visible = true;
mcBack.rotationY += 4; //adjust this number for speed of rotation
if(mcBack.rotationY >= 90) {
mcBack.visible = false;
mcBack.rotationY = -90;
bol = true;
//trace("Bol: " + bol);
Jim Leichliter
Maybe you are looking for
-
Could not create JCOClientConnection for logical System: WD_MODELDATA_DEST
Hi , I am getting the below error: Could not create JCOClientConnection for logical System: WD_MODELDATA_DEST - Model: class com.eligibilitymodel1.EligibilityModel1. The SSO ticket needed for authentication to WD_MODELDATA_DEST has expired. Close all
-
How to get active component of other components component usage
Hi all, let me try to describe you the issue. I've got three components interacting with another. Lets call them CA, C1 and C2. CA uses both C1 and C2, so CA has component usages CUA1 and CUA2. But C1 also uses C2 with component usage CU12. C1 calls
-
Hello, I'm running MDM v7.1.05.101 When trying to add a validation to a main table I am getting the following error: Error Saving Validation Field Not Found <0xFFAA1000> Version 7.1 (7.1.05.101) Anyone have any idea what that is about?
-
The Pages template system crashes when I attempt to choose a template other than blank. How do I fix this problem, so that I can successfully choose any template that I desire?
-
Kernal_task takes me lot's of RAM
Hi all I own a MacBook Air mid-2013 13" 128GB SSD and 4GB RAM. I recently noticed that the 'kernal_task' takes me lot of RAM (700 MB)... I would like to know what is 'kernal_task' and why does it takes me so much of my RAM? Thanks, Itay