This repository has been archived by the owner on Apr 18, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented video capture, added video test to capture.html
- Loading branch information
sgrebnov
committed
Sep 19, 2011
1 parent
71a3565
commit 08a5a35
Showing
13 changed files
with
722 additions
and
24 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
* PhoneGap is available under *either* the terms of the modified BSD license *or* the | ||
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. | ||
* | ||
* Copyright (c) 2011, Sergey Grebnov. | ||
*/ | ||
|
||
using System; | ||
using System.IO; | ||
using System.Windows; | ||
using Microsoft.Phone.Controls; | ||
using Microsoft.Phone.Tasks; | ||
|
||
namespace WP7GapClassLib.PhoneGap.UI | ||
{ | ||
/// <summary> | ||
/// Allows an application to launch the Video Recording application. | ||
/// Use this to allow users to record video from your application. | ||
/// </summary> | ||
public class VideoCaptureTask | ||
{ | ||
/// <summary> | ||
/// Represents recorded video returned from a call to the Show method of | ||
/// a WP7GapClassLib.PhoneGap.Controls.VideoCaptureTask object | ||
/// </summary> | ||
public class VideoResult : TaskEventArgs | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the VideoResult class. | ||
/// </summary> | ||
public VideoResult() | ||
{ } | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the VideoResult class | ||
/// with the specified Microsoft.Phone.Tasks.TaskResult. | ||
/// </summary> | ||
/// <param name="taskResult">Associated Microsoft.Phone.Tasks.TaskResult</param> | ||
public VideoResult(TaskResult taskResult) | ||
: base(taskResult) | ||
{ } | ||
|
||
/// <summary> | ||
/// Gets the file name of the recorded Video. | ||
/// </summary> | ||
public Stream VideoFile { get; internal set; } | ||
|
||
/// <summary> | ||
/// Gets the stream containing the data for the recorded Video. | ||
/// </summary> | ||
public string VideoFileName { get; internal set; } | ||
} | ||
|
||
/// <summary> | ||
/// Occurs when a Video recording task is completed. | ||
/// </summary> | ||
public event EventHandler<VideoResult> Completed; | ||
|
||
/// <summary> | ||
/// Shows Video Recording application | ||
/// </summary> | ||
public void Show() | ||
{ | ||
|
||
var root = Application.Current.RootVisual as PhoneApplicationFrame; | ||
|
||
root.Navigated += new System.Windows.Navigation.NavigatedEventHandler(NavigationService_Navigated); | ||
|
||
// dummy parameter is used to always open a fresh version | ||
root.Navigate(new System.Uri("/WP7GapClassLib;component/PhoneGap/UI/VideoRecorder.xaml?dummy=" + Guid.NewGuid().ToString(), UriKind.Relative)); | ||
} | ||
|
||
/// <summary> | ||
/// Performs additional configuration of the recording application. | ||
/// </summary> | ||
private void NavigationService_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e) | ||
{ | ||
if (!(e.Content is VideoRecorder)) return; | ||
|
||
(Application.Current.RootVisual as PhoneApplicationFrame).Navigated -= NavigationService_Navigated; | ||
|
||
VideoRecorder VideoRecorder = (VideoRecorder)e.Content; | ||
|
||
if (VideoRecorder != null) | ||
{ | ||
VideoRecorder.Completed += this.Completed; | ||
} | ||
else if (this.Completed != null) | ||
{ | ||
this.Completed(this, new VideoResult(TaskResult.Cancel)); | ||
} | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<phone:PhoneApplicationPage | ||
x:Class="WP7GapClassLib.PhoneGap.UI.VideoRecorder" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" | ||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="480" | ||
FontFamily="{StaticResource PhoneFontFamilyNormal}" | ||
FontSize="{StaticResource PhoneFontSizeNormal}" | ||
Foreground="{StaticResource PhoneForegroundBrush}" | ||
SupportedOrientations="Landscape" Orientation="LandscapeLeft" | ||
shell:SystemTray.IsVisible="False"> | ||
|
||
<Canvas x:Name="LayoutRoot" Background="Transparent" Grid.ColumnSpan="1" Grid.Column="0"> | ||
|
||
<Rectangle | ||
x:Name="viewfinderRectangle" | ||
Width="640" | ||
Height="480" | ||
HorizontalAlignment="Left" | ||
Canvas.Left="80"/> | ||
|
||
</Canvas> | ||
|
||
<phone:PhoneApplicationPage.ApplicationBar> | ||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" x:Name="PhoneAppBar" Opacity="0.0"> | ||
<shell:ApplicationBarIconButton IconUri="/Images/appbar.feature.video.rest.png" Text="Record" x:Name="btnStartRecording" Click="StartRecording_Click" /> | ||
<shell:ApplicationBarIconButton IconUri="/Images/appbar.save.rest.png" Text="Take" x:Name="btnTakeVideo" Click="TakeVideo_Click"/> | ||
</shell:ApplicationBar> | ||
</phone:PhoneApplicationPage.ApplicationBar> | ||
|
||
</phone:PhoneApplicationPage> |
Oops, something went wrong.