Hướng dẫn tích hợp Engage SDK cho TV

Tính năng Tiếp tục xem tận dụng cụm Tiếp tục để hiển thị các video đang xem dở và các tập tiếp theo cần xem trong cùng một phần của chương trình truyền hình, từ nhiều ứng dụng trong một nhóm giao diện người dùng. Bạn có thể làm nổi bật các thực thể của họ trong cụm tiếp nối này. Hãy làm theo hướng dẫn này để tìm hiểu cách nâng cao mức độ tương tác của người dùng thông qua trải nghiệm Tiếp tục xem bằng Engage SDK.

Chuẩn bị trước

Trước khi bắt đầu, hãy hoàn tất các bước sau:

  1. cập nhật lên Target API 19 trở lên

  2. Thêm thư viện com.google.android.engage vào ứng dụng của bạn:

    Có các SDK riêng biệt để sử dụng trong quá trình tích hợp: một cho ứng dụng di động và một cho ứng dụng truyền hình.

    Thiết bị di động

    
      dependencies {
        implementation 'com.google.android.engage:engage-core:1.5.5
      }
    

    TV

    
      dependencies {
        implementation 'com.google.android.engage:engage-tv:1.0.2
      }
    
  3. Đặt môi trường dịch vụ Engage thành môi trường phát hành chính thức trong tệp AndroidManifest.xml.

    Thiết bị di động

    
    <meta-data
        android:name="com.google.android.engage.service.ENV"
        android:value="PRODUCTION" />
    

    TV

    
    <meta-data
        android:name="com.google.android.engage.service.ENV"
        android:value="PRODUCTION" />
    
  4. Thêm quyền cho WRITE_EPG_DATA đối với tệp APK của TV

    <uses-permission android:name="com.android.providers.tv.permission.WRITE_EPG_DATA" />
    
  5. Xác minh việc xuất bản nội dung đáng tin cậy bằng cách sử dụng một dịch vụ nền, chẳng hạn như androidx.work, để lập lịch.

  6. Để mang đến trải nghiệm xem liền mạch, hãy xuất bản dữ liệu xem tiếp khi những sự kiện này xảy ra:

    1. Đăng nhập lần đầu: Khi người dùng đăng nhập lần đầu tiên, hãy xuất bản dữ liệu để đảm bảo nhật ký xem của họ có sẵn ngay lập tức.
    2. Tạo hoặc chuyển đổi hồ sơ (Ứng dụng có nhiều hồ sơ): Nếu ứng dụng của bạn hỗ trợ nhiều hồ sơ, hãy xuất bản dữ liệu khi người dùng tạo hoặc chuyển đổi hồ sơ.
    3. Gián đoạn quá trình phát video: Để giúp người dùng tiếp tục xem từ đoạn video mà họ đã dừng lại, hãy xuất bản dữ liệu khi họ tạm dừng hoặc dừng video, hoặc khi ứng dụng thoát trong quá trình phát.
    4. Cập nhật khay Tiếp tục xem (Nếu được hỗ trợ): Khi người dùng xoá một mục khỏi khay Tiếp tục xem, hãy phản ánh thay đổi đó bằng cách xuất bản dữ liệu đã cập nhật.
    5. Số lượt xem hết video:
      1. Đối với phim, hãy xoá bộ phim đã xem xong khỏi khay Tiếp tục xem. Nếu bộ phim đó thuộc một loạt phim, hãy thêm bộ phim tiếp theo để giữ chân người dùng.
      2. Đối với các tập, hãy xoá tập đã xem xong và thêm tập tiếp theo trong loạt chương trình (nếu có) để khuyến khích người dùng tiếp tục xem.

Mã mẫu

Ứng dụng mẫu này minh hoạ cách nhà phát triển có thể tích hợp với các API khám phá video để gửi dữ liệu người dùng được cá nhân hoá đến Google. Ứng dụng mẫu này cũng minh hoạ cách tạo một mô-đun chung có thể được nhập vào cả ứng dụng di động và ứng dụng truyền hình, thời điểm gọi các API xuất bản và xoá, cũng như cách sử dụng Worker để gọi các API xuất bản và xoá.

Tích hợp

AccountProfile

Để cho phép trải nghiệm "xem tiếp" phù hợp trên Google TV, hãy cung cấp thông tin tài khoản và hồ sơ. Sử dụng AccountProfile để cung cấp:

  1. Mã tài khoản: Giá trị nhận dạng riêng biệt đại diện cho tài khoản của người dùng trong ứng dụng của bạn. Đây có thể là mã tài khoản thực tế hoặc một phiên bản được làm rối mã nguồn một cách thích hợp.

  2. Mã nhận dạng hồ sơ (không bắt buộc): Nếu ứng dụng của bạn hỗ trợ nhiều hồ sơ trong một tài khoản, hãy cung cấp giá trị nhận dạng duy nhất cho hồ sơ người dùng cụ thể (một lần nữa, là giá trị thực hoặc giá trị bị làm rối).

// If your app only supports account
val accountProfile = AccountProfile.Builder()
    .setAccountId("your_users_account_id")
    .build()

// If your app supports both account and profile
val accountProfile = AccountProfile.Builder()
    .setAccountId("your_users_account_id")
    .setProfileId("your_users_profile_id")
    .build()

Tạo thực thể

SDK đã xác định các thực thể khác nhau để đại diện cho từng loại mục. Cụm tiếp tục hỗ trợ các thực thể sau:

  1. MovieEntity
  2. TvEpisodeEntity
  3. LiveStreamingVideoEntity
  4. VideoClipEntity

Chỉ định URI và hình ảnh áp phích dành riêng cho nền tảng cho các thực thể này.

Ngoài ra, hãy tạo URI phát cho từng nền tảng (chẳng hạn như Android TV, Android hoặc iOS) nếu bạn chưa tạo. Vì vậy, khi người dùng tiếp tục xem trên mỗi nền tảng, ứng dụng sẽ sử dụng một URI phát được nhắm đến để phát nội dung video.

// Required. Set this when you want continue watching entities to show up on
// Google TV
val playbackUriTv = PlatformSpecificUri.Builder()
    .setPlatformType(PlatformType.TYPE_ANDROID_TV)
    .setActionUri(Uri.parse("https://www.example.com/entity_uri_for_tv"))
    .build()

// Required. Set this when you want continue watching entities to show up on
// Google TV Android app, Entertainment Space, Playstore Widget
val playbackUriAndroid = PlatformSpecificUri.Builder()
    .setPlatformType(PlatformType.TYPE_ANDROID_MOBILE)
    .setActionUri(Uri.parse("https://www.example.com/entity_uri_for_android"))
    .build()

// Optional. Set this when you want continue watching entities to show up on
// Google TV iOS app
val playbackUriIos = PlatformSpecificUri.Builder()
    .setPlatformType(PlatformType.TYPE_IOS)
    .setActionUri(Uri.parse("https://www.example.com/entity_uri_for_ios"))
    .build()

val platformSpecificPlaybackUris =
    Arrays.asList(playbackUriTv, playbackUriAndroid, playbackUriIos)

Hình ảnh áp phích cần có URI và kích thước pixel (chiều cao và chiều rộng). Nhắm đến nhiều kiểu dáng bằng cách cung cấp nhiều hình ảnh áp phích, nhưng hãy xác minh rằng tất cả hình ảnh đều duy trì tỷ lệ khung hình 16:9 và chiều cao tối thiểu là 200 pixel để hiển thị chính xác thực thể "Xem tiếp", đặc biệt là trong Không gian giải trí của Google. Hình ảnh có chiều cao dưới 200 pixel có thể không xuất hiện.

val images = Arrays.asList(
    Image.Builder()
        .setImageUri(Uri.parse("http://www.example.com/entity_image1.png"))
        .setImageHeightInPixel(300)
        .setImageWidthInPixel(169)
        .build(),
    Image.Builder()
        .setImageUri(Uri.parse("http://www.example.com/entity_image2.png"))
        .setImageHeightInPixel(640)
        .setImageWidthInPixel(360)
        .build()
    // Consider adding other images for different form factors
)
MovieEntity

Ví dụ này cho thấy cách tạo MovieEntity với tất cả các trường bắt buộc:

val movieEntity = MovieEntity.Builder()
   .setWatchNextType(WatchNextType.TYPE_CONTINUE)
   .setName("Movie name")
   .addPlatformSpecificPlaybackUri(platformSpecificPlaybackUris)
   .addPosterImages(images)
   // Timestamp in millis for sample last engagement time 12/1/2023 00:00:00
   .setLastEngagementTimeMillis(1701388800000)
   // Suppose the duration is 2 hours, it is 72000000 in milliseconds
   .setDurationMills(72000000)
   // Suppose last playback offset is 1 hour, 36000000 in milliseconds
   .setLastPlayBackPositionTimeMillis(36000000)
   .build()

Khi bạn cung cấp các thông tin như thể loại và mức phân loại nội dung, Google TV có thể giới thiệu nội dung của bạn theo nhiều cách linh hoạt hơn và kết nối nội dung đó với đúng người xem.

val genres = Arrays.asList("Action", "Science fiction")
val rating1 = RatingSystem.Builder().setAgencyName("MPAA").setRating("PG-13").build()
val contentRatings = Arrays.asList(rating1)
val movieEntity = MovieEntity.Builder()
    ...
    .addGenres(genres)
    .addContentRatings(contentRatings)
    .build()

Các thực thể sẽ tự động vẫn có sẵn trong 60 ngày, trừ phi bạn chỉ định thời gian hết hạn ngắn hơn. Chỉ đặt thời gian hết hạn tuỳ chỉnh nếu bạn cần xoá thực thể trước khoảng thời gian mặc định này.

// Set the expiration time to be now plus 30 days in milliseconds
val expirationTime = DisplayTimeWindow.Builder()
    .setEndTimestampMillis(now().toMillis()+2592000000).build()
val movieEntity = MovieEntity.Builder()
    ...
    .addAvailabilityTimeWindow(expirationTime)
    .build()
TvEpisodeEntity

Ví dụ này cho thấy cách tạo TvEpisodeEntity với tất cả các trường bắt buộc:

val tvEpisodeEntity = TvEpisodeEntity.Builder()
    .setWatchNextType(WatchNextType.TYPE_CONTINUE)
    .setName("Episode name")
    .addPlatformSpecificPlaybackUri(platformSpecificPlaybackUris)
    .addPosterImages(images)
    // Timestamp in millis for sample last engagement time 12/1/2023 00:00:00
    .setLastEngagementTimeMillis(1701388800000)
    .setDurationMills(72000000) // 2 hours in milliseconds
    // 45 minutes and 15 seconds in milliseconds is 2715000
    .setLastPlayBackPositionTimeMillis(2715000)
    .setEpisodeNumber("2")
    .setSeasonNumber("1")
    .setShowTitle("Title of the show")
    .build()

Chuỗi số tập (chẳng hạn như "2") và chuỗi số phần (chẳng hạn như "1") sẽ được mở rộng thành dạng thức phù hợp trước khi xuất hiện trên thẻ tiếp tục xem. Xin lưu ý rằng đây phải là một chuỗi số, đừng đặt "e2", "tập 2", "s1" hoặc "mùa 1".

Nếu một chương trình truyền hình cụ thể chỉ có một phần, hãy đặt số phần là 1.

Để tối đa hoá cơ hội cho người xem tìm thấy nội dung của bạn trên Google TV, hãy cân nhắc cung cấp thêm dữ liệu như thể loại, mức phân loại nội dung và khung giờ có sẵn, vì những thông tin này có thể cải thiện các lựa chọn hiển thị và lọc.

val genres = Arrays.asList("Action", "Science fiction")
val rating1 = RatingSystem.Builder().setAgencyName("MPAA").setRating("PG-13").build()
val contentRatings = Arrays.asList(rating1)
val tvEpisodeEntity = TvEpisodeEntity.Builder()
    ...
    .addGenres(genres)
    .addContentRatings(contentRatings)
    .setSeasonTitle("Season Title")
    .setShowTitle("Show Title")
    .build()
VideoClipEntity

Sau đây là ví dụ về cách tạo VideoClipEntity với tất cả các trường bắt buộc.

VideoClipEntity đại diện cho một đoạn video do người dùng tạo, chẳng hạn như video trên YouTube.

val videoClipEntity = VideoClipEntity.Builder()
    .setPlaybackUri(Uri.parse("https://www.example.com/uri_for_current_platform")
    .setWatchNextType(WatchNextType.TYPE_CONTINUE)
    .setName("Video clip name")
    .addPlatformSpecificPlaybackUri(platformSpecificPlaybackUris)
    .addPosterImages(images)
    // Timestamp in millis for sample last engagement time 12/1/2023 00:00:00
    .setLastEngagementTimeMillis(1701388800000)
    .setDurationMills(600000) //10 minutes in milliseconds
    .setLastPlayBackPositionTimeMillis(300000) //5 minutes in milliseconds
    .addContentRating(contentRating)
    .build()

Bạn có thể tuỳ ý đặt người tạo, hình ảnh người tạo, thời gian tạo tính bằng mili giây hoặc khoảng thời gian có sẵn .

LiveStreamingVideoEntity

Sau đây là ví dụ về cách tạo một LiveStreamingVideoEntity với tất cả các trường bắt buộc.

val liveStreamingVideoEntity = LiveStreamingVideoEntity.Builder()
    .setPlaybackUri(Uri.parse("https://www.example.com/uri_for_current_platform")
    .setWatchNextType(WatchNextType.TYPE_CONTINUE)
    .setName("Live streaming name")
    .addPlatformSpecificPlaybackUri(platformSpecificPlaybackUris)
    .addPosterImages(images)
    // Timestamp in millis for sample last engagement time 12/1/2023 00:00:00
    .setLastEngagementTimeMillis(1701388800000)
    .setDurationMills(72000000) //2 hours in milliseconds
    .setLastPlayBackPositionTimeMillis(36000000) //1 hour in milliseconds
    .addContentRating(contentRating)
    .build()

Bạn có thể tuỳ ý đặt thời gian bắt đầu, đài truyền hình, biểu tượng đài truyền hình hoặc khung thời gian có sẵn cho thực thể phát trực tiếp.

Để biết thông tin chi tiết về các thuộc tính và yêu cầu, hãy xem tài liệu tham khảo về API.

Cung cấp dữ liệu cụm Tiếp tục

AppEngagePublishClient chịu trách nhiệm xuất bản cụm Tiếp tục. Bạn sử dụng phương thức publishContinuationCluster() để xuất bản một đối tượng ContinuationCluster.

Trước tiên, bạn nên dùng isServiceAvailable() để kiểm tra xem dịch vụ có thể tích hợp hay không.

client.publishContinuationCluster(
    PublishContinuationClusterRequest
        .Builder()
        .setContinuationCluster(
            ContinuationCluster.Builder()
                .setAccountProfile(accountProfile)
                .addEntity(movieEntity1)
                .addEntity(movieEntity2)
                .addEntity(tvEpisodeEntity1)
                .addEntity(tvEpisodeEntity2)
                .setSyncAcrossDevices(true)
                .build()
        )
        .build()
)

Khi dịch vụ nhận được yêu cầu, các hành động sau đây sẽ diễn ra trong một giao dịch:

  • Dữ liệu ContinuationCluster hiện có của đối tác nhà phát triển sẽ bị xoá.
  • Dữ liệu của yêu cầu được phân tích cú pháp và lưu trữ trong ContinuationCluster đã cập nhật.

Trong trường hợp xảy ra lỗi, toàn bộ yêu cầu sẽ bị từ chối và trạng thái hiện tại sẽ được duy trì.

API xuất bản là các API chèn và cập nhật; sẽ thay thế nội dung hiện tại. Nếu cần cập nhật một thực thể cụ thể trong ContinuationCluster, bạn sẽ cần xuất bản lại tất cả các thực thể.

Bạn chỉ nên cung cấp dữ liệu ContinuationCluster cho tài khoản người lớn. Chỉ xuất bản khi AccountProfile thuộc về người lớn.

Đồng bộ hoá trên nhiều thiết bị

Cờ SyncAcrossDevices kiểm soát việc dữ liệu ContinuationCluster của người dùng có được đồng bộ hoá trên các thiết bị như TV, điện thoại, máy tính bảng, v.v. hay không. Theo mặc định, tính năng đồng bộ hoá trên nhiều thiết bị sẽ bị tắt.

Giá trị:

  • true: Dữ liệu ContinuationCluster được chia sẻ trên tất cả các thiết bị của người dùng để mang đến trải nghiệm xem liền mạch. Bạn nên dùng lựa chọn này để có trải nghiệm tốt nhất trên nhiều thiết bị.
  • false: Dữ liệu ContinuationCluster chỉ được dùng trên thiết bị hiện tại.

Ứng dụng đa phương tiện phải cung cấp một chế độ cài đặt rõ ràng để bật/tắt tính năng đồng bộ hoá trên nhiều thiết bị. Giải thích lợi ích cho người dùng, lưu trữ lựa chọn ưu tiên của người dùng một lần và áp dụng lựa chọn đó trong publishContinuationCluster cho phù hợp.

// Example to allow cross device syncing.
client.publishContinuationCluster(
    PublishContinuationClusterRequest
        .Builder()
        .setContinuationCluster(
            ContinuationCluster.Builder()
                .setAccountProfile(accountProfile)
                .setSyncAcrossDevices(true)
                .build()
        )
        .build()
)

Để khai thác tối đa tính năng trên nhiều thiết bị, hãy xác minh rằng ứng dụng có được sự đồng ý của người dùng và bật SyncAcrossDevices thành true. Nhờ đó, nội dung có thể đồng bộ hoá liền mạch trên các thiết bị, mang lại trải nghiệm tốt hơn cho người dùng và tăng mức độ tương tác. Ví dụ: một đối tác đã triển khai tính năng này nhận thấy số lượt nhấp vào nút "xem tiếp" tăng 40% vì nội dung của họ xuất hiện trên nhiều thiết bị.

Xoá dữ liệu Khám phá video

Để xoá dữ liệu của người dùng khỏi máy chủ Google TV theo cách thủ công trước thời hạn lưu giữ tiêu chuẩn là 60 ngày, hãy sử dụng phương thức client.deleteClusters(). Khi nhận được yêu cầu, dịch vụ sẽ xoá tất cả dữ liệu hiện có về hoạt động khám phá video cho hồ sơ tài khoản hoặc cho toàn bộ tài khoản.

Liệt kê DeleteReason xác định lý do xoá dữ liệu. Đoạn mã sau đây sẽ xoá dữ liệu xem tiếp khi người dùng đăng xuất.


// If the user logs out from your media app, you must make the following call
// to remove continue watching data from the current google TV device,
// otherwise, the continue watching data will persist on the current
// google TV device until 60 days later.
client.deleteClusters(
    DeleteClustersRequest.Builder()
        .setAccountProfile(AccountProfile())
        .setReason(DeleteReason.DELETE_REASON_USER_LOG_OUT)
        .setSyncAcrossDevices(true)
        .build()
)

Thử nghiệm

Sử dụng ứng dụng xác minh để xác minh rằng quá trình tích hợp Engage SDK đang hoạt động chính xác. Ứng dụng xác minh cung cấp các công cụ giúp bạn xác minh dữ liệu và xác nhận rằng các ý định truyền tin đang được xử lý đúng cách.

Sau khi bạn gọi API xuất bản, hãy xác nhận rằng dữ liệu của bạn đang được xuất bản chính xác bằng cách kiểm tra ứng dụng xác minh. Cụm tiếp tục của bạn sẽ xuất hiện dưới dạng một hàng riêng biệt trong giao diện của ứng dụng.

  • Chỉ đặt Cờ dịch vụ tương tác cho các bản dựng không phải bản phát hành trong tệp kê khai Android của ứng dụng.
  • Cài đặt và mở ứng dụng Engage Verify
  • Nếu isServiceAvailablefalse, hãy nhấp vào nút "Bật/tắt" để bật.
  • Nhập tên gói của ứng dụng để tự động xem dữ liệu đã xuất bản sau khi bạn bắt đầu xuất bản.
  • Kiểm thử các thao tác sau trong ứng dụng của bạn:
    • Đăng nhập.
    • Chuyển đổi giữa các hồ sơ(nếu có).
    • Bắt đầu, sau đó tạm dừng video hoặc quay lại trang chủ.
    • Đóng ứng dụng trong khi video đang phát.
    • Xoá một mục khỏi hàng "Xem tiếp" (nếu được hỗ trợ).
  • Sau mỗi thao tác, hãy xác nhận rằng ứng dụng của bạn đã gọi API publishContinuationClusters và dữ liệu được hiển thị chính xác trong ứng dụng xác minh.
  • Ứng dụng xác minh sẽ hiển thị dấu kiểm "Ổn cả" màu xanh lục cho các thực thể được triển khai đúng cách.

    Ảnh chụp màn hình ứng dụng xác minh thành công
    Hình 1. Ứng dụng xác minh thành công
  • Ứng dụng xác minh sẽ gắn cờ mọi thực thể có vấn đề.

    Ảnh chụp màn hình lỗi ứng dụng xác minh
    Hình 2. Lỗi ứng dụng xác minh
  • Để khắc phục các thực thể có lỗi, hãy dùng điều khiển từ xa của TV để chọn và nhấp vào thực thể trong ứng dụng xác minh. Các vấn đề cụ thể sẽ xuất hiện và được đánh dấu bằng màu đỏ để bạn xem xét (xem ví dụ bên dưới).

    Thông tin chi tiết về lỗi của Ứng dụng xác minh
    Hình 3. Thông tin chi tiết về lỗi ứng dụng xác minh

API REST

Engage SDK cung cấp một REST API để mang đến trải nghiệm xem tiếp nhất quán trên các nền tảng không phải Android, chẳng hạn như iOS, Roku TV. API này cho phép nhà phát triển cập nhật trạng thái "Xem tiếp" cho những người dùng đã chọn sử dụng tính năng này trên các nền tảng không phải Android.

Điều kiện tiên quyết

  • Trước tiên, bạn phải hoàn tất quy trình tích hợp dựa trên Engage SDK trên thiết bị. Bước quan trọng này thiết lập mối liên kết cần thiết giữa mã nhận dạng người dùng của Google và AccountProfile của ứng dụng.
  • Quyền truy cập và xác thực API: Để xem và bật API trong Dự án Google Cloud, bạn phải trải qua quy trình đưa vào danh sách cho phép. Tất cả các yêu cầu API đều yêu cầu xác thực.

Có được quyền truy cập

Để có quyền truy cập vào API và bật API trong Google Cloud Console, bạn cần đăng ký tài khoản.

  1. Bạn phải có mã khách hàng Google Workspace. Nếu không có sẵn, bạn có thể cần thiết lập Google Workspace cũng như mọi Tài khoản Google mà bạn muốn dùng để gọi API.
  2. Thiết lập tài khoản bằng Google Cloud Console bằng cách sử dụng email được liên kết với Google Workspace.
  3. Tạo dự án mới
  4. Tạo một tài khoản dịch vụ để xác thực API. Sau khi tạo tài khoản dịch vụ, bạn sẽ có 2 mục sau:
    • Mã tài khoản dịch vụ.
    • Một tệp JSON chứa khoá tài khoản dịch vụ của bạn. Hãy bảo mật tệp này, bạn sẽ cần tệp này để xác thực ứng dụng sau này.
  5. Giờ đây, Workspace và các Tài khoản Google liên kết có thể sử dụng API REST. Sau khi thay đổi được truyền tải, bạn sẽ nhận được thông báo về việc API đã sẵn sàng để được tài khoản dịch vụ của bạn gọi hay chưa.
  6. Hãy làm theo các bước này để chuẩn bị thực hiện một lệnh gọi API được uỷ quyền.

Xuất bản Cụm Tiếp tục

Để xuất bản Dữ liệu khám phá video, hãy thực hiện yêu cầu POST đến API publishContinuationCluster bằng cú pháp sau.

https://tvvideodiscovery.googleapis.com/v1/packages/{package_name}/accounts/{account_id}/profiles/{profile_id}/publishContinuationCluster

Trong trường hợp:

  • package_name: Tên gói của nhà cung cấp nội dung nghe nhìn
  • accountId: Mã nhận dạng duy nhất cho tài khoản của người dùng trong hệ thống của bạn. Khoá này phải khớp với accountId được dùng trong đường dẫn trên thiết bị.
  • profileId: Mã nhận dạng duy nhất cho hồ sơ người dùng trong tài khoản trong hệ thống của bạn. Mã này phải khớp với profileId được dùng trong đường dẫn trên thiết bị.

URL của tài khoản không có hồ sơ là:

https://tvvideodiscovery.googleapis.com/v1/packages/{package_name}/accounts/{account_id}/publishContinuationCluster

Tải trọng cho yêu cầu được biểu thị trong trường entities. entities đại diện cho danh sách các thực thể nội dung có thể là MovieEntity hoặc TVEpisodeEntity. Đây là trường bắt buộc.

Nội dung yêu cầu

Trường

Loại

Bắt buộc

Nội dung mô tả

thực thể

Danh sách các đối tượng MediaEntity

Danh sách các thực thể nội dung (tối đa 5), chỉ 5 thực thể hàng đầu sẽ được giữ lại và những thực thể còn lại sẽ bị loại bỏ.Danh sách trống được phép cho biết người dùng đã xem xong tất cả các thực thể.

Trường entities chứa movieEntitytvEpisodeEntity riêng lẻ.

Trường

Loại

Bắt buộc

Nội dung mô tả

movieEntity

MovieEntity

Một đối tượng đại diện cho một bộ phim trong ContinuationCluster.

tvEpisodeEntity

TvEpisodeEntity

Một đối tượng đại diện cho một tập của chương trình truyền hình trong ContinuationCluster.

Mỗi đối tượng trong mảng thực thể phải là một trong các loại MediaEntity có sẵn, cụ thể là MovieEntityTvEpisodeEntity, cùng với các trường chung và theo loại.

Đoạn mã sau đây minh hoạ tải trọng của phần nội dung yêu cầu cho API publishContinuationCluster.

{
  "entities": [
    {
      "movieEntity": {
        "watch_next_type": "WATCH_NEXT_TYPE_CONTINUE",
        "name": "Movie1",
        "platform_specific_playback_uris": [
          "https://www.example.com/entity_uri_for_android",
          "https://www.example.com/entity_uri_for_iOS"
        ],
        "poster_images": [
          "http://www.example.com/movie1_img1.png",
          "http://www.example.com/movie1_imag2.png"
        ],
        "last_engagement_time_millis": 864600000,
        "duration_millis": 5400000,
        "last_play_back_position_time_millis": 3241111
      }
    },
    {
      "tvEpisodeEntity": {
        "watch_next_type": "WATCH_NEXT_TYPE_CONTINUE",
        "name": "TV SERIES EPISODE 1",
        "platform_specific_playback_uris": [
          "https://www.example.com/entity_uri_for_android",
          "https://www.example.com/entity_uri_for_iOS"
        ],
        "poster_images": [
          "http://www.example.com/episode1_img1.png",
          "http://www.example.com/episode1_imag2.png"
        ],
        "last_engagement_time_millis": 864600000,
        "duration_millis": 1800000,
        "last_play_back_position_time_millis": 2141231,
        "episode_display_number": "1",
        "season_number": "1",
        "show_title": "title"
      }
    }
  ]
}

Xoá dữ liệu khám phá video

Dùng API clearClusters để xoá dữ liệu khám phá video.

Sử dụng URL POST để xoá các thực thể khỏi dữ liệu khám phá video. Để xoá dữ liệu cụm tiếp tục, hãy thực hiện yêu cầu POST đến API clearClusters bằng cú pháp sau.

https://tvvideodiscovery.googleapis.com/v1/packages/{package_name}/accounts/{account_id}/profiles/{profile_id}/clearClusters

Trong trường hợp:

  • package_name: Tên gói của nhà cung cấp nội dung nghe nhìn.
  • accountId: Mã nhận dạng duy nhất cho tài khoản của người dùng trong hệ thống của bạn. Khoá này phải khớp với accountId được dùng trong đường dẫn trên thiết bị.
  • profileId: Mã nhận dạng duy nhất cho hồ sơ người dùng trong tài khoản trong hệ thống của bạn. Mã này phải khớp với profileId được dùng trong đường dẫn trên thiết bị.

Tải trọng cho API clearClusters chỉ chứa một trường reason, trong đó có một DeleteReason chỉ định lý do xoá dữ liệu.

{
  "reason": "DELETE_REASON_LOSS_OF_CONSENT"
}

Thử nghiệm

Sau khi đăng dữ liệu thành công, hãy dùng tài khoản kiểm thử người dùng để xác minh rằng nội dung dự kiến xuất hiện trong hàng "Xem tiếp" trên các nền tảng mục tiêu của Google, chẳng hạn như Google TV và ứng dụng di động Google TV trên Android và iOS.

Trong quá trình kiểm thử, hãy cho phép độ trễ truyền dữ liệu hợp lý trong vài phút và tuân thủ các yêu cầu về việc xem, chẳng hạn như xem một phần của phim hoặc xem xong một tập. Hãy tham khảo Nguyên tắc về danh sách Xem tiếp dành cho nhà phát triển ứng dụng để biết thông tin chi tiết.

Tải xuống

Trước khi tải xuống, bạn phải đồng ý với các điều khoản và điều kiện sau.

Ðiều khoản và điều kiện

This is the Android Software Development Kit License Agreement

1. Introduction

1.1 The Android Software Development Kit (referred to in the License Agreement as the "SDK" and specifically including the Android system files, packaged APIs, and Google APIs add-ons) is licensed to you subject to the terms of the License Agreement. The License Agreement forms a legally binding contract between you and Google in relation to your use of the SDK. 1.2 "Android" means the Android software stack for devices, as made available under the Android Open Source Project, which is located at the following URL: https://source.android.com/, as updated from time to time. 1.3 A "compatible implementation" means any Android device that (i) complies with the Android Compatibility Definition document, which can be found at the Android compatibility website (https://source.android.com/compatibility) and which may be updated from time to time; and (ii) successfully passes the Android Compatibility Test Suite (CTS). 1.4 "Google" means Google LLC, organized under the laws of the State of Delaware, USA, and operating under the laws of the USA with principal place of business at 1600 Amphitheatre Parkway, Mountain View, CA 94043, USA.

2. Accepting this License Agreement

2.1 In order to use the SDK, you must first agree to the License Agreement. You may not use the SDK if you do not accept the License Agreement. 2.2 By clicking to accept and/or using this SDK, you hereby agree to the terms of the License Agreement. 2.3 You may not use the SDK and may not accept the License Agreement if you are a person barred from receiving the SDK under the laws of the United States or other countries, including the country in which you are resident or from which you use the SDK. 2.4 If you are agreeing to be bound by the License Agreement on behalf of your employer or other entity, you represent and warrant that you have full legal authority to bind your employer or such entity to the License Agreement. If you do not have the requisite authority, you may not accept the License Agreement or use the SDK on behalf of your employer or other entity.

3. SDK License from Google

3.1 Subject to the terms of the License Agreement, Google grants you a limited, worldwide, royalty-free, non-assignable, non-exclusive, and non-sublicensable license to use the SDK solely to develop applications for compatible implementations of Android. 3.2 You may not use this SDK to develop applications for other platforms (including non-compatible implementations of Android) or to develop another SDK. You are of course free to develop applications for other platforms, including non-compatible implementations of Android, provided that this SDK is not used for that purpose. 3.3 You agree that Google or third parties own all legal right, title and interest in and to the SDK, including any Intellectual Property Rights that subsist in the SDK. "Intellectual Property Rights" means any and all rights under patent law, copyright law, trade secret law, trademark law, and any and all other proprietary rights. Google reserves all rights not expressly granted to you. 3.4 You may not use the SDK for any purpose not expressly permitted by the License Agreement. Except to the extent required by applicable third party licenses, you may not copy (except for backup purposes), modify, adapt, redistribute, decompile, reverse engineer, disassemble, or create derivative works of the SDK or any part of the SDK. 3.5 Use, reproduction and distribution of components of the SDK licensed under an open source software license are governed solely by the terms of that open source software license and not the License Agreement. 3.6 You agree that the form and nature of the SDK that Google provides may change without prior notice to you and that future versions of the SDK may be incompatible with applications developed on previous versions of the SDK. You agree that Google may stop (permanently or temporarily) providing the SDK (or any features within the SDK) to you or to users generally at Google's sole discretion, without prior notice to you. 3.7 Nothing in the License Agreement gives you a right to use any of Google's trade names, trademarks, service marks, logos, domain names, or other distinctive brand features. 3.8 You agree that you will not remove, obscure, or alter any proprietary rights notices (including copyright and trademark notices) that may be affixed to or contained within the SDK.

4. Use of the SDK by You

4.1 Google agrees that it obtains no right, title or interest from you (or your licensors) under the License Agreement in or to any software applications that you develop using the SDK, including any intellectual property rights that subsist in those applications. 4.2 You agree to use the SDK and write applications only for purposes that are permitted by (a) the License Agreement and (b) any applicable law, regulation or generally accepted practices or guidelines in the relevant jurisdictions (including any laws regarding the export of data or software to and from the United States or other relevant countries). 4.3 You agree that if you use the SDK to develop applications for general public users, you will protect the privacy and legal rights of those users. If the users provide you with user names, passwords, or other login information or personal information, you must make the users aware that the information will be available to your application, and you must provide legally adequate privacy notice and protection for those users. If your application stores personal or sensitive information provided by users, it must do so securely. If the user provides your application with Google Account information, your application may only use that information to access the user's Google Account when, and for the limited purposes for which, the user has given you permission to do so. 4.4 You agree that you will not engage in any activity with the SDK, including the development or distribution of an application, that interferes with, disrupts, damages, or accesses in an unauthorized manner the servers, networks, or other properties or services of any third party including, but not limited to, Google or any mobile communications carrier. 4.5 You agree that you are solely responsible for (and that Google has no responsibility to you or to any third party for) any data, content, or resources that you create, transmit or display through Android and/or applications for Android, and for the consequences of your actions (including any loss or damage which Google may suffer) by doing so. 4.6 You agree that you are solely responsible for (and that Google has no responsibility to you or to any third party for) any breach of your obligations under the License Agreement, any applicable third party contract or Terms of Service, or any applicable law or regulation, and for the consequences (including any loss or damage which Google or any third party may suffer) of any such breach.

5. Your Developer Credentials

5.1 You agree that you are responsible for maintaining the confidentiality of any developer credentials that may be issued to you by Google or which you may choose yourself and that you will be solely responsible for all applications that are developed under your developer credentials.

6. Privacy and Information

6.1 In order to continually innovate and improve the SDK, Google may collect certain usage statistics from the software including but not limited to a unique identifier, associated IP address, version number of the software, and information on which tools and/or services in the SDK are being used and how they are being used. Before any of this information is collected, the SDK will notify you and seek your consent. If you withhold consent, the information will not be collected. 6.2 The data collected is examined in the aggregate to improve the SDK and is maintained in accordance with Google's Privacy Policy, which is located at the following URL: https://policies.google.com/privacy 6.3 Anonymized and aggregated sets of the data may be shared with Google partners to improve the SDK.

7. Third Party Applications

7.1 If you use the SDK to run applications developed by a third party or that access data, content or resources provided by a third party, you agree that Google is not responsible for those applications, data, content, or resources. You understand that all data, content or resources which you may access through such third party applications are the sole responsibility of the person from which they originated and that Google is not liable for any loss or damage that you may experience as a result of the use or access of any of those third party applications, data, content, or resources. 7.2 You should be aware the data, content, and resources presented to you through such a third party application may be protected by intellectual property rights which are owned by the providers (or by other persons or companies on their behalf). You may not modify, rent, lease, loan, sell, distribute or create derivative works based on these data, content, or resources (either in whole or in part) unless you have been specifically given permission to do so by the relevant owners. 7.3 You acknowledge that your use of such third party applications, data, content, or resources may be subject to separate terms between you and the relevant third party. In that case, the License Agreement does not affect your legal relationship with these third parties.

8. Using Android APIs

8.1 Google Data APIs 8.1.1 If you use any API to retrieve data from Google, you acknowledge that the data may be protected by intellectual property rights which are owned by Google or those parties that provide the data (or by other persons or companies on their behalf). Your use of any such API may be subject to additional Terms of Service. You may not modify, rent, lease, loan, sell, distribute or create derivative works based on this data (either in whole or in part) unless allowed by the relevant Terms of Service. 8.1.2 If you use any API to retrieve a user's data from Google, you acknowledge and agree that you shall retrieve data only with the user's explicit consent and only when, and for the limited purposes for which, the user has given you permission to do so. If you use the Android Recognition Service API, documented at the following URL: https://developer.android.com/reference/android/speech/RecognitionService, as updated from time to time, you acknowledge that the use of the API is subject to the Data Processing Addendum for Products where Google is a Data Processor, which is located at the following URL: https://privacy.google.com/businesses/gdprprocessorterms/, as updated from time to time. By clicking to accept, you hereby agree to the terms of the Data Processing Addendum for Products where Google is a Data Processor.

9. Terminating this License Agreement

9.1 The License Agreement will continue to apply until terminated by either you or Google as set out below. 9.2 If you want to terminate the License Agreement, you may do so by ceasing your use of the SDK and any relevant developer credentials. 9.3 Google may at any time, terminate the License Agreement with you if: (A) you have breached any provision of the License Agreement; or (B) Google is required to do so by law; or (C) the partner with whom Google offered certain parts of SDK (such as APIs) to you has terminated its relationship with Google or ceased to offer certain parts of the SDK to you; or (D) Google decides to no longer provide the SDK or certain parts of the SDK to users in the country in which you are resident or from which you use the service, or the provision of the SDK or certain SDK services to you by Google is, in Google's sole discretion, no longer commercially viable. 9.4 When the License Agreement comes to an end, all of the legal rights, obligations and liabilities that you and Google have benefited from, been subject to (or which have accrued over time whilst the License Agreement has been in force) or which are expressed to continue indefinitely, shall be unaffected by this cessation, and the provisions of paragraph 14.7 shall continue to apply to such rights, obligations and liabilities indefinitely.

10. DISCLAIMER OF WARRANTIES

10.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOUR USE OF THE SDK IS AT YOUR SOLE RISK AND THAT THE SDK IS PROVIDED "AS IS" AND "AS AVAILABLE" WITHOUT WARRANTY OF ANY KIND FROM GOOGLE. 10.2 YOUR USE OF THE SDK AND ANY MATERIAL DOWNLOADED OR OTHERWISE OBTAINED THROUGH THE USE OF THE SDK IS AT YOUR OWN DISCRETION AND RISK AND YOU ARE SOLELY RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR OTHER DEVICE OR LOSS OF DATA THAT RESULTS FROM SUCH USE. 10.3 GOOGLE FURTHER EXPRESSLY DISCLAIMS ALL WARRANTIES AND CONDITIONS OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.

11. LIMITATION OF LIABILITY

11.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT GOOGLE, ITS SUBSIDIARIES AND AFFILIATES, AND ITS LICENSORS SHALL NOT BE LIABLE TO YOU UNDER ANY THEORY OF LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES THAT MAY BE INCURRED BY YOU, INCLUDING ANY LOSS OF DATA, WHETHER OR NOT GOOGLE OR ITS REPRESENTATIVES HAVE BEEN ADVISED OF OR SHOULD HAVE BEEN AWARE OF THE POSSIBILITY OF ANY SUCH LOSSES ARISING.

12. Indemnification

12.1 To the maximum extent permitted by law, you agree to defend, indemnify and hold harmless Google, its affiliates and their respective directors, officers, employees and agents from and against any and all claims, actions, suits or proceedings, as well as any and all losses, liabilities, damages, costs and expenses (including reasonable attorneys fees) arising out of or accruing from (a) your use of the SDK, (b) any application you develop on the SDK that infringes any copyright, trademark, trade secret, trade dress, patent or other intellectual property right of any person or defames any person or violates their rights of publicity or privacy, and (c) any non-compliance by you with the License Agreement.

13. Changes to the License Agreement

13.1 Google may make changes to the License Agreement as it distributes new versions of the SDK. When these changes are made, Google will make a new version of the License Agreement available on the website where the SDK is made available. 14.1 The License Agreement constitutes the whole legal agreement between you and Google and governs your use of the SDK (excluding any services which Google may provide to you under a separate written agreement), and completely replaces any prior agreements between you and Google in relation to the SDK. 14.2 You agree that if Google does not exercise or enforce any legal right or remedy which is contained in the License Agreement (or which Google has the benefit of under any applicable law), this will not be taken to be a formal waiver of Google's rights and that those rights or remedies will still be available to Google. 14.3 If any court of law, having the jurisdiction to decide on this matter, rules that any provision of the License Agreement is invalid, then that provision will be removed from the License Agreement without affecting the rest of the License Agreement. The remaining provisions of the License Agreement will continue to be valid and enforceable. 14.4 You acknowledge and agree that each member of the group of companies of which Google is the parent shall be third party beneficiaries to the License Agreement and that such other companies shall be entitled to directly enforce, and rely upon, any provision of the License Agreement that confers a benefit on (or rights in favor of) them. Other than this, no other person or company shall be third party beneficiaries to the License Agreement. 14.5 EXPORT RESTRICTIONS. THE SDK IS SUBJECT TO UNITED STATES EXPORT LAWS AND REGULATIONS. YOU MUST COMPLY WITH ALL DOMESTIC AND INTERNATIONAL EXPORT LAWS AND REGULATIONS THAT APPLY TO THE SDK. THESE LAWS INCLUDE RESTRICTIONS ON DESTINATIONS, END USERS AND END USE. 14.6 The rights granted in the License Agreement may not be assigned or transferred by either you or Google without the prior written approval of the other party. Neither you nor Google shall be permitted to delegate their responsibilities or obligations under the License Agreement without the prior written approval of the other party. 14.7 The License Agreement, and your relationship with Google under the License Agreement, shall be governed by the laws of the State of California without regard to its conflict of laws provisions. You and Google agree to submit to the exclusive jurisdiction of the courts located within the county of Santa Clara, California to resolve any legal matter arising from the License Agreement. Notwithstanding this, you agree that Google shall still be allowed to apply for injunctive remedies (or an equivalent type of urgent legal relief) in any jurisdiction. July 27, 2021
Tải

verify_app_multiplatform_public_20250602.apk