public override void OpenMediaAsync() { Task.Run(() => { try { CreateSample(); } catch (Exception e) { ErrorOccurred(e.Message); return; } PropertySet sourceAttr = new Windows.Foundation.Collections.PropertySet(); PropertySet streamAttr = new Windows.Foundation.Collections.PropertySet(); streamAttr.Add("SampleRate", SampleRate); streamAttr.Add("Channels", Channels); streamAttr.Add("BitsPerSample", BitsPerSample); ReportOpenMediaCompleted( sourceAttr, new IPropertySet[] { streamAttr }); }); }
public PlayReadyPage() { this.InitializeComponent(); this.navigationHelper = new NavigationHelper(this); this.navigationHelper.LoadState += this.NavigationHelper_LoadState; this.navigationHelper.SaveState += this.NavigationHelper_SaveState; var protectionManager = new MediaProtectionManager(); protectionManager.ComponentLoadFailed += ProtectionManager_ComponentLoadFailed; protectionManager.ServiceRequested += ProtectionManager_ServiceRequested; Windows.Foundation.Collections.PropertySet cpSystems = new Windows.Foundation.Collections.PropertySet(); cpSystems.Add("{F4637010-03C3-42CD-B932-B48ADF3A6A54}", "Microsoft.Media.PlayReadyClient.PlayReadyWinRTTrustedInput"); //Playready protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemIdMapping", cpSystems); protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemId", "{F4637010-03C3-42CD-B932-B48ADF3A6A54}"); player.ProtectionManager = protectionManager; var extensions = player.MediaExtensionManager; extensions.RegisterByteStreamHandler("Microsoft.Media.PlayReadyClient.PlayReadyByteStreamHandler", ".pyv", "PRvideo"); extensions.RegisterByteStreamHandler("Microsoft.Media.PlayReadyClient.PlayReadyByteStreamHandler", ".pya", "PRaudio"); extensions.RegisterByteStreamHandler("Microsoft.Media.PlayReadyClient.PlayReadyByteStreamHandler", ".wma", "PRaudio"); extensions.RegisterByteStreamHandler("Microsoft.Media.PlayReadyClient.PlayReadyByteStreamHandler", ".wmv", "PRvideo"); }
private void SetUpProtectionManager(ref MediaElement m) { log("Enter SetUpProtectionManager"); log("Creating protection system mappings..."); protectionManager = new MediaProtectionManager(); protectionManager.ComponentLoadFailed += new ComponentLoadFailedEventHandler(ProtectionManager_ComponentLoadFailed); protectionManager.ServiceRequested += new ServiceRequestedEventHandler(ProtectionManager_ServiceRequested); //Setup PlayReady as the ProtectionSystem to use by MF. //The code here is mandatory and should be just copied directly over to the app Windows.Foundation.Collections.PropertySet cpSystems = new Windows.Foundation.Collections.PropertySet(); cpSystems.Add("{F4637010-03C3-42CD-B932-B48ADF3A6A54}", "Windows.Media.Protection.PlayReady.PlayReadyWinRTTrustedInput"); protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemIdMapping", cpSystems); //Use by the media stream source about how to create ITA InitData. //See here for more detai: https://msdn.microsoft.com/en-us/library/windows/desktop/aa376846%28v=vs.85%29.aspx protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemId", "{F4637010-03C3-42CD-B932-B48ADF3A6A54}"); // Setup the container GUID that's in the PPSH box protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionContainerGuid", "{9A04F079-9840-4286-AB92-E65BE0885F95}"); m.ProtectionManager = protectionManager; log("Leave SetUpProtectionManager"); }
private void InitializeSmoothStreaming() { extensions = new MediaExtensionManager(); propertySet = new Windows.Foundation.Collections.PropertySet(); // Gets the default instance of AdaptiveSourceManager which manages Smooth //Streaming media sources. // adaptiveSourceManager = AdaptiveSourceManager.GetDefault(); // Sets property key value to AdaptiveSourceManager default instance. // {A5CE1DE8-1D00-427B-ACEF-FB9A3C93DE2D}" must be hardcoded. propertySet["{A5CE1DE8-1D00-427B-ACEF-FB9A3C93DE2D}"] = adaptiveSourceManager; // Registers Smooth Streaming byte-stream handler for “.ism” extension and, // "text/xml" and "application/vnd.ms-ss" mime-types and pass the propertyset. // http://*.ism/manifest URI resources will be resolved by Byte-stream handler. extensions.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "text/xml", propertySet); extensions.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "application/vnd.ms-ss", propertySet); extensions.RegisterSchemeHandler("Microsoft.Media.AdaptiveStreaming.SmoothSchemeHandler", "ms-sstr:", propertySet); //var vm = (IPlayFreeVideoViewModel)DataContext; //vm.AdaptiveSourceManager = adaptiveSourceManager; //vm.MediaElement = this.MediaElement; }
protected override void OnNavigatedTo(Windows.UI.Xaml.Navigation.NavigationEventArgs e) { if (e.Parameter is FingerSensorsApp.App) { FingerSensorsApp.App AppEnvironment = e.Parameter as FingerSensorsApp.App; if (AppEnvironment != null) { m_Environment = AppEnvironment.Environment; m_Connector_SEN0188 = m_Environment.SensorConnector; m_Sensoroutputconfigoptions = m_Environment.SensorOutPutServiceConnectorConfig; m_Sensorinputconfigoptions = m_Environment.SensorInputServiceConnectorConfig; m_SettingsToStorage = AppEnvironment.SettingsToStorage; m_FingertEventDatabase = m_Environment.FingertEventDatabase; m_SEN0188SQLite = m_Environment.SEN0188SQLite; m_GPIOEnvironmentConnectors = m_Environment.GPIOEnvironmentConnectors; m_Environment.StopConnectors(); } } base.OnNavigatedTo(e); }
private async void OnPostClicked(object sender, RoutedEventArgs e) { FBSession session = FBSession.ActiveSession; if (session.LoggedIn) { PropertySet parameters = new PropertySet(); parameters.Add("title", "MSDN Italy blog"); parameters.Add("link", "http://blogs.msdn.com/b/italy/"); parameters.Add("description", "Il blog ufficiale di MSDN Italia"); FBResult result = await session.ShowFeedDialog(parameters); string message; if (result.Succeeded) { message = "Succeded"; } else { message = "Failed"; } MessageDialog dialog = new MessageDialog(message); await dialog.ShowAsync(); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { if (e.Parameter is FingerSensorsApp.App) { FingerSensorsApp.App AppEnvironment = e.Parameter as FingerSensorsApp.App; if (AppEnvironment != null) { m_Environment = AppEnvironment.Environment; m_GPIOEnvironmentConnectors = m_Environment.GPIOEnvironmentConnectors; m_SEN0188SQLite = m_Environment.SEN0188SQLite; m_FingertEventDatabase = m_Environment.FingertEventDatabase; m_Connector_SEN0188 = m_Environment.SensorConnector; m_Sensoroutputconfigoptions = m_Environment.SensorOutPutServiceConnectorConfig; m_Sensorinputconfigoptions = m_Environment.SensorInputServiceConnectorConfig; m_ProcessorGPIOEvents = m_Environment.ProcessorGPIOEvents; m_ProcessorGPIOEvents.NotifyEvent += ProcessorGPIOEvents_NotifyEvent; } } base.OnNavigatedTo(e); }
/// <summary> /// Prepopulate a set of colors, indexed by where on the Pivot they will play a role /// </summary> private void InitializeColors() { _colorsByPivotItem = new PropertySet(); _colorsByPivotItem.Add("Pictures", Windows.UI.Colors.Orange); _colorsByPivotItem.Add("ContactInfo", Windows.UI.Colors.Lavender); _colorsByPivotItem.Add("Download", Windows.UI.Colors.GreenYellow); _colorsByPivotItem.Add("Comment", Windows.UI.Colors.DeepSkyBlue); }
// System.Collections.Generic.IList<byte> m_SensorId; public FingerSensorManager() { InitializeComponent(); m_Environment = null; m_DataSets = null; m_SEN0188SQLite = null; m_Sensoroutputconfigoptions = null; m_Sensorinputconfigoptions = null; m_serDev = null; m_FilledFingerLib = new ObservableCollection <uint>(); }
private static string GetNodeValue(XmlElement xml, string xpath) { var ns = new PropertySet { {"root", "http://www.w3.org/2005/Atom"}, {"media", "http://search.yahoo.com/mrss/"}, {"openSearch", "http://a9.com/-/spec/opensearchrss/1.0/"}, //"http://a9.com/-/spec/opensearch/1.1/"}, //http://a9.com/-/spec/opensearchrss/1.0/ {"gd", "http://schemas.google.com/g/2005"}, {"yt", "http://gdata.youtube.com/schemas/2007"} }; var node = xml.SelectSingleNodeNS(xpath, ns); return node == null ? "" : node.InnerText; }
public MainPage() { this.InitializeComponent(); var protectionManager = new MediaProtectionManager(); //A setting to tell MF that we are using PlayReady. var props = new Windows.Foundation.Collections.PropertySet(); props.Add("{F4637010-03C3-42CD-B932-B48ADF3A6A54}", "Windows.Media.Protection.PlayReady.PlayReadyWinRTTrustedInput"); protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemIdMapping", props); protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemId", "{F4637010-03C3-42CD-B932-B48ADF3A6A54}"); //Maps the container guid from the manifest or media segment protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionContainerGuid", "{9A04F079-9840-4286-AB92-E65BE0885F95}"); protectionManager.ServiceRequested += ProtectionManager_ServiceRequested; protectionManager.ComponentLoadFailed += ProtectionManager_ComponentLoadFailed; // media player MediaPlayer mediaPlayer = new MediaPlayer(); mediaPlayer.MediaOpened += MediaPlayer_MediaOpened; mediaPlayer.MediaFailed += MediaPlayer_MediaFailed; // media source #if true AudioEncodingProperties audioProperties = AudioEncodingProperties.CreateAacAdts(44100, 1, 72000); Guid MF_SD_PROTECTED = new Guid(0xaf2181, 0xbdc2, 0x423c, 0xab, 0xca, 0xf5, 0x3, 0x59, 0x3b, 0xc1, 0x21); //audioProperties.Properties.Add(MF_SD_PROTECTED, 1 /* true ? doc says UINT32 - treat as a boolean value */); audioProperties.Properties.Add(MF_SD_PROTECTED, PropertyValue.CreateUInt32(1)); AudioStreamDescriptor audioStreamDescriptor = new AudioStreamDescriptor(audioProperties); foreach (var prop in audioStreamDescriptor.EncodingProperties.Properties) { Log(prop.Key.ToString() + " => " + prop.Value.ToString()); } MediaStreamSource mediaStreamSource = new MediaStreamSource(audioStreamDescriptor); mediaStreamSource.MediaProtectionManager = protectionManager; // protection manager is on the media stream source mediaStreamSource.SampleRequested += MediaStreamSource_SampleRequested; mediaStreamSource.Starting += MediaStreamSource_Starting; MediaSource mediaSource = MediaSource.CreateFromMediaStreamSource(mediaStreamSource); #else MediaSource mediaSource = MediaSource.CreateFromUri(new Uri("http://profficialsite.origin.mediaservices.windows.net/c51358ea-9a5e-4322-8951-897d640fdfd7/tearsofsteel_4k.ism/manifest(format=mpd-time-csf)")); mediaPlayer.ProtectionManager = protectionManager; // protection manager is on the media player #endif // play ! m_mediaPlayerElement.SetMediaPlayer(mediaPlayer); mediaPlayer.Source = mediaSource; mediaPlayer.Play(); }
public MainPage() { this.InitializeComponent(); m_SEN0188SQLite = null; m_FingertEventDatabase = null; m_Sensoroutputconfigoptions = null; m_Sensorinputconfigoptions = null; m_DataSets = null; m_GPIOEnvironmentConnectors = null; m_ProcessorGPIOEvents = null; m_DataSets = new ObservableCollection <FingerEvent> (); }
public Configuration() { this.InitializeComponent(); m_Connector_SEN0188 = null; m_FingertEventDatabase = null; m_SEN0188SQLite = null; m_Environment = null; m_listOfDevices = new ObservableCollection <FingerPrintSensor_SEN0188.SerDevice>(); m_Sensoroutputconfigoptions = null; m_Sensorinputconfigoptions = null; // m_serDev = null; m_SettingsToStorage = null; m_OutPuts = null; m_Inputs = null; // m_Banks = null; m_GPIOEnvironmentConnectors = null; ListAvailablePorts(); m_AccessBitsCollection = DBDataSetAccessRight.getAccessBitsCollection(); }
/// <summary> /// Registers element for current media stream source /// </summary> /// <param name="element"></param> private void RegisterWith(MediaElement element) { if (_extensionManager != null) { throw new InvalidOperationException("MediaStreamSource is already registered with a media element."); } _extensionManager = new MediaExtensionManager(); var config = new Windows.Foundation.Collections.PropertySet(); // Registration of the scheme handler is global, so we need to get unique scheme so our // plugin will be used only for our this one instance of media element. string uri = "samplemss-" + element.GetHashCode() + ":"; config.Add("plugin", new MMSWinRTPlugin(this)); _extensionManager.RegisterSchemeHandler("MSSWinRTExtension.MediaStreamSchemeHandler", uri, config); element.Source = new Uri(uri); }
private async void LoadRoundProfilePicture( String UserId ) { PropertySet parameters = new PropertySet(); String path = "/" + UserId + "/picture"; parameters.Add(new KeyValuePair<String, Object>("redirect", "false")); // Just picking a width and height for now parameters.Add(new KeyValuePair<String, Object>("width", "200")); parameters.Add(new KeyValuePair<String, Object>("height", "200")); FBSingleValue value = new FBSingleValue(path, parameters, new FBJsonClassFactory(FBProfilePicture.FromJson)); FBResult result = await value.GetAsync(); if (result.Succeeded) { FBProfilePicture pic = (FBProfilePicture)result.Object; ProfilePicBrush.ImageSource = new BitmapImage(new Uri(pic.Url)); } }
protected override void OnNavigatedTo(Windows.UI.Xaml.Navigation.NavigationEventArgs e) { if (e.Parameter is FingerSensorsApp.App) { FingerSensorsApp.App AppEnvironment = e.Parameter as FingerSensorsApp.App; if (AppEnvironment != null) { m_Environment = AppEnvironment.Environment; m_DataSets = m_Environment.SEN0188SQLite.DataSets; m_SEN0188SQLite = m_Environment.SEN0188SQLite; m_Connector_SEN0188 = m_Environment.SensorConnector; m_Sensoroutputconfigoptions = m_Environment.SensorOutPutServiceConnectorConfig; m_Sensorinputconfigoptions = m_Environment.SensorInputServiceConnectorConfig; m_SEN0188SQLite.GetDataSets(); m_serDev = m_Environment.SerDev; SensorIDValue.Text = "not set"; m_Connector_SEN0188.NotifyChangeState += Connector_SEN0188_NotifyChangeState; } } base.OnNavigatedTo(e); }
public async Task testLikeSomething() { string token = await getAppToken(); PropertySet parameters = new PropertySet(); parameters.Add("access_token", Uri.EscapeUriString(token)); parameters.Add("permissions", "public_profile,publish_actions,user_photos"); FBTestUser user = await createTestUser(parameters); string path = user.Id + "/og.likes"; // Because *everybody* likes these, amirite? string likedObject = Uri.EscapeUriString("http://en.wikipedia.org/wiki/Brussels_sprout"); parameters.Add("object", likedObject); FBSingleValue sval = new FBSingleValue(path, parameters, new FBJsonClassFactory(FBObject.FromJson)); FBResult result = await sval.PostAsync(); Assert.IsTrue(result.Succeeded); try { FBObject like = (FBObject)result.Object; } catch (InvalidCastException) { Assert.IsFalse(true, "Object returned was not of the " + "expected type (FBObject)."); } }
public async Task testUploadPhoto() { string token = await getAppToken(); PropertySet parameters = new PropertySet(); parameters.Add("access_token", Uri.EscapeUriString(token)); parameters.Add("permissions", FBTestPhotoUploadPermissions); FBTestUser user = await createTestUser(parameters); StorageFolder appFolder = Windows.ApplicationModel.Package.Current.InstalledLocation; StorageFile f = await appFolder.GetFileAsync( FBTestImagePath); IRandomAccessStreamWithContentType stream = await f.OpenReadAsync(); Assert.IsNotNull(stream); FBMediaStream fbStream = new FBMediaStream(FBTestImageName, stream); // Switch to user access token to post photo. parameters.Remove("access_token"); parameters.Add("access_token", user.AccessToken); parameters.Add("source", fbStream); string path = "/" + user.Id + "/photos"; FBSingleValue sval = new FBSingleValue(path, parameters, new FBJsonClassFactory(FBPhoto.FromJson)); FBResult result = await sval.PostAsync(); Assert.IsTrue(result.Succeeded); try { FBPhoto pic = (FBPhoto)result.Object; } catch (InvalidCastException) { Assert.IsFalse(true, "Object returned was not of the " + "expected type (FBPhoto)."); } }
public async Task testListTestUsers() { string token = await getAppToken(); PropertySet parameters = new PropertySet(); string path = "/" + TestAppId + FBSDKTestUsersPath; Assert.IsNotNull(token); bool found = false; parameters.Add("access_token", Uri.EscapeUriString(token)); //Ensure we have at least one test user! FBTestUser user = await createTestUser(parameters); FBPaginatedArray arr = new FBPaginatedArray(path, parameters, new FBJsonClassFactory(FBTestUser.FromJson)); FBResult result = await arr.FirstAsync(); Assert.IsTrue(result.Succeeded); IReadOnlyList<Object> users = (IReadOnlyList<Object>)result.Object; Assert.IsTrue(users.Count > 0); for (int i = 0; i < users.Count; i++) { try { FBTestUser testuser = (FBTestUser)users[i]; if (string.CompareOrdinal(testuser.Id, user.Id) == 0) { found = true; } } catch (InvalidCastException) { Assert.IsTrue(false, "Item returned is not expected type" + " (FBTestUser)"); } } Assert.IsTrue(found); await deleteTestUser(user); }
public async Task testPostToTestUserFeed() { string appToken = await getAppToken(); PropertySet parameters = new PropertySet(); string permissions = "public_profile,user_friends,publish_actions"; string token = await getAppToken(); parameters.Add("access_token", appToken); parameters.Add("permissions", permissions); parameters.Add("installed", "true"); FBTestUser user = await createTestUser(parameters); Assert.IsNotNull(user); FBObject post = await postToFeed(user, FBSDKTestMessage); Assert.IsNotNull(post); await deleteTestUser(user); }
/// <summary>Initializes the PlayReady protection manager.</summary> private void InitializeMediaProtectionManager() { var mediaProtectionManager = new MediaProtectionManager(); mediaProtectionManager.ComponentLoadFailed += OnMediaProtectionManagerComponentLoadFailed; mediaProtectionManager.ServiceRequested += OnMediaProtectionManagerServiceRequested; // Set up the container GUID for the CFF format (used with DASH streams), see http://uvdemystified.com/uvfaq.html#3.2 // The GUID represents MPEG DASH Content Protection using Microsoft PlayReady, see http://dashif.org/identifiers/protection/ mediaProtectionManager.Properties["Windows.Media.Protection.MediaProtectionContainerGuid"] = "{9A04F079-9840-4286-AB92-E65BE0885F95}"; // Set up the drm layer to use. Hardware DRM is the default, but not all older hardware supports this var supportsHardwareDrm = PlayReadyStatics.CheckSupportedHardware(PlayReadyHardwareDRMFeatures.HardwareDRM); if (!supportsHardwareDrm) { mediaProtectionManager.Properties["Windows.Media.Protection.UseSoftwareProtectionLayer"] = true; } // Set up the content protection manager so it uses the PlayReady Input Trust Authority (ITA) for the relevant media sources // The MediaProtectionSystemId GUID is format and case sensitive, see https://msdn.microsoft.com/en-us/library/windows.media.protection.mediaprotectionmanager.properties.aspx var cpsystems = new PropertySet(); cpsystems[PlayReadyStatics.MediaProtectionSystemId.ToString("B").ToUpper()] = "Windows.Media.Protection.PlayReady.PlayReadyWinRTTrustedInput"; mediaProtectionManager.Properties["Windows.Media.Protection.MediaProtectionSystemIdMapping"] = cpsystems; mediaProtectionManager.Properties["Windows.Media.Protection.MediaProtectionSystemId"] = PlayReadyStatics.MediaProtectionSystemId.ToString("B").ToUpper(); Player.ProtectionManager = mediaProtectionManager; }
/// <summary> /// This method Register the PlayReady component . /// </summary> public bool RegisterPlayReady() { bool bResult = false; // PlayReady // Init PlayReady Protection Manager if (protectionManager != null) { protectionManager.ComponentLoadFailed -= ProtectionManager_ComponentLoadFailed; protectionManager.ServiceRequested -= ProtectionManager_ServiceRequested; protectionManager = null; } protectionManager = new Windows.Media.Protection.MediaProtectionManager(); if (protectionManager != null) { Windows.Foundation.Collections.PropertySet cpSystems = new Windows.Foundation.Collections.PropertySet(); cpSystems.Add("{F4637010-03C3-42CD-B932-B48ADF3A6A54}", "Microsoft.Media.PlayReadyClient.PlayReadyWinRTTrustedInput"); //Playready protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemIdMapping", cpSystems); protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemId", "{F4637010-03C3-42CD-B932-B48ADF3A6A54}"); /* //Indicate to the MF pipeline to use PlayReady's TrustedInput cpSystems.Add("{F4637010-03C3-42CD-B932-B48ADF3A6A54}", "Windows.Media.Protection.PlayReady.PlayReadyWinRTTrustedInput"); protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemIdMapping", cpSystems); //Use by the media stream source about how to create ITA InitData. //See here for more detai: https://msdn.microsoft.com/en-us/library/windows/desktop/aa376846%28v=vs.85%29.aspx protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemId", "{F4637010-03C3-42CD-B932-B48ADF3A6A54}"); */ // Setup the container GUID that's in the PPSH box protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionContainerGuid", "{9A04F079-9840-4286-AB92-E65BE0885F95}"); Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; // Check if the platform does support hardware DRM LogMessage((IsHardwareDRMSupported() == true ? "Hardware DRM is supported on this platform" : "Hardware DRM is not supported on this platform")); // Associate the MediaElement with the protection manager mediaElement.ProtectionManager = protectionManager; mediaElement.ProtectionManager.ComponentLoadFailed += ProtectionManager_ComponentLoadFailed; mediaElement.ProtectionManager.ServiceRequested += ProtectionManager_ServiceRequested; bResult = true; } return bResult; }
private void OpenVideoWithPolarEffect(string effectName) { Video.RemoveAllEffects(); PropertySet configuration = new PropertySet(); configuration.Add("effect", effectName); Video.AddVideoEffect("PolarTransform.PolarEffect", true, configuration); rootPage.PickSingleFileAndSet(new string[] { ".mp4", ".wmv", ".avi" }, Video); }
public async Task<IReadOnlyList<Object>> getListOfTestUsers() { string token = await getAppToken(); PropertySet parameters = new PropertySet(); string path = "/" + TestAppId + FBSDKTestUsersPath; //Assert.IsNotNull(token); parameters.Add("access_token", Uri.EscapeUriString(token)); FBPaginatedArray arr = new FBPaginatedArray(path, parameters, new FBJsonClassFactory(FBTestUser.FromJson)); FBResult result = await arr.FirstAsync(); //Assert.IsTrue(result.Succeeded); IReadOnlyList<Object> users = null; try { users = (IReadOnlyList<Object>)result.Object; } catch (InvalidCastException) { Assert.IsTrue(false, "Item returned is not expected type" + " (IReadOnlyList<Object>)"); } return users; }
private async Task<FBObject> postToFeed( FBTestUser User, string Message ) { PropertySet parameters = new PropertySet(); parameters.Add("access_token", User.AccessToken); parameters.Add("message", Message); string path = "/" + User.Id + FBFeedPath; FBSingleValue sval = new FBSingleValue(path, parameters, new FBJsonClassFactory(FBObject.FromJson)); FBResult fbresult = await sval.PostAsync(); return (FBObject)fbresult.Object; }
private async Task<FBTestUser> createTestUser( PropertySet Parameters ) { FBTestUser user = null; bool success = false; // If you're creating/deleting test users frequently, like say in // a unit test suite, Facebook will occasionally fail this call with // the error code 1, type "OAuthException" and the message "An // unknown error occurred". Throwing in a short delay and retrying // almost always alleviates the problem, so adding a few retries // here greatly increases the robustness of the test suite. for (int retries = 0; (success == false) && (retries < 5); retries++) { string path = "/" + TestAppId + FBSDKTestUsersPath; FBSingleValue sval = new FBSingleValue(path, Parameters, new FBJsonClassFactory(FBTestUser.FromJson)); FBResult fbresult = await sval.PostAsync(); if ((fbresult.Succeeded == false) || (fbresult.Object == null)) { await Task.Delay(TEST_RETRY_DELAY); } else { try { user = (FBTestUser)fbresult.Object; success = true; } catch (InvalidCastException) { Assert.IsTrue(false, "Item returned is not expected type" + " (FBTestUser)"); } } } Assert.IsNotNull(user); return user; }
public async void LikeWebsite(String website) { PropertySet postParams = new PropertySet(); postParams.Add("object", website); string result = await FBClient.PostTaskAsync("/me/og.likes", postParams); if (!result.Contains("error")) { } }
/// <summary> /// This method Register the HLS component . /// </summary> public bool RegisterHLS() { bool bResult = false; if (extension == null) extension = new Windows.Media.MediaExtensionManager(); if (hlsPlugin == null) hlsPlugin = new Microsoft.PlayerFramework.Adaptive.HLS.HLSPlugin(); if ((hlsPlugin != null)&& (extension != null)) { if (HLSControllerFactory != null) { HLSControllerFactory.HLSControllerReady -= ControllerFactory_HLSControllerReady; HLSControllerFactory = null; } HLSControllerFactory = (hlsPlugin as Microsoft.PlayerFramework.Adaptive.HLS.HLSPlugin).ControllerFactory; //new Microsoft.HLSClient.HLSControllerFactory(); HLSControllerFactory.HLSControllerReady += ControllerFactory_HLSControllerReady; PropertySet hlsps = new PropertySet(); hlsps.Add("MimeType", "application/x-mpegurl"); hlsps.Add("ControllerFactory", HLSControllerFactory); extension.RegisterSchemeHandler("Microsoft.HLSClient.HLSPlaylistHandler", "ms-hls:", hlsps); extension.RegisterSchemeHandler("Microsoft.HLSClient.HLSPlaylistHandler", "ms-hls-s:", hlsps); extension.RegisterByteStreamHandler("Microsoft.HLSClient.HLSPlaylistHandler", ".m3u8", "application/x-mpegurl", hlsps); extension.RegisterByteStreamHandler("Microsoft.HLSClient.HLSPlaylistHandler", ".ism/manifest(format=m3u8-aapl)", "application/x-mpegurl", hlsps); mediaElement.Plugins.Add(hlsPlugin); bResult = true; } return bResult; }
private async void StartAsync(MediaCaptureInitializationSettings settings) { await Capture.InitializeAsync(settings); var veps = Capture.VideoDeviceController.GetAvailableMediaStreamProperties(MediaStreamType.VideoPreview).Where(x => x is VideoEncodingProperties).Cast<VideoEncodingProperties>().ToList(); if (veps.Count > 0) { // find the closest resolution if (DesiredWidth > 0 || DesiredHeight > 0) { var closest = new List<VideoEncodingProperties>(); var distance = -1; foreach (var vep in veps) { if (distance < 0) { closest.Add(vep); distance = GetSizeDistance(vep); } else { var d = GetSizeDistance(vep); if (d == distance) { closest.Add(vep); } else if (d < distance) { closest = new List<VideoEncodingProperties>(); closest.Add(vep); distance = d; } } } veps = closest; } // find the closest frame rate if (DesiredFrameRate > 0) { var closest = new List<VideoEncodingProperties>(); var distance = -1; foreach (var vep in veps) { if (distance < 0) { closest.Add(vep); distance = GetFrameRateDistance(vep); } else { var d = GetFrameRateDistance(vep); if (d == distance) { closest.Add(vep); } else if (d < distance) { closest = new List<VideoEncodingProperties>(); closest.Add(vep); distance = d; } } } veps = closest; } Log.DebugFormat("Found {0} matching video profile(s).", veps.Count.ToString()); if (veps.Count > 0) { var vep = veps[0]; Log.DebugFormat("Using ({0} x {1}, {2} fps, {3}) video profile.", vep.Width.ToString(), vep.Height.ToString(), (vep.FrameRate.Numerator / vep.FrameRate.Denominator).ToString(), vep.Subtype); // Set properties. await Capture.VideoDeviceController.SetMediaStreamPropertiesAsync(MediaStreamType.VideoPreview, vep); } } Preview.Source = Capture; var properties = new PropertySet(); properties.MapChanged += PropertiesChanges; await Capture.AddEffectAsync(MediaStreamType.VideoPreview, "VideoCaptureTransform.CaptureEffect", properties); await Capture.StartPreviewAsync(); }
public async Task testPublishCustomStory() { string token = await getAppToken(); PropertySet parameters = new PropertySet(); FBObject customObject = null; FBObject customStory = null; parameters.Add("access_token", Uri.EscapeUriString(token)); parameters.Add("permissions", "public_profile,publish_actions,user_photos"); FBTestUser user = await createTestUser(parameters); FBResult result = await publishCustomUserObject(user); Assert.IsTrue(result.Succeeded); try { customObject = (FBObject)result.Object; } catch (InvalidCastException) { Assert.IsFalse(true, "Object returned was not of the " + "expected type (FBObject)."); } result = await publishCustomStory(user, customObject); Assert.IsTrue(result.Succeeded); try { customStory = (FBObject)result.Object; } catch (InvalidCastException) { Assert.IsFalse(true, "Object returned was not of the " + "expected type (FBObject)."); } }
private void AddCustomEffect() { // Create a property set and add a property/value pair PropertySet echoProperties = new PropertySet(); echoProperties.Add("Mix", 0.5f); // Instantiate the custom effect defined in the 'CustomEffect' project AudioEffectDefinition echoEffectDefinition = new AudioEffectDefinition(typeof(AudioEchoEffect).FullName, echoProperties); fileInputNode.EffectDefinitions.Add(echoEffectDefinition); }
public async Task<FBResult> deleteTestUser( FBTestUser user ) { string token = await getAppToken(); PropertySet parameters = new PropertySet(); string path = "/" + user.Id; parameters.Add("access_token", Uri.EscapeUriString(token)); FBSingleValue sval = new FBSingleValue(path, parameters, new FBJsonClassFactory(FBSuccess.FromJson)); return await sval.DeleteAsync(); }
private void URIBoxKeyUp(object sender, KeyRoutedEventArgs e) { var textBox = sender as TextBox; String uri = textBox.Text; // Only respond when the text box is not empty and after Enter key is pressed if (e.Key == Windows.System.VirtualKey.Enter && !String.IsNullOrWhiteSpace(uri)) { // Mark event as handled to prevent duplicate event to re-triggered e.Handled = true; try { // Read toggle switches states and use them to setup FFmpeg MSS bool forceDecodeAudio = toggleSwitchAudioDecode.IsOn; bool forceDecodeVideo = toggleSwitchVideoDecode.IsOn; // Set FFmpeg specific options. List of options can be found in https://www.ffmpeg.org/ffmpeg-protocols.html PropertySet options = new PropertySet(); // Below are some sample options that you can set to configure RTSP streaming // options.Add("rtsp_flags", "prefer_tcp"); // options.Add("stimeout", 100000); // Instantiate FFmpegInteropMSS using the URI mediaElement.Stop(); FFmpegMSS = FFmpegInteropMSS.CreateFFmpegInteropMSSFromUri(uri, forceDecodeAudio, forceDecodeVideo, options); if (FFmpegMSS != null) { MediaStreamSource mss = FFmpegMSS.GetMediaStreamSource(); if (mss != null) { // Pass MediaStreamSource to Media Element mediaElement.SetMediaStreamSource(mss); // Close control panel after opening media Splitter.IsPaneOpen = false; } else { DisplayErrorMessage("Cannot open media"); } } else { DisplayErrorMessage("Cannot open media"); } } catch (Exception ex) { DisplayErrorMessage(ex.Message); } } }
public async Task<FBResult> publishCustomUserObject( FBTestUser user ) { PropertySet parameters = new PropertySet(); string path = user.Id + "/objects/logincs:noun"; Assert.IsNotNull(user.AccessToken); parameters.Add("access_token", user.AccessToken); parameters.Add("object", FBCustomObjectInstance); FBSingleValue sval = new FBSingleValue(path, parameters, new FBJsonClassFactory(FBObject.FromJson)); return await sval.PostAsync(); }
/// <summary> /// This method Register the Smooth Streaming component . /// </summary> public bool RegisterSmoothStreaming() { bool bResult = false; bResult = true; // Smooth Streaming initialization // Init SMOOTH Manager if (smoothStreamingManager != null) { smoothStreamingManager.ManifestReadyEvent -= SmoothStreamingManager_ManifestReadyEvent; smoothStreamingManager.AdaptiveSourceStatusUpdatedEvent -= SmoothStreamingManager_AdaptiveSourceStatusUpdatedEvent; smoothStreamingManager = null; } smoothStreamingManager = Microsoft.Media.AdaptiveStreaming.AdaptiveSourceManager.GetDefault() as Microsoft.Media.AdaptiveStreaming.AdaptiveSourceManager; if(extension==null) extension = new Windows.Media.MediaExtensionManager(); if ((smoothStreamingManager != null) && (extension != null)) { PropertySet ssps = new PropertySet(); ssps["{A5CE1DE8-1D00-427B-ACEF-FB9A3C93DE2D}"] = smoothStreamingManager; extension.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "text/xml", ssps); extension.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "application/vnd.ms-sstr+xml", ssps); extension.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".isml", "text/xml", ssps); extension.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".isml", "application/vnd.ms-sstr+xml", ssps); extension.RegisterSchemeHandler("Microsoft.Media.AdaptiveStreaming.SmoothSchemeHandler", "ms-sstr:", ssps); extension.RegisterSchemeHandler("Microsoft.Media.AdaptiveStreaming.SmoothSchemeHandler", "ms-sstrs:", ssps); smoothStreamingManager.ManifestReadyEvent += SmoothStreamingManager_ManifestReadyEvent; smoothStreamingManager.AdaptiveSourceStatusUpdatedEvent += SmoothStreamingManager_AdaptiveSourceStatusUpdatedEvent; bResult = true; } return bResult; }
public async Task<FBResult> publishCustomStory( FBTestUser user, FBObject customObject ) { PropertySet parameters = new PropertySet(); string path = user.Id + "/logincs:verb"; parameters.Add("noun", customObject.Id); parameters.Add("access_token", user.AccessToken); FBSingleValue sval = new FBSingleValue(path, parameters, new FBJsonClassFactory(FBObject.FromJson)); return await sval.PostAsync(); }
public async void PostMessage(String text) { PropertySet postParams = new PropertySet(); postParams.Add("message", text); string result = await FBClient.PostTaskAsync("/me/feed", postParams); if(!result.Contains("error")) { Dictionary<String, String> dictio = JsonConvert.DeserializeObject<Dictionary<string, string>>(result); string id = (String)dictio["id"]; LikeWebsite("www.avans.nl"); } }
public PropertySetStats() { _ps = new PropertySet(); _ps.MapChanged += this.MapChangedHandler; }
public void CreateFromUri_Options() { // Setup options PropertySet to configure FFmpeg PropertySet options = new PropertySet(); options.Add("rtsp_flags", "prefer_tcp"); options.Add("stimeout", 100000); Assert.IsNotNull(options); // CreateFFmpegInteropMSSFromUri should return valid FFmpegInteropMSS object which generates valid MediaStreamSource object FFmpegInteropMSS FFmpegMSS = FFmpegInteropMSS.CreateFFmpegInteropMSSFromUri("rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov", false, false, options); Assert.IsNotNull(FFmpegMSS); MediaStreamSource mss = FFmpegMSS.GetMediaStreamSource(); Assert.IsNotNull(mss); // Based on the provided media, check if the following properties are set correctly Assert.AreEqual(true, mss.CanSeek); Assert.AreNotEqual(0, mss.BufferTime.TotalMilliseconds); Assert.AreEqual(596458, mss.Duration.TotalMilliseconds); }
private async Task<string> getAppToken() { PropertySet parameters = new PropertySet(); string result = null; parameters.Add("request_host", FBSDKTokenServiceHost); parameters.Add("access_token", ""); parameters.Add("id", TestAppId); FBSingleValue sval = new FBSingleValue(FBSDKTokenApiPath, parameters, new FBJsonClassFactory((JsonText) => { JsonObject obj = null; if (!JsonObject.TryParse(JsonText, out obj)) { obj = null; } return obj; })); FBResult fbresult = await sval.GetAsync(); if (fbresult.Succeeded) { JsonObject obj = (JsonObject)fbresult.Object; if (obj.Keys.Contains("access_token")) { result = obj.GetNamedString("access_token"); } } return result; }