RemotePlayer vs Media - google-chrome

I'm building a Google Cast integration for a music app in Chrome.
What is the difference between cast.framework.RemotePlayer and chrome.cast.media.Media?
The documentation uses cast.framework.RemotePlayer and cast.framework.RemotePlayerController, but they don't have functions for managing the queue, while chrome.cast.media.Media does.
Which one should I use?

I discovered the cast.framework namespace is used for a high-level API built on top of the chrome.cast namespace, which is a low-level API.
It doesn't matter whether you use cast.framework.RemotePlayer or chrome.cast.media.Media, both of them will work, but Media has more functions and callbacks.
In my experience, Media is easier to work with than RemotePlayer, so I don't really get why they created the RemotePlayer class.

Related

TVML vs Custom App for Apple TVOS

Are there any advantage of using TVML over custom App (media based App not a game) for Apple TVOS? From what I read from Apple's documentation I could not figure out any such advantage (though it mostly talks about TVML/TVJs).
For iOS (Swift, Objective C) developers, using custom seems like easier, faster and with more possibilities.
I think whatever templates are provided by Apple can be build using UIKit because internally it is UIKit. Right?
[Update]
Let me rephrase my original question as the answers so far are not given any points in favour of custom App. I agree that #shirefriendship has some real valid points in favour of TVML (biggest one is- > App changes possible w/o an App update). Are there any advantages of using custom over TVML? Like anything not in reach of TVML?
Having already built an application using TVML/JS and now working on a native application I would say that the Javascript option is aimed more towards beginners or basic applications.
TVML applications provide an easier, faster way to build standard applications with common features/user interface. We used it to rapidly build a prototype of an application. Now that we've launched the application and it's getting some uplift (featured in What to Watch and Top Free Apps UK) we are now rebuilding it natively to add additional features such as analytics, crash reporting, custom interfaces and other bits to increase re-circulation and custom recommendations.
#shirefriendship's answer provides a good explanation to the benefits of TVML applications and I think this is a good option for beginners, prototype applications or even basic applications.
Native applications provide alot more control over how the application looks, works and feels. Having access to most of the iOS SDK's allows you to do more such as integrating Cloudkit, develop 2D & 3D games and more.
Once we have finished development of our native TV application I'll update the answer with some more information such as development time between the two different versions, features in the application etc.
UPDATE: To answer your second question, yes you can pretty much develop ANY user interface / template using UIKit, the TVML templates provide user interfaces that would be commonly used / quite handy. Using UIKit you could replicate or customize any of the pre-defined templates or build something completely new.
It is true that you have more flexibility with custom UIKit code. With enough time, you could potentially create an app that behaves similarly to a TVML/TVJS app...but why reinvent the wheel?
There are certain advantages to using TVML Templates, even if you are primarily a Swift/Obj-C developer.
TVML templates provide a familiar experience for the user. Have you
ever used the Netflix TV app, or HBO GO, or iTunes? They all use
TVML Templates and have a distinct look and feel to them. This cuts down drastically on design time.
Templates are incredibly easy to implement, even with very little
JavaScript experience. Auto-layout is taken care of for you. Lazy
loading images occurs automatically. The behavior of every UI
element on the screen has already been taken care of by Apple.
The templates are structured yet customizable. Templates are plug
and play, but you can still customize certain aspects of the UI
elements Styles and Attributes
You can host your TVML/TVJS files on a web server. This allows you
to make changes to your app without your user needing to download an
update to your app.
You can mix and match TVML with custom UIKit. Want Custom behavior with UIKit sometimes, but for standard views, you'd prefer a template? Why choose? You can have BOTH in the same app. Check out my answer here that describes how: How To Mix UIKit and TVML Within One App
When in doubt, try it out! Mess around with the Catalog App from Apple and see if you like TVML templates. You might surprise yourself.
MSK
The primary advantage of TVML is that it is all javascript which appeals to a broader base of developers.
Not sure about your second question regarding developing templates via UIKit

google closure geolocation api

Is there a geolocation API part of google closure (ultimately for use in ClojureScript) ?
I've been looking for it, but all I can find is something that looks like an old shim.
If there is none, is it because Google doesn't use that feature of web browsers (they find our location using other means), or because the browser API doesn't require that (already unified), and what would be the best alternative in ClojureScript ?
Nothing is in Closure for this right now. Generally, Closure only wraps these native APIs when there are cross-browser compatibility issues, is potential for a polyfill, or potential for improvement. I'm not personally too familiar with these APIs, but my guess is it's not in Closure because it's pretty standardized across the browsers that implement it.
The "shim" link you provided is what's called an externs file. It's used in conjunction with the Closure Compiler to avoid renaming certain properties. See this resource for more info.

Same code for Cocos2Dx and Cocos2d-html5?

Here I see the following:
.... the team of Cocos2d-x are working on something called "Javascript binding for Cocos2d". What that means is your very same code running on Cocos2d-html5 engine can work flawlessly on Cocos2d-X and Cocos2d-iPhone without or with little modification. And all that translates to "almost native fast on mobile phones".
What I can not understnad is that how the code written in one language can be translated to another one? Do they mean that there is a tool that gets as an input JavaScript code of Cocos2d-html5 game and translate it to C++ Cocos2dx code or backwards?
EIDT: Can I port easily the C++ game written with Cocos2Dx into Cocos2D-html5? What I have to do for that?
Cocos2d-x and Cocos2d-html5 share the same Javascript API and are written to give developer an advantage to write your code in Javascript and it will work with both of these frameworks.
As for you second question, Cocos2d-html5 runs Javascript natively whereas Cocos2d-x uses SpiderMonkey (a Javascript engine written in C/C++ by Brendan Eich) to run your Javascript code.
Although, there is one important thing to consider. Developing games using native language and APIs takes less time, easy to debug and are easily expandable and maintainable. So, in my opinion one should use cocos2d-iphone if the game is only for iOS, cocos2d-x if the game is on multi-platforms and cocos2d-html5 only if the primary target of the game is web.
It means that both cocos2d-x and cocos2d-html use the same Javascript API. So under ideal circumstances the same JS code runs on html5 and another time with the -x engine.
However there can still be differences because behind the scenes the implementation may be subtly (or not so subtly) different with each engine. Also not all features (ie touch input, accelerometer, shaders) can be available on every engine. Hence the phrasing "with little modification".
But if your main target isn't web there's little sense in using the JS API because it adds an extra layer that makes it more difficult to debug code issues, and the overall performance suffers compared to writing directly (in C++) for -x.

What Haskell web framework would one use for an HTTP/Websocket data and messaging platform?

Just looking at Haskell and web frameworks and wondering if it would make sense to use Haskell's great threading/event functionality to power a platform for writing HTML5 and REST apps that expose an HTTP API for data and a WebSocket (with maybe SockJS support for appropriate fallback) API for events? It doesn't seem like the "big" web frameworks support WebSockets as a first-class citizen, though they seem to have a lot of other things going for them.
My concern is making use of available cores, which Haskell can do well, but also providing easy user integration on the server side for validation and server-side logic (maybe by embedding Lua or similar?). If one wrote this on the JVM, one could make use of multiple server-side language support and lots of libraries for this sort of thing.
I'm sure people are doing things like this in a one-off solution for their own applications but I'm thinking along the lines of a PaaS-type approach where one can write HTML5 apps with data (including proper synchronization for offline use) and eventing "for free" as a fundamental part of the platform. Most logic would reside in the browser but some could be run on the server with the appropriate hooks and a reasonable embeddability (JavaScript seems out of the question and not sure about embedding interpreters in Haskell as I'm only dangerously familiar with Haskell in general).
Part of the problem I've had with Haskell so far is that I'm not a Math guy. I didn't study CS in college and I'm a creative-type thinker. So a lot of the tutorials and documentation get me pretty lost, especially when dealing with the mathematical stuff.
Has anyone trod this path already? Am I late to the party? :)
Gregory Collins gave a tutorial at CUFP last year about using Snap to build an interactive chat website using long polling (not websockets). The source code is here.
In the websockets department, Jasper Van der Jeugt wrote a Haskell websockets library. It is available on hackage and comes with websockets-snap, which provides Snap framework support. There's also wai-websockets which provides integration with Warp.
I believe all of the major frameworks have some level of websockets support, so they should all be a fair choice based on your requirements. For Yesod, there's an example of creating a chat system (using eventsource, not websockets) available in the book:
http://www.yesodweb.com/book/wiki-chat-example

How should i differentiate a service with a model in a project?

It's confusing to categorize something into a model, and others into services. Is their any good thumb rule, help of which i may distinguish between a service and a model. I tried to look into various mvc docs, but almost all of them talk about model-view-and controller. Nothing about services.
Thanks
I would advise you to take a look at Robotlegs.
It is an ActionScript MVC(S) framework that promotes looser coupling between components, and has hooks to handle models and services accordingly.
Rules of thumb to distinguish whether to use a Service or a Model are described thoroughly in the documentation.
In short, a Service would be used to connect your application to the outside world, thus bringing external state into your application.
Whereas a Model would be used to store internal application state.
Robotlegs also features a handy IOC container.
You will be able to either implement your application with this framework or you could get a lot of ideas from looking at the framework code.
Check these out:
http://www.robotlegs.org/
http://www.robotlegs.org/diagram/