iOS App and youtube client

2019-04-11 15:31发布

Time ago I searched informations about the integration of youtube into an ios application. Now I need to do this again so I started looking for information on google. After a short time are already confused. Can I use this iOS youtube sample

or have I to use YouTube Data API (v3)? And this?

2条回答
叼着烟拽天下
2楼-- · 2019-04-11 15:52

Short answer:

  1. The API refers to the HTTP interface for consuming Google's funcionality.
  2. One can use these APIs by issuing HTTP requests directly, according to the specification of the API, or by using one of the client libraries. The client libraries are a layer on top of HTTP that issue the HTTP requests and parse the responses. They give a simpler interface for invoking the API (e.g. using standard function calls in the given programming language rather than building HTTP requests) and they also simplify a lot of the complex parts such as authentication, refreshing tokens, etc.

Long answer:

An application programming interface or API is the "contract" between a provider of some functionality and the consumer of some functionality that allows both the provider and consumer of that functionality to interoperate without knowledge of the underlying implementation of the other party. This "contract" includes such things as the number and types of the inputs, the names of the inputs (if it is required to invoke the functionality), any constraints on the inputs, the expected outputs, any constraints on the outputs, failure modes, etc.

Google provides a number of HTTP-based APIs for accessing functionality from its services. Its services implement these APIs, which are consumed by issuing HTTP requests and reading the HTTP responses. HTTP is a convenient protocol to implement, because every device and language can speak HTTP; however, it is not always the most convenient to use as a developer. In many cases, the inputs and outputs you want are objects, not HTTP requests and HTTP responses. And, in many cases, matching function signatures in the language of your choosing and type-checking of inputs is more convenient than memorizing the HTTP request paths or manually serializing/deserializing your objects to HTTP requests or content sent within the request. That is where the client libraries come in. Whereas the HTTP APIs are implemented on Google's servers, the client libraries are libraries that developers include in their application and are distributed to the devices on which those applications run. The client libraries issue the HTTP requests and interpret the responses, and provide a more convenient programming language-specific wrapper, for a variety of different programming languages.

The data API link that you provided is documenting the HTTP-based API. Whereas the sample application is using the client library (which is invoking the HTTP-based API under the hood). The last link you provided, the cloud endpoints for iOS is unrelated to what you are trying to do; it is documenting a mechanism called Cloud Endpoints, a feature of App Engine, that allows developers to create their own HTTP APIs using Google's infrastructure and to auto-generate client libraries that wrap these HTTP APIs (much as Google auto-generates the client libraries for its own HTTP APIs).

查看更多
叛逆
3楼-- · 2019-04-11 16:14

Here's a sample app you can get started to build YouTube APIs on iOS.

Also there is an helper library to play YT videos in iOS.

查看更多
登录 后发表回答