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 }); }); }
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(); } }
/// <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); }
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"); }
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"); }
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(); }
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)); } }
/// <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); }
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<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 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> /// 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; }
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 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 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")) { } }
public static IPropertySet ToPropertySet(this string parameter) { var propertySet = new PropertySet(); propertySet.Add(nameof(parameter), parameter); return propertySet; }
public void SetUpProtectionManager(MediaPlayer mediaPlayer) { Log("Enter SetUpProtectionManager"); if(mediaPlayer == null) throw new ArgumentException("SetUpProtectionManager was passed a null MediaPlayer"); Log("Creating protection system mappings..."); var protectionManager = new MediaProtectionManager(); protectionManager.ComponentLoadFailed += new ComponentLoadFailedEventHandler(ProtectionManager_ComponentLoadFailed); protectionManager.ServiceRequested += new ServiceRequestedEventHandler(ProtectionManager_ServiceRequested); // The code here is mandatory and should be just copied directly over to the app // Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/aa376846%28v=vs.85%29.aspx // Setup PlayReady as the ProtectionSystem to use by mediaFoundation: var contentProtectionSystems = new PropertySet(); contentProtectionSystems.Add(PlayReadyWinRTTrustedInput); protectionManager.Properties.Add(MediaProtectionSystemIdMapping, contentProtectionSystems); protectionManager.Properties.Add(MediaProtectionSystemId); protectionManager.Properties.Add(MediaProtectionContainerGuid); mediaPlayer.ProtectionManager = protectionManager; Log("Leave SetUpProtectionManager"); }
/// <summary> /// Register Legacy HLS Plugin /// </summary> void RegisterHLSPlugins(Windows.Media.MediaExtensionManager HLSMediaManager) { LogMessage("Register plugins"); // HLS registration if (HLSControllerFactory != null) { HLSControllerFactory.HLSControllerReady -= ControllerFactory_HLSControllerReady; HLSControllerFactory = null; } HLSControllerFactory = new Microsoft.HLSClient.HLSControllerFactory(); HLSControllerFactory.HLSControllerReady += ControllerFactory_HLSControllerReady; PropertySet hlsps = new PropertySet(); hlsps.Add("MimeType", "application/x-mpegurl"); hlsps.Add("ControllerFactory", HLSControllerFactory); HLSMediaManager.RegisterSchemeHandler("Microsoft.HLSClient.HLSPlaylistHandler", "ms-hls:", hlsps); HLSMediaManager.RegisterSchemeHandler("Microsoft.HLSClient.HLSPlaylistHandler", "ms-hls-s:", hlsps); HLSMediaManager.RegisterByteStreamHandler("Microsoft.HLSClient.HLSPlaylistHandler", ".m3u8", "application/x-mpegurl", hlsps); HLSMediaManager.RegisterByteStreamHandler("Microsoft.HLSClient.HLSPlaylistHandler", ".ism/manifest(format=m3u8-aapl)", "application/x-mpegurl", hlsps); }
public async Task CreateFromStream_Options() { Uri uri = new Uri(_UriSource); Assert.IsNotNull(uri); StorageFile file = await StorageFile.CreateStreamedFileFromUriAsync("d8c317bd-9fbb-4c5f-94ed-501f09841917.mp4", uri, null); Assert.IsNotNull(file); IRandomAccessStream readStream = await file.OpenAsync(FileAccessMode.Read); Assert.IsNotNull(readStream); // Setup options PropertySet to configure FFmpeg PropertySet options = new PropertySet(); options.Add("rtsp_flags", "prefer_tcp"); options.Add("stimeout", 100000); Assert.IsNotNull(options); // CreateFFmpegInteropMSSFromStream should return valid FFmpegInteropMSS object which generates valid MediaStreamSource object FFmpegInteropMSS FFmpegMSS = FFmpegInteropMSS.CreateFFmpegInteropMSSFromStream(readStream, 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(_UriLength, mss.Duration.TotalMilliseconds); }
private void OnConnectionEstablished() { System.Diagnostics.Debug.WriteLine("connection esablished"); SetAllPixelsAndUpdate(255, 0, 0); // OnNavigatedTo goes here // Audio Callbacks this.CreateAudioGraph(); this.SelectInputFile(); // add effect // Create a property set and add a property/value pair echoProperties = new PropertySet(); echoProperties.Add("Mix", 0.5f); echoProperties.Add("Data", new double[512]); // starts the callback that plays th emusic. audioTimer = new Timer(Callback, null, 50, 0); TogglePlay(); }
/// <summary> /// Updates the file with the user-edited properties. The m_imageProperties object /// is still usable after the method completes. /// </summary> private async void Apply_Click(object sender, RoutedEventArgs e) { rootPage.NotifyUser("Saving file...", NotifyType.StatusMessage); m_imageProperties.Title = TitleTextbox.Text; // Keywords are stored as an IList of strings. if (KeywordsTextbox.Text.Length > 0) { string[] keywordsArray = KeywordsTextbox.Text.Split('\n'); m_imageProperties.Keywords.Clear(); for (uint i = 0; i < keywordsArray.Length; i++) { m_imageProperties.Keywords.Add(keywordsArray[i]); } } PropertySet propertiesToSave = new PropertySet(); // Perform some simple validation of the GPS data and package it in a format // better suited for writing to the file. bool gpsWriteFailed = false; double[] latitude = new double[3]; double[] longitude = new double[3]; string latitudeRef = String.Empty; string longitudeRef = String.Empty; try { latitude[0] = Math.Floor(Double.Parse(LatDegTextbox.Text)); latitude[1] = Math.Floor(Double.Parse(LatMinTextbox.Text)); latitude[2] = Double.Parse(LatSecTextbox.Text); longitude[0] = Math.Floor(Double.Parse(LongDegTextbox.Text)); longitude[1] = Math.Floor(Double.Parse(LongMinTextbox.Text)); longitude[2] = Double.Parse(LongSecTextbox.Text); latitudeRef = LatRefTextbox.Text.ToUpper(); longitudeRef = LongRefTextbox.Text.ToUpper(); } catch (Exception) // Treat any exception as invalid GPS data. { gpsWriteFailed = true; } if ((latitude[0] >= 0 && latitude[0] <= 90) && (latitude[1] >= 0 && latitude[1] <= 60) && (latitude[2] >= 0 && latitude[2] <= 60) && (latitudeRef == "N" || latitudeRef == "S") && (longitude[0] >= 0 && longitude[0] <= 180) && (latitude[1] >= 0 && longitude[1] <= 60) && (longitude[2] >= 0 && longitude[2] <= 60) && (longitudeRef == "E" || longitudeRef == "W")) { propertiesToSave.Add("System.GPS.LatitudeRef", latitudeRef); propertiesToSave.Add("System.GPS.LongitudeRef", longitudeRef); // The Latitude and Longitude properties are read-only. Instead, // write to System.GPS.LatitudeNumerator, LatitudeDenominator, etc. // These are length 3 arrays of integers. For simplicity, the // seconds data is rounded to the nearest 10000th. uint[] latitudeNumerator = { (uint) latitude[0], (uint) latitude[1], (uint) (latitude[2] * 10000) }; uint[] longitudeNumerator = { (uint) longitude[0], (uint) longitude[1], (uint) (longitude[2] * 10000) }; // LatitudeDenominator and LongitudeDenominator share the same values. uint[] denominator = { 1, 1, 10000 }; propertiesToSave.Add("System.GPS.LatitudeNumerator", latitudeNumerator); propertiesToSave.Add("System.GPS.LatitudeDenominator", denominator); propertiesToSave.Add("System.GPS.LongitudeNumerator", longitudeNumerator); propertiesToSave.Add("System.GPS.LongitudeDenominator", denominator); } else { gpsWriteFailed = true; } try { // SavePropertiesAsync commits edits to the top level properties (e.g. Title) as // well as any Windows properties contained within the propertiesToSave parameter. await m_imageProperties.SavePropertiesAsync(propertiesToSave); rootPage.NotifyUser(gpsWriteFailed ? "GPS data invalid; other properties successfully updated" : "All properties successfully updated", NotifyType.StatusMessage); } catch (Exception err) { switch (err.HResult) { case E_INVALIDARG: // Some imaging formats, such as PNG and BMP, do not support Windows properties. // Other formats do not support all Windows properties. // For example, JPEG does not support System.FlagStatus. rootPage.NotifyUser("Error: A property value is invalid, or the file format does " + "not support one or more requested properties.", NotifyType.ErrorMessage); break; default: rootPage.NotifyUser("Error: " + err.Message, NotifyType.ErrorMessage); break; } ResetSessionState(); ResetPersistedState(); } }
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)."); } }
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; }
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<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 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(); }
/// <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; }
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(); }
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"); } }
private static async void FacebookPoster() { // Get active session FBSession sess = FBSession.ActiveSession; if (sess.LoggedIn) { var user = sess.User; // Set caption, link and description parameters var parameters = new PropertySet(); // Add post message await LocationAccesser(); parameters.Add("message", _message + "\n" + "\n" + _latitude + "\n" + _longitude); // Set Graph api path var path = "/" + user.Id + "/feed"; var factory = new FBJsonClassFactory(s => { return JsonConvert.DeserializeObject<FBReturnObject>(s); }); var singleValue = new FBSingleValue(path, parameters, factory); var result = await singleValue.PostAsync(); if (result.Succeeded) { Debug.WriteLine("Succeed"); } else { Debug.WriteLine("Failed"); } } }
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; }