Para analizar nuestros productos y proporcionar comentarios sobre ellos, únete al canal oficial de Ad Manager en Discord, en el servidor Google Advertising and Measurement Community.
Cómo guardar y cargar favoritos de flujos de anuncios
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
En esta guía, se muestra cómo implementar la función de favoritos con el SDK de IMA de DAI
Cuando se usa la inserción de anuncios dinámicos (DAI) para transmisiones de video on demand (VOD).
Aquí se presupone que hay una implementación de DAI de IMA que funcione, como la que se presenta en
Comienza ahora.
¿Qué son los favoritos?
Agregar a favoritos es la capacidad de guardar y luego regresar a un punto específico
en la transmisión de contenido. Supongamos que un usuario mira contenido de cinco minutos
sale de la transmisión de video por Internet y regresa a ella. Agregar a favoritos guarda la
la posición del usuario en la transmisión para que esta pueda retomar desde donde
dejar de responder, lo que brinda una experiencia fluida al usuario.
Funcionamiento interno de los favoritos de la DAI
Cuando agregue a favoritos una transmisión de DAI, debe registrar el ID y la hora de la transmisión.
cuando el usuario abandona el video. Cuando el usuario regrese, vuelve a solicitar el
y busca el tiempo ahorrado. Dado que cada instancia de la solicitud
puede tener pausas publicitarias de distintas duraciones con solo guardar la transmisión
tiempo no funcionará. Lo que en realidad quieres hacer es continuar desde el mismo
tiempo de contenido.
Métodos de conversión al rescate
El SDK de DAI de IMA proporciona un par de métodos para solicitar la hora del contenido.
durante un tiempo de transmisión determinado y el tiempo de transmisión de un contenido determinado
tiempo. Con estos métodos de conversión, puedes guardar el historial
hora de contenido y, luego, busca el tiempo de transmisión correspondiente en
la nueva instancia de la transmisión. Este es el enfoque, incluyendo un vínculo
a una app de ejemplo que muestra una implementación de favoritos en funcionamiento.
Carga el favorito cuando vuelvas a solicitar una transmisión. Es parte de la implementación
la interfaz VideoStreamPlayer
publicvoidloadUrl(Stringurl,List<HashMap<String,String>>subtitles){//Setvideoplayer's stream URL and subtitles, and play the stream....//Bookmarking.if(bookmarkTime > 0){doublestreamTime=streamManager.getStreamTimeForContentTime(bookmarkTime);videoPlayer.seek((long)(streamTime*1000.0));//stoms.}}
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-08-21 (UTC)"],[[["\u003cp\u003eThis guide explains how to implement bookmarking in video-on-demand (VOD) streams using the IMA DAI SDK for a seamless viewing experience.\u003c/p\u003e\n"],["\u003cp\u003eBookmarking involves saving the user's content time, not just stream time, to ensure accurate playback resumption.\u003c/p\u003e\n"],["\u003cp\u003eThe IMA DAI SDK provides methods to convert between stream time and content time for bookmarking purposes.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can save bookmarks when the activity is paused and load them when the stream is re-requested.\u003c/p\u003e\n"],["\u003cp\u003eA sample app demonstrating bookmarking implementation is available on GitHub.\u003c/p\u003e\n"]]],["Bookmarking in IMA DAI involves saving the user's position in a video stream for later continuation. Instead of recording the stream time, the key is to save the content time. When a user leaves, record the stream ID and convert the current stream time to content time using `getContentTimeForStreamTime()`. Upon return, re-request the stream and use `getStreamTimeForContentTime()` to find the corresponding stream time to seek to. Bookmarks are saved when the `Activity` pauses and loaded when re-requesting a stream.\n"],null,["# Save and load ad stream bookmarks\n\nThis guide shows how to implement bookmarking using the IMA DAI SDK\nwhen using Dynamic Ad Insertion (DAI) for video-on-demand (VOD) streams.\nThis assumes a working IMA DAI implementation, such as the one presented in\n\n\n[Get Started](/interactive-media-ads/docs/sdks/android/dai-quickstart).\n\n\nWhat is bookmarking?\n--------------------\n\nBookmarking is the ability to save and then return to a specific point\nin the content stream. Suppose a user watches five minutes of content,\nleaves the video stream, and then returns to it. Bookmarking saves the\nuser's position in the stream so the stream can pick up from where it\nleft off, providing a seamless experience to the viewer.\n\nDAI bookmarking under the hood\n------------------------------\n\nWhen bookmarking a DAI stream, you must record the stream id and time\nwhen the user leaves the video. When the user returns, re-request the\nstream and seek to the saved time. Since each instance of the requested\nstream can have ad breaks of different durations simply saving the stream\ntime won't work. What you really want to do is continue from the same\n**content time**.\n\nConversion methods to the rescue\n--------------------------------\n\nThe IMA DAI SDK provides a pair of methods to request the **content time**\nfor a given **stream time** and the **stream time** for a given **content\ntime** . Using these conversion methods you can store the bookmarked\n**content time** and then seek to the corresponding **stream time** in\nthe new instance of the stream. Here's the approach, including a link\nto a sample app that shows a working bookmarking implementation.\n\nSaving bookmarks\n----------------\n\nSave a bookmark when the `Activity` is paused. \n\n private double bookmarkTime;\n @Override\n public void onPause() {\n super.onPause();\n double streamTime = videoPlayer.getCurrentPosition() / 1000.0; // ms to s.\n bookmarkTime = streamManager.getContentTimeForStreamTime(streamTime);\n }\n\nLoading bookmarks\n-----------------\n\nLoad the bookmark when re-requesting a stream. It's part of implementing\nthe `VideoStreamPlayer` interface. \n\n public void loadUrl(String url, List\u003cHashMap\u003cString, String\u003e\u003e subtitles) {\n // Set video player's stream URL and subtitles, and play the stream.\n ...\n\n // Bookmarking.\n if (bookmarkTime \u003e 0) {\n double streamTime =\n streamManager.getStreamTimeForContentTime(bookmarkTime);\n videoPlayer.seek((long) (streamTime * 1000.0)); // s to ms.\n }\n }\n\nSample app\n----------\n\n[Download the Sample app](//github.com/googleads/googleads-ima-android-dai)\nto see a bookmarking implementation."]]