คู่มือการผสานรวม Engage SDK สําหรับทีวี

ฟีเจอร์รับชมต่อจะใช้คลัสเตอร์ความต่อเนื่องเพื่อแสดงวิดีโอที่ดูค้างไว้ และตอนถัดไปที่ควรดูจากซีซันทีวีเดียวกัน จากแอปหลายแอปในการจัดกลุ่ม UI เดียว คุณสามารถแสดงเอนทิตีของแอปเหล่านี้ในคลัสเตอร์ความต่อเนื่องนี้ได้ โดยทำตามคำแนะนำนี้เพื่อดูวิธีเพิ่มการมีส่วนร่วมของผู้ใช้ผ่านประสบการณ์รับชมต่อโดยใช้ Engage SDK

สิ่งที่ต้องเตรียมก่อนดำเนินการ

ก่อนเริ่มต้น ให้ทำตามขั้นตอนต่อไปนี้

  1. อัปเดตเป็น API เป้าหมายระดับตั้งแต่ 19 ขึ้นไป

  2. เพิ่มไลบรารี com.google.android.engage ลงในแอป

    มี SDK แยกต่างหากให้ใช้ในการผสานรวม โดย SDK หนึ่งสำหรับแอปบนมือถือ และอีก SDK หนึ่งสำหรับแอป TV

    อุปกรณ์เคลื่อนที่

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

    ทีวี

    
      dependencies {
        implementation 'com.google.android.engage:engage-tv:1.0.2
      }
    
  3. ตั้งค่าสภาพแวดล้อมของบริการ Engage เป็นการใช้งานจริงในไฟล์ AndroidManifest.xml

    อุปกรณ์เคลื่อนที่

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

    ทีวี

    
    <meta-data
        android:name="com.google.android.engage.service.ENV"
        android:value="PRODUCTION" />
    
  4. เพิ่มสิทธิ์สำหรับ WRITE_EPG_DATA ให้แก่ APK ของทีวี

    <uses-permission android:name="com.android.providers.tv.permission.WRITE_EPG_DATA" />
    
  5. ยืนยันการเผยแพร่เนื้อหาที่เชื่อถือได้โดยใช้บริการที่ทำงานอยู่เบื้องหลัง เช่น androidx.work เพื่อกำหนดเวลา

  6. เผยแพร่ข้อมูลการรับชมต่อเมื่อเกิดเหตุการณ์ต่อไปนี้ เพื่อมอบประสบการณ์การรับชมที่ราบรื่น

    1. การเข้าสู่ระบบครั้งแรก: เมื่อผู้ใช้เข้าสู่ระบบเป็นครั้งแรก ให้เผยแพร่ข้อมูลเพื่อให้แน่ใจว่าประวัติการดูของผู้ใช้พร้อมใช้งานทันที
    2. การสร้างหรือการสลับโปรไฟล์ (แอปแบบหลายโปรไฟล์): หากแอปของคุณรองรับหลายโปรไฟล์ ให้เผยแพร่ข้อมูลเมื่อผู้ใช้สร้างหรือสลับโปรไฟล์
    3. การเล่นวิดีโอสะดุดลง: เผยแพร่ข้อมูลเมื่อผู้ใช้หยุดหรือหยุดวิดีโอชั่วคราว หรือเมื่อแอปปิดระหว่างการเล่น เพื่อช่วยให้ผู้ใช้เล่นต่อจากที่ค้างไว้ได้
    4. การอัปเดตถาดรับชมต่อ (หากรองรับ): เมื่อผู้ใช้นำรายการออกจากถาดรับชมต่อ ให้แสดงการเปลี่ยนแปลงนั้นด้วยการเผยแพร่ข้อมูลที่อัปเดตแล้ว
    5. การดูวิดีโอจนจบ:
      1. สำหรับภาพยนตร์ ให้นำภาพยนตร์ที่ดูจบแล้วออกจากถาดรับชมต่อ หากภาพยนตร์เป็นส่วนหนึ่งของซีรีส์ ให้เพิ่มภาพยนตร์เรื่องถัดไปเพื่อดึงดูดความสนใจของผู้ใช้
      2. สำหรับตอนต่างๆ ให้นำตอนที่ดูจบแล้วออกและเพิ่มตอนถัดไปในซีรีส์ (หากมี) เพื่อกระตุ้นให้ดูต่อ

โค้ดตัวอย่าง

แอปตัวอย่างนี้แสดงวิธีที่นักพัฒนาแอปสามารถผสานรวมกับ API การค้นพบวิดีโอเพื่อส่งข้อมูลผู้ใช้ที่ปรับตามโปรไฟล์ไปยัง Google แอปตัวอย่างยังแสดงวิธีสร้างโมดูลทั่วไปที่นำเข้าได้ทั้งในแอปมือถือและแอป TV, เวลาที่ควรเรียกใช้ API การเผยแพร่และการลบ รวมถึงวิธีใช้ Worker เพื่อเรียกใช้ API การเผยแพร่และการลบ

การผสานรวม

AccountProfile

หากต้องการอนุญาตให้ใช้ประสบการณ์ "รับชมต่อ" ที่ปรับตามโปรไฟล์ของผู้ใช้บน Google TV โปรดระบุข้อมูลบัญชีและโปรไฟล์ โดยให้ใช้ AccountProfile เพื่อระบุข้อมูลต่อไปนี้

  1. รหัสบัญชี: ตัวระบุที่ไม่ซ้ำกันซึ่งแสดงถึงบัญชีของผู้ใช้ภายในแอปพลิเคชันของคุณ ซึ่งอาจเป็นรหัสบัญชีจริงหรือเวอร์ชันที่ปรับให้ยากต่อการอ่าน (Obfuscate) อย่างเหมาะสมก็ได้

  2. รหัสโปรไฟล์ (ไม่บังคับ): หากแอปพลิเคชันรองรับหลายโปรไฟล์ภายในบัญชีเดียว ให้ระบุตัวระบุที่ไม่ซ้ำกันสำหรับโปรไฟล์ผู้ใช้ที่เฉพาะเจาะจง (จะใช้รหัสจริงหรือรหัสที่ปรับให้ยากต่อการอ่าน (Obfuscate) ก็ได้เช่นเดียวกัน)

// 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()

สร้างเอนทิตี

SDK ได้กำหนดเอนทิตีต่างๆ เพื่อแสดงรายการแต่ละประเภท คลัสเตอร์ความต่อเนื่องจะรองรับเอนทิตีต่อไปนี้

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

ระบุ URI และภาพโปสเตอร์เฉพาะแพลตฟอร์มสำหรับเอนทิตีเหล่านี้

นอกจากนี้หากยังไม่ได้สร้าง ก็ให้สร้าง URI การเล่นสําหรับแต่ละแพลตฟอร์ม เช่น Android TV, Android หรือ iOS เพื่อให้เมื่อผู้ใช้รับชมต่อในแต่ละแพลตฟอร์ม แอปจะได้ใช้ URI การเล่นที่กำหนดเป้าหมายในการเล่นเนื้อหาวิดีโอ

// 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)

ภาพโปสเตอร์ต้องมี URI และขนาดพิกเซล (ความสูงและความกว้าง) โปรดกำหนดเป้าหมายรูปแบบของอุปกรณ์หลายๆ แบบ โดยจัดให้มีภาพโปสเตอร์หลายภาพ และตรวจสอบว่าภาพทั้งหมดมีสัดส่วนการแสดงผล 16:9 และมีความสูงอย่างน้อย 200 พิกเซล เพื่อให้แสดงผลเอนทิตี "รับชมต่อ" ได้อย่างถูกต้องโดยเฉพาะภายใน Entertainment Space ของ Google ทั้งนี้ระบบอาจไม่แสดงรูปภาพที่มีความสูงน้อยกว่า 200 พิกเซล

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

ตัวอย่างนี้แสดงวิธีสร้าง MovieEntity โดยมีฟิลด์ที่ต้องระบุทั้งหมด

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()

การระบุรายละเอียด เช่น ประเภทและการจัดประเภทเนื้อหา จะช่วยให้ Google TV สามารถแสดงเนื้อหาของคุณในรูปแบบที่ไดนามิกมากขึ้นและเชื่อมต่อเนื้อหากับผู้ชมที่เหมาะสม

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()

เอนทิตีจะยังคงพร้อมใช้งานโดยอัตโนมัติเป็นเวลา 60 วัน เว้นแต่คุณจะระบุเวลาหมดอายุที่สั้นกว่า โดยให้ตั้งค่าการหมดอายุที่กำหนดเองเฉพาะในกรณีที่คุณต้องการนำเอนทิตีออกก่อนระยะเวลาเริ่มต้นนี้

// 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

ตัวอย่างนี้แสดงวิธีสร้าง TvEpisodeEntity โดยมีฟิลด์ที่ต้องระบุทั้งหมด

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()

ระบบจะขยายสตริงหมายเลขตอน (เช่น "2") และสตริงหมายเลขซีซัน (เช่น "1") เป็นรูปแบบที่เหมาะสมก่อนที่จะแสดงบนการ์ดรับชมต่อ โปรดทราบว่าสตริงควรเป็นตัวเลข อย่าใส่ "e2" "episode 2" "s1" หรือ "season 1"

หากรายการทีวีมีเพียงซีซันเดียว ให้ตั้งหมายเลขซีซันเป็น 1

หากต้องการเพิ่มโอกาสที่ผู้ชมจะค้นพบเนื้อหาของคุณบน Google TV ให้มากที่สุด โปรดพิจารณาระบุข้อมูลเพิ่มเติม เช่น ประเภท การจัดประเภทเนื้อหา และกรอบเวลาที่พร้อมให้บริการ เนื่องจากรายละเอียดเหล่านี้จะช่วยปรับปรุงตัวเลือกการแสดงและการกรอง

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

ต่อไปนี้เป็นตัวอย่างการสร้าง VideoClipEntity โดยมีฟิลด์ที่ต้องระบุทั้งหมด

VideoClipEntity แสดงถึงคลิปที่ผู้ใช้สร้างขึ้น เช่น วิดีโอ 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()

คุณเลือกตั้งค่าครีเอเตอร์ รูปของครีเอเตอร์ เวลาที่สร้างเป็นมิลลิวินาที หรือกรอบเวลาที่พร้อมให้บริการได้

LiveStreamingVideoEntity

ต่อไปนี้เป็นตัวอย่างการสร้าง LiveStreamingVideoEntity โดยมีฟิลด์ที่ต้องระบุทั้งหมด

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()

คุณเลือกตั้งเวลาเริ่มต้น ผู้ออกอากาศ ไอคอนผู้ออกอากาศ หรือกรอบเวลาที่พร้อมให้บริการสำหรับเอนทิตีการไลฟ์สดได้

ดูข้อมูลโดยละเอียดเกี่ยวกับแอตทริบิวต์และข้อกำหนดได้ที่เอกสารอ้างอิง API

ระบุข้อมูลคลัสเตอร์ความต่อเนื่อง

AppEngagePublishClient มีหน้าที่เผยแพร่คลัสเตอร์ความต่อเนื่อง คุณจะใช้เมธอด publishContinuationCluster() เพื่อเผยแพร่ออบเจ็กต์ ContinuationCluster

ก่อนอื่น คุณควรใช้ isServiceAvailable() เพื่อตรวจสอบว่าบริการพร้อมสำหรับการผสานรวมหรือไม่

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

เมื่อบริการได้รับคำขอ ระบบจะดำเนินการต่อไปนี้ภายในธุรกรรมเดียว

  • ระบบจะนำข้อมูล ContinuationCluster ที่มีอยู่จากพาร์ทเนอร์นักพัฒนาออก
  • ระบบจะแยกวิเคราะห์และจัดเก็บข้อมูลจากคำขอใน ContinuationCluster ที่อัปเดต

ในกรณีที่เกิดข้อผิดพลาด ระบบจะปฏิเสธคำขอทั้งหมดและคงสถานะเดิมไว้

API การเผยแพร่เป็น API การแทรก/อัปเดต ซึ่งจะแทนที่เนื้อหาที่มีอยู่ หากต้องการอัปเดตเอนทิตีที่เฉพาะเจาะจงใน ContinuationCluster คุณจะต้องเผยแพร่เอนทิตีทั้งหมดอีกครั้ง

ควรระบุข้อมูล ContinuationCluster สำหรับบัญชีของผู้ใหญ่เท่านั้น เผยแพร่เฉพาะเมื่อ AccountProfile เป็นของบุคคลที่บรรลุนิติภาวะแล้ว

การซิงค์ข้ามอุปกรณ์

SyncAcrossDevices Flag ควบคุมว่าระบบจะซิงค์ข้อมูล ContinuationCluster ของผู้ใช้ในอุปกรณ์ต่างๆ เช่น ทีวี โทรศัพท์ แท็บเล็ต ฯลฯ หรือไม่ การซิงค์ข้ามอุปกรณ์จะปิดใช้โดยค่าเริ่มต้น

ค่า:

  • true: ระบบจะแชร์ข้อมูล ContinuationCluster ในอุปกรณ์ทั้งหมดของผู้ใช้เพื่อให้ประสบการณ์การรับชมราบรื่น เราขอแนะนำให้ใช้ตัวเลือกนี้เพื่อประสบการณ์การใช้งานข้ามอุปกรณ์ที่ดีที่สุด
  • false: ข้อมูล ContinuationCluster จะจำกัดไว้ในอุปกรณ์ปัจจุบัน

แอปพลิเคชันสื่อต้องมีการตั้งค่าที่ชัดเจนเพื่อเปิด/ปิดใช้การซิงค์ข้ามอุปกรณ์ อธิบายสิทธิประโยชน์ให้ผู้ใช้ทราบและจัดเก็บค่ากำหนดของผู้ใช้เพียงครั้งเดียว แล้วนำไปใช้ใน publishContinuationCluster ตามนั้น

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

หากต้องการใช้ฟีเจอร์ข้ามอุปกรณ์ให้เกิดประโยชน์สูงสุด โปรดยืนยันว่าแอปได้รับความยินยอมจากผู้ใช้และเปิดใช้ SyncAcrossDevices เป็น true ซึ่งจะช่วยให้เนื้อหาสามารถซิงค์ในอุปกรณ์ต่างๆ ได้อย่างราบรื่น ส่งผลให้ผู้ใช้ได้รับประสบการณ์การใช้งานที่ดีขึ้นและมีส่วนร่วมมากขึ้น ตัวอย่างเช่น พาร์ทเนอร์ที่ใช้ฟีเจอร์นี้มีการคลิก "รับชมต่อ" เพิ่มขึ้น 40% เนื่องจากระบบแสดงเนื้อหาในอุปกรณ์หลายเครื่อง

ลบข้อมูลการค้นพบวิดีโอ

หากต้องการลบข้อมูลของผู้ใช้จากเซิร์ฟเวอร์ Google TV ด้วยตนเองก่อนระยะเวลาเก็บรักษามาตรฐาน 60 วัน ให้ใช้เมธอด client.deleteClusters() เมื่อได้รับคำขอ บริการจะลบข้อมูลการค้นพบวิดีโอที่มีอยู่ทั้งหมดสำหรับโปรไฟล์บัญชีหรือทั้งบัญชี

DeleteReason Enum จะกำหนดเหตุผลในการลบข้อมูล โค้ดต่อไปนี้จะนำข้อมูลการรับชมต่อออกเมื่อออกจากระบบ


// 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()
)

การทดสอบ

ใช้แอปยืนยันเพื่อยืนยันว่าการผสานรวม Engage SDK ทำงานอย่างถูกต้อง แอปยืนยันมีเครื่องมือที่จะช่วยคุณยืนยันข้อมูลและยืนยันว่ามีการจัดการ Intent การออกอากาศอย่างถูกต้อง

หลังจากเรียกใช้ API การเผยแพร่แล้ว ให้ยืนยันว่าข้อมูลได้รับการเผยแพร่อย่างถูกต้องโดยตรวจสอบแอปยืนยัน คลัสเตอร์ความต่อเนื่องควรแสดงเป็นแถวแยกต่างหากภายในอินเทอร์เฟซของแอป

  • ตั้งค่า Engage Service Flag สำหรับบิลด์ที่ไม่ใช่เวอร์ชันที่ใช้งานจริงในไฟล์ Manifest ของ Android ของแอปเท่านั้น
  • ติดตั้งและเปิดแอปยืนยัน Engage
  • หาก isServiceAvailable เป็น false ให้คลิกปุ่ม "เปิด/ปิด" เพื่อเปิดใช้
  • ป้อนชื่อแพ็กเกจของแอปเพื่อดูข้อมูลที่เผยแพร่โดยอัตโนมัติเมื่อเริ่มเผยแพร่
  • ทดสอบการดำเนินการต่อไปนี้ในแอป
    • ลงชื่อเข้าใช้
    • สลับระหว่างโปรไฟล์ (หากมี)
    • เริ่มเล่น จากนั้นหยุดวิดีโอชั่วคราว หรือกลับไปที่หน้าแรก
    • ปิดแอปขณะเล่นวิดีโอ
    • นำรายการออกจากแถว "รับชมต่อ" (หากระบบรองรับ)
  • หลังจากดำเนินการแต่ละอย่างแล้ว ให้ยืนยันว่าแอปของคุณเรียกใช้ publishContinuationClusters API และข้อมูลแสดงอย่างถูกต้องในแอปยืนยัน
  • แอปยืนยันจะแสดงเครื่องหมายถูกสีเขียว "เรียบร้อย" สำหรับเอนทิตีที่ติดตั้งใช้งานอย่างถูกต้อง

    ภาพหน้าจอแสดงแอปยืนยันสำเร็จ
    รูปที่ 1 แอปยืนยันสำเร็จ
  • แอปยืนยันจะแจ้งเอนทิตีที่มีปัญหา

    ภาพหน้าจอแสดงข้อผิดพลาดของแอปยืนยัน
    รูปที่ 2 ข้อผิดพลาดของแอปยืนยัน
  • หากต้องการแก้ปัญหาเอนทิตีที่มีข้อผิดพลาด ให้ใช้รีโมตทีวีเพื่อเลือกและคลิกเอนทิตีในแอปยืนยัน ปัญหาที่เฉพาะเจาะจงจะแสดงและไฮไลต์เป็นสีแดงเพื่อให้คุณตรวจสอบ (ดูตัวอย่างด้านล่าง)

    รายละเอียดข้อผิดพลาดของแอปยืนยัน
    รูปที่ 3 รายละเอียดข้อผิดพลาดของแอปยืนยัน

REST API

Engage SDK มี REST API เพื่อมอบประสบการณ์การรับชมต่อที่สอดคล้องกันในแพลตฟอร์มที่ไม่ใช่ Android เช่น iOS และ Roku TV API นี้ช่วยให้นักพัฒนาอัปเดตสถานะ "รับชมต่อ" สำหรับผู้ใช้ที่เลือกใช้จากแพลตฟอร์มที่ไม่ใช่ Android ได้

สิ่งที่ต้องมีก่อน

  • คุณต้องผสานรวมแบบอิงตาม Engage SDK ในอุปกรณ์ให้เสร็จก่อน ขั้นตอนนี้มีความสำคัญอย่างยิ่งในการสร้างความเชื่อมโยงที่จำเป็นระหว่างรหัสผู้ใช้ของ Google กับ AccountProfile ของแอป
  • การเข้าถึงและการตรวจสอบสิทธิ์ API: หากต้องการดูและเปิดใช้ API ในโปรเจ็กต์ Google Cloud คุณต้องผ่านกระบวนการรายการที่อนุญาต คำขอ API ทั้งหมดต้องมีการตรวจสอบสิทธิ์

การขอรับสิทธิ์เข้าถึง

หากต้องการมีสิทธิ์เข้าถึงเพื่อดูและเปิดใช้ API ในคอนโซล Google Cloud คุณต้องลงทะเบียนบัญชี

  1. ควรมีรหัสลูกค้า Google Workspace หากไม่มี คุณอาจต้องตั้งค่า Google Workspace รวมถึงบัญชี Google ที่ต้องการใช้เพื่อเรียก API
  2. ตั้งค่าบัญชีด้วย Google Cloud Console โดยใช้อีเมลที่เชื่อมโยงกับ Google Workspace
  3. สร้างโปรเจ็กต์ใหม่
  4. สร้างบัญชีบริการสำหรับการตรวจสอบสิทธิ์ API เมื่อสร้างบัญชีบริการแล้ว คุณจะมี 2 รายการต่อไปนี้
    • รหัสบัญชีบริการ
    • ไฟล์ JSON ที่มีคีย์บัญชีบริการ เก็บไฟล์นี้ไว้ให้ปลอดภัย เนื่องจากคุณจะต้องใช้ไฟล์นี้เพื่อตรวจสอบสิทธิ์ไคลเอ็นต์กับ API ในภายหลัง
  5. ตอนนี้ Workspace และบัญชี Google ที่เชื่อมโยงจะใช้ REST API ได้แล้ว เมื่อการเปลี่ยนแปลงมีผลแล้ว คุณจะได้รับการแจ้งเตือนว่า API พร้อมให้บัญชีบริการเรียกใช้หรือไม่
  6. ทำตามขั้นตอนเหล่านี้เพื่อเตรียมพร้อมสำหรับการเรียก API ที่ได้รับมอบสิทธิ์

เผยแพร่คลัสเตอร์ความต่อเนื่อง

หากต้องการเผยแพร่ข้อมูลการค้นพบวิดีโอ ให้ส่งคำขอ POST ไปยัง publishContinuationCluster API โดยใช้ไวยากรณ์ต่อไปนี้

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

สถานที่:

  • package_name: ชื่อแพ็กเกจของผู้ให้บริการสื่อ
  • accountId: รหัสที่ไม่ซ้ำกันสำหรับบัญชีของผู้ใช้ในระบบของคุณ โดยต้องตรงกับ accountId ที่ใช้บนเส้นทางในอุปกรณ์
  • profileId: รหัสที่ไม่ซ้ำกันสำหรับโปรไฟล์ของผู้ใช้ภายในบัญชีในระบบของคุณ โดยต้องตรงกับ profileId ที่ใช้บนเส้นทางในอุปกรณ์

URL ของบัญชีที่ไม่มีโปรไฟล์คือ

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

เพย์โหลดของคำขอจะแสดงในฟิลด์ entities โดย entities จะแสดงรายการเอนทิตีเนื้อหาซึ่งอาจเป็น MovieEntity หรือ TVEpisodeEntity อย่างใดอย่างหนึ่ง ฟิลด์นี้เป็นฟิลด์ที่ต้องระบุ

เนื้อหาคำขอ

ฟิลด์

ประเภท

ต้องระบุ

คำอธิบาย

entities

รายการออบเจ็กต์ MediaEntity

ใช่

รายการเอนทิตีเนื้อหา (สูงสุด 5 รายการ) ระบบจะเก็บเฉพาะ 5 รายการแรกและทิ้งรายการที่เหลือ อนุญาตให้ใช้รายการว่างเพื่อระบุว่าผู้ใช้ดูเอนทิตีทั้งหมดเสร็จแล้ว

ฟิลด์ entities มี movieEntity และ tvEpisodeEntity แยกออกจากกัน

ฟิลด์

ประเภท

ต้องระบุ

คำอธิบาย

movieEntity

MovieEntity

ใช่

ออบเจ็กต์ที่แสดงภาพยนตร์ภายใน ContinuationCluster

tvEpisodeEntity

TvEpisodeEntity

ใช่

ออบเจ็กต์ที่แสดงตอนของทีวีภายใน ContinuationCluster

ออบเจ็กต์แต่ละรายการในอาร์เรย์เอนทิตีต้องเป็นประเภท MediaEntity ที่ใช้ได้ประเภทใดประเภทหนึ่ง ได้แก่ MovieEntity หรือ TvEpisodeEntity พร้อมด้วยฟิลด์ทั่วไปและฟิลด์เฉพาะประเภท

ข้อมูลโค้ดต่อไปนี้แสดงเพย์โหลดของเนื้อหาคำขอสำหรับ publishContinuationCluster API

{
  "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"
      }
    }
  ]
}

ลบข้อมูลการค้นพบวิดีโอ

ใช้ clearClusters API เพื่อนำข้อมูลการค้นพบวิดีโอออก

ใช้ URL ของ POST เพื่อนำเอนทิตีออกจากข้อมูลการค้นพบวิดีโอ หากต้องการลบข้อมูลคลัสเตอร์ความต่อเนื่อง ให้ส่งคำขอ POST ไปยัง clearClusters API โดยใช้ไวยากรณ์ต่อไปนี้

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

สถานที่:

  • package_name: ชื่อแพ็กเกจของผู้ให้บริการสื่อ
  • accountId: รหัสที่ไม่ซ้ำกันสำหรับบัญชีของผู้ใช้ในระบบของคุณ โดยต้องตรงกับ accountId ที่ใช้บนเส้นทางในอุปกรณ์
  • profileId: รหัสที่ไม่ซ้ำกันสำหรับโปรไฟล์ของผู้ใช้ภายในบัญชีในระบบของคุณ โดยต้องตรงกับ profileId ที่ใช้บนเส้นทางในอุปกรณ์

เพย์โหลดสำหรับ clearClusters API มีฟิลด์เดียวเท่านั้นคือ reason ซึ่งมี DeleteReason ที่ระบุเหตุผลในการนำข้อมูลออก

{
  "reason": "DELETE_REASON_LOSS_OF_CONSENT"
}

การทดสอบ

หลังจากโพสต์ข้อมูลเรียบร้อยแล้ว ให้ใช้บัญชีทดสอบผู้ใช้เพื่อยืนยันว่าเนื้อหาที่คาดไว้ปรากฏในแถว "รับชมต่อ" ในแพลตฟอร์ม Google เป้าหมาย เช่น Google TV และแอป Google TV บนมือถือ Android และ iOS

ในการทดสอบ ให้รอการเผยแพร่ที่อาจล่าช้าอย่างสมเหตุสมผลเป็นเวลา 2-3 นาที และปฏิบัติตามข้อกำหนดในการดู เช่น ดูภาพยนตร์บางส่วนหรือดูตอนจนจบตอน ดูรายละเอียดได้ในหลักเกณฑ์ฟีดวิดีโอถัดไปสำหรับนักพัฒนาแอป

ดาวน์โหลด

คุณต้องยอมรับข้อกำหนดและเงื่อนไขต่อไปนี้ก่อนดาวน์โหลด

ข้อกำหนดและเงื่อนไข

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
ดาวน์โหลด

verify_app_multiplatform_public_20250602.apk