My objective is to increase the speed of audio.Is there any way to achieve this in winRT media element.
There are 2 properties you can use:
MediaElement.DefaultPlaybackRate
which will persist throughout the application session and
MediaElement.PlaybackRate
which will be lost after every Pause() or Stop() calls.
They are both of type double and default to 1.0
Related
I am having some doubts whether I understand correctly the concept of static component or not.
I am designing an experiment where I am presenting images for certain durations and once an image is gone the participant will have to submit a response.
I am using the builder for this and usually at the end I go on the coder view to make some minor alterations (randomise inter-trial durations etc)
So in the builder, I start a loop where my first routine has an ISI component for 0.5 seconds, then I add an image ad 0.5 seconds, a second routine in the loop records the key response.
What I want to do, in order to avoid lag, is to load the image during the ISI and then display it after the 0.5 seconds have passed. I am ok with the condition file and how to use parameters as variables. So in the Image entry I use $image (as declared in my excel file), I also declare that I want this image to be set "during trial:ISI". Does this do what I have in mind? Load the image during ISI and flip it once ISI finishes?
Secondly, do you think it will be more efficient to have the ISI and the image in different routines inside the same loop?
If you have any other suggestions on how it can be done in a more efficient way please let me know.
Thank you.
(1) Yes, this is the correct way to use the ISI to pre-load an image.
(2) No, there is no need to split across different routines.
(3) You should avoid going "on the coder view to make some minor alterations". Once you make changes there, the Builder view can't be utilised any more. It is very likely that you can achieve what you want by putting code within a Code Component in the Builder view, so you don't have to abandon the advantages of the graphical interface.
I'm writing a small custom player based on libvlc. I've used much of the code from https://github.com/hartror/python-libvlc-bindings/blob/master/examples/gtkvlc.py that plays a single track just like I need.
Now I want to swtich to another track after previous has finished. To do that I catch callback "EventType.MediaPlayerEndReached" and in callback handler I write code:
<------>def endCallback(self,event):
<------><------>fname = vlc_controller.GetNextTrack()['url']
<------><------>self.w.set_title(fname)
<------><------>self.vlc.player.set_mrl(fname)
<------><------>self.w.set_title('after set_mrl')
<------><------>self.vlc.player.play()
<------><------>self.w.set_title('after play')
Now when this code gets executed it stucks on self.vlc.player.set_mrl(fname) and does not go any further and as a result I see NO NEXT TRACK.
I've tried different variations of this code using (vlc.stop(), vlc.set_media instead of vlc.set_mrl) but nothing works
Finally....
I think the best choise is to make multi threaded application on python
2 Threads:
Main thread - gtk.loop and displaying video an some other thinks
Additional thread that makes media switching.
For some time I was afraid of multithreading but now I know that this was the best way to do this task
For those facing similar issue in C# (Xamarin), per VLC documentation, calling the VLC object from an event tied to the object may freeze the application. So they said to use the code below inside the trigger event.
ThreadPool.QueueUserWorkItem(_ => PlayNext());
An example would be calling the code above inside the EndReach event.
Where PlayNext() is your own custom method to handle the next action you want to execute.
I struggled with this for about a day before seeing that portion of the documentation.
is there a way to trigger the loading animation of a ListView manually?
I load some data on start up from a web service and would like to display a busy indecator.
function searchData(url) {
var promise = DataService.getData(query);
promise.done(function (result) {
console.dir(result);
var bindingList = new WinJS.Binding.List(result);
sectionListView.winControl.itemDataSource = bindingList.dataSource;
});
}
this is what I do in app.onactivated
promise = WinJS.UI.processAll();
promise.done(function () {
searchData(query);
});
args.setPromise(promise);
I read something that ListView should display busy animation while waiting for a promise...
Is this true?
Or is this something I have to do manually... display and hide a div whenever needed?
Thanks for any help...
According to this thread, the progress ring will only appear if the ListView is hooked up to an asynchronous data source, while the WinJS.Binding.List is synchronous. I don't think there are any asynchronous data sources available by default, so you would have to set up a custom data source to be able to get that default progress ring. I would recommend just setting a progress ring to run when your app starts and removing it in the done block of your data promise.
You need to create your own custom List Data Source. WinJS provides the utilities to do this pretty easily. This is a good sample against the Bing web service. If you need more samples of how to write your own Data Source / Data Adapter let me know, I've written a few.
A slightly odd question, but is there anyway to find out what easing functions are used in the WinRT XAML Theme Animations - more specifically I'm trying to replicate that of the EntranceThemeTransition (which I can't use directly).
I naively thought using something like .NET reflector would help, but I'd gather I'd need the actual source code rather than what .Net Reflector shows.
Anyone any ideas?
You might like to take a look at the AnimationMetrics sample on MSDN.
There is an AnimationDescription class that will tell you all sorts of info on the built in animation types, basically anything in the Windows.UI.Core.AnimationMetrics.AnimationEffect enum.
For example:
var animationDescription = new AnimationDescription(AnimationEffect.EnterPage, AnimationEffectTarget.Incoming);
var s = new System.Text.StringBuilder();
s.AppendFormat("Stagger delay = {0}ms", animationDescription.StaggerDelay.TotalMilliseconds);
s.AppendLine();
s.AppendFormat("Stagger delay factor = {0}", animationDescription.StaggerDelayFactor);
s.AppendLine();
s.AppendFormat("Delay limit = {0}ms", animationDescription.DelayLimit.TotalMilliseconds);
s.AppendLine();
s.AppendFormat("ZOrder = {0}", animationDescription.ZOrder);
s.AppendLine();
s.AppendLine();
//etc
Link: http://code.msdn.microsoft.com/windowsapps/Animation-metrics-sample-acb0220c
I believe these built in animations are implemented in a different way and they run independently from regular Storyboard + child animations, so you would need to approximate these with some tests that compare these with regular Storyboard animations that you implement running side by side.
One way to visualize easing functions is to run a theme transition moving a UI element in one axis while you run another one that moves the element in a perpendicular axis in a linear motion (with no easing function applied).
Is there any way to force a Kaltura videoplayer to stop ONLY using code and the Kaltura API?
Currently I have solved it by adding a Access Control Profile named "Free preview" under Settings > Access Control in KMC and then added this profile to the Entries I've choosen.
I then add the session to the players flashvars to restrict non-members to only watch the preview, not the whole clip.
But I would like to restrict ALL, or even better selected Categories of clips by using only code, so I don't need to involve KMC.
Is that possible?
Alt) Can you create a new player in KMC and restrict it to viewing only X seconds, no matter what length of Entry? Then I can do the check if user is valid or not and get the category via API and show it in the "preview-player" och the "default player".
If I use the mediaProxy.mediaPlayTo attribute the clip stops, but is easily started again by presing play.
Would greatly appreciate an answer
I got this answer from a guy named oferc in a different forum:
You can listen to the head move event and pause the clip it goes beyond a certain time (then if someone pressed play, you can stop it again)
function jsCallbackReady(player_id) {
my_kdp = $("#"+player_id).get(0); // document.getElementById(player_id) if you do not use jquery/ prefer pure js
my_kdp.addJsListener("kdpReady", "kdpReady"); // when you load the player with an entry (and the player is ready to begin playing it using doPlay for instance)
}
function kdpReady() {
my_kdp.addJsListener("playerUpdatePlayhead","headMove");
}
function headMove(position) {
if (position > "30") { // Your Time, example 30 seconds
my_kdp.sendNotification('doStop')
}
}
Works like a charm!
fredrik_w - neither of the ways you chosen here are a good option to restrict access.
in both cases, your videos are made public, and can be easily accessible by anyone.
The best way to limit access to a video is by defining an Access Control, and like everything in Kaltura, you can define an ACL using API as well.
Check this out as a reference sample-
http://blog.kaltura.org/turning-profit-online-video-made-easy-using-paypal-html5-digital-goods