I guys:)
I am doing an windows phone application that presents videos, but presents when syncronized with an ntp server. I already have a variable with the time but i donĀ“t know now what to do. I try search in google but i dont find anything.. I want to make an application to present the same video at the same time in different phones..
Any help? Examples?
The simplest way to get multiple devices doing something in sync is to define a time at which they should all start (do this on a central server) and then have each device request the amount of time to wait until the start. Each device should then start playback when that period has elapsed.
If you need to have different devices join in at specific ppoints when some are already playing the video your central point will need to send the point to start playing as well as the amount of time to wait until playback shoudl begin.
Due to the latency of the network communication you won't be able to get perfect sync though.
Related
Is there a better way to maintain hub state sync than periodic random checks? The physical remote gets a notification nearly instantaneously of a state change on the hub so I assume it's subscribed somehow to push-updates. Is the best approach to just send a GET request for the hub state every 30 seconds to a minute while idle, and every 5-10 seconds after an activity change? I don't want to bombard the servers with lots of requests but I'm not sure how to know when to unlock the UI after a successful activity initiation.
The current Smart Home Group API does not provide notifications of Activity or device state changes. This is something Logitech expects to implement later this calendar year.
I am trying to collect GPS location every 5 seconds from a smart phone by using socket.io.
I notice that when users pick up a phone call, socket.io will stop emitting messages. When users switching tabs in the browser, socket.io will stop emitting messages too.
Does anyone know how to solve this problem?
Thanks very much!
Your best bet would be to package the website in a native app. Use a service such as http://build.phonegap.com or Intel XDK. There are configuration options to keep your app alive in the background. As for it disconnecting during phone calls, this is a carrier limitation. If the user was connected to WIFI, most phones will that for data while simultaneously on a call.
Some networks (such as Verizon) do not have the capability to do voice and data at the same time. Thus, when a call is made, data is suspended until the call is finished. AT&T does not have this limitation.
The operation of background tabs will vary by mobile browser and is likely done for battery conservation reasons. It is unlikely there is a work-around to keep the background tab running (because that would defeat the whole battery management purpose).
In my windows phone 8 application, I would like to refresh/load some data periodically (less than 10 minutes) from server, while application running in background (ie, in dormant and tombstoned). I tried scheduled task agent and resource intensive task agent, but they are called at rate of 30 minutes gap. Please let me know is there any other solution for implementing the above said requirement.
Thanks and Regards
#nish
If you need to get data more frequently than the default available in Windows Phone, you should think about using push notifications. This won't be suitable for a full data push, but if you use it correctly, you can get a user experience that you can live with.
One common approach to this is to set up your server to send a notification to the device when there is something new to report instead of pushing a "nothing has changed" message every 10 minutes or so. If you push out a tile update notification to say, for example, "You have x unread items", the user may then click on the tile for your app and you can poll the server for new items on launch/resume. If you want a more intrusive option, you can send a toast notification as well, but in most cases the tile update will be sufficient.
This method has a few advantages.
You won't be burning through battery power polling every 10 minutes while the user is asleep
Your server will have significantly less load since it is not having to process full data requests every 10 minutes per client.
This fits in with the design philosophy of Phone apps - you are surfacing the required data to the user, while at the same time preserving battery life.
Do I understand correctly that your primary goal is to keep some host session alive by having the phone make a query periodically? If so...
I would not recommend this approach: 1) you cannot count on the phone having network connectivity when it tries to send its query. If the user puts the phone away in a pocket or purse, the odds worsen. 2) it's probably bad from a security perspective, and wasteful from a host resources perspective.
You might instead add logic to your app to resume a timed-out host session as seamlessly as possible. This would add real utility value to the mobile app value proposition over raw HTTP access to the same host.
I am planning to write WP7 app, which needs to send to server phones GPS position every 5 minutes. Data must be sent to server even if app is not running. One way to do that is to use Background agents (I am using 7.5 Mango), but in that case app will send data only every 30 minutes, which is not acceptable in my case.
Is there any other solution?
Thanks in advice.
No, this is not a supported usecase for WP7 apps on Mango. Also, it's important to mention that the location you'll get for GeoCoordinateWatcher on a background agent is a cached geolocation from approximately the last 15 minutes and not the real-time geolocation.
What exactly are you trying to build if you don't mind me asking? This sounds oddly close to spyware. Even if it's innocuous and meant for a good purpose, I'd be careful walking in any direction that constantly shares GeoLoc with a remote server.
Your only choices are sending the data every 5 minutes while application is running (even when the phone is locked) and/or send the data once every 30 minutes by registering a PeriodicTask.
Having said that, I agree with Justin in that what you are describing sounds nefarious.
I need to synchronize a video in diferrent devices with windows phone. So i get the hour from a ntp server and then convert it to miliseconds. Now i think i need to make a internal clock to count the time to launch the video. I have some difficultes to understand this. I don't see examples in the internet. Can anyone help me? I need to know how to do that.
Your question is vey vague and missing lots of information relevant to what you're actually trying to achieve. However, by piecing together information from what I assume are your related other questions, here goes.
The simplest way of having a video play at the same time on multiple devices is to have it streamed in real time from a central server.
If it's not playing directly from a central server then there is a question about where the video file is downloaded from and how you define when the video should be started from. There is also a question about why/if it really needs to be played in sync.
Assuming that you have a central server to determine what to play when:
An NTP server only seems relevant to this scenario if the video content is shipped with the app or is fully downloaded. You can then use the NTP server to determine the difference between the devices time and that returned from the central server. (Note that you can't set the devices time via the available APIs.) You should then query the central server to find out where the video should be played from. I'd suggest having the server respond with a response that indicates the point to start playing back in a couple of seconds. i.e. the equivalent of "Play video X, skipping the first Y seconds/milliseconds/ticks and starting in Z seconds time.
If you don't have a central server to determine when to play what then, the only assumption I can make about how this scenario would work is if all devices have the content (or first download it before trying to play) and details about when that content should be played. A simple example of this would be a 1 hour video which is played on a loop. The NTP server could be used to find out what the actual current time is (subject to the difference allowed for the NTP request) and then start playing the track at the same position through at the time it is past the hour.
In the above scenarios when I state that content must be downlaoded before trying to play, this is to ensure that there aren't issues with the download being slower than playback as the time taken to buffer would get playback out of sync.
Hope this helps.