광고 재생목록 자동화
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
IMA Android SDK는 완전히 자동화된 광고 재생목록을 지원합니다. 이 기능
에 지정된 대로 콘텐츠에 광고 시점을 삽입합니다.
Google Ad Manager
확인하시기 바랍니다. 또한 동영상 플레이어 코드가 크게 간소화됩니다.
광고 시간을 지원하는 데 필요합니다.
- Ad Manager에서 광고를 트래피킹할 때 다양한 광고 규칙을 지정할 수 있습니다.
예: '항상 콘텐츠 시작 부분에 광고 시점 재생' 또는 "하나를 재생해줘"
1분 광고 시점이 표시됩니다.
- 광고가 요청되면 광고 서버는 광고 재생목록을 반환할 수 있습니다. SDK
재생목록을 처리하고 동영상에 설정된 광고 시점을 자동으로
지정합니다.
- Android는 광고와 콘텐츠 재생에 모두 동일한 동영상 플레이어를 사용하므로
광고 규칙을 구현하려는 경우 광고의 플레이헤드 위치를
콘텐츠가 재생되고 광고가 끝나면 해당 위치를 찾습니다.
동영상에
VideoAdPlayer
인터페이스를 구현해야 합니다.
있습니다. 이렇게 하면
시간을 나타냅니다.
private boolean playingContent = true;
private int contentPosition = -1;
private List callbacks =
new ArrayList();
@Override
public void addCallback(VideoAdPlayerCallback callback) {
callbacks.add(callback);
}
@Override
public void removeCallback(VideoAdPlayerCallback callback) {
callbacks.remove(callback);
}
public void loadContent() {
playingContent = true;
load(CONTENT_URL);
}
@Override
public void loadAd(String mediaUrl) {
playingContent = false;
load(mediaUrl);
}
public void pauseContent() {
savePosition();
pause();
}
@Override
public void pauseAd() {
pause();
}
private void pause() {
myVideoView.pause();
for (VideoAdPlayerCallback callback : callbacks) {
callback.onPause();
}
}
public void resumeContent() {
loadContent();
if (contentPosition > 0) {
restorePosition();
}
resume();
}
@Override
public void resumeAd() {
resume();
}
private void resume() {
myVideoView.start();
for (VideoAdPlayerCallback callback : callbacks) {
callback.onResume();
}
}
public void savePosition() {
contentPosition = myVideoView.getCurrentPosition();
}
public void restorePosition() {
myVideoView.seekTo(contentPosition);
}
CONTENT_PAUSE_REQUESTED
및 CONTENT_RESUME_REQUESTED
이벤트는 광고 시간이 재생될 때 콘텐츠를 일시중지하고 재개하는 데 사용됩니다. 추천
관련 API 문서를 참고하세요.
를 참조하세요.
참고: 콘텐츠 재생이 완료되었거나
사용자가 재생을 중지한 경우
AdsLoader.contentComplete
해야 합니다. SDK
설정된 경우 포스트롤 광고 시간을 재생합니다. 이
모든 광고 시간이 발생하면 ALL_ADS_COMPLETED
이벤트가 발생합니다.
확인할 수 있습니다. 또한 콘텐츠 추적은
init()
가 호출되며 항상 init()
를 호출해야 합니다.
콘텐츠를 재생하기 전에
확인할 수 있습니다
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-31(UTC)
[null,null,["최종 업데이트: 2025-08-31(UTC)"],[[["\u003cp\u003eIMA Android SDK simplifies video ad integration by automating ad playlist insertion and playback, including pre-rolls, mid-rolls, and post-rolls.\u003c/p\u003e\n"],["\u003cp\u003eAd breaks are scheduled based on rules defined in Google Ad Manager, enabling features like pre-roll ads and periodic mid-rolls.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers must implement the \u003ccode\u003eVideoAdPlayer\u003c/code\u003e interface and manage content position during ad breaks for seamless transitions between ads and content.\u003c/p\u003e\n"],["\u003cp\u003eThe SDK provides events (\u003ccode\u003eCONTENT_PAUSE_REQUESTED\u003c/code\u003e, \u003ccode\u003eCONTENT_RESUME_REQUESTED\u003c/code\u003e) to handle content playback during ad breaks and signals ad completion with \u003ccode\u003eALL_ADS_COMPLETED\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eContent tracking begins with \u003ccode\u003einit()\u003c/code\u003e, which should be called before content playback, and \u003ccode\u003econtentComplete()\u003c/code\u003e should be called after content ends to trigger post-rolls.\u003c/p\u003e\n"]]],[],null,["# Automate ad playlists\n\nIMA Android SDK supports fully automated ad playlists. This feature\ninserts ad breaks into the content as specified in\n[Google Ad Manager](//admanager.google.com/)\nwhen trafficking your ads. It also greatly simplifies the video player code\nnecessary to support ad breaks, including pre-rolls, mid-rolls and post-rolls.\n\n- When trafficking the ads in Ad Manager, it is possible to specify various ad rules like \"always play ad break at the beginning of the content\" or \"play a one minute ad break every 30 minutes of content\".\n- When ads are requested, the ad server can return an ad playlist. The SDK processes the playlist and automatically schedules the ad breaks that have been specified.\n- Since Android uses the same video player for both ad and content playback, if you plan to implement ad rules, you must save the playhead position of your content when an ad starts, then seek to that position when the ad finishes. Be sure to implement the `VideoAdPlayer` interface in your video player. This ensures that ad breaks are automatically inserted at the times specified in Ad Manager. \n\n ```gdscript\n private boolean playingContent = true;\n private int contentPosition = -1;\n private List callbacks =\n new ArrayList();\n\n @Override\n public void addCallback(VideoAdPlayerCallback callback) {\n callbacks.add(callback);\n }\n\n @Override\n public void removeCallback(VideoAdPlayerCallback callback) {\n callbacks.remove(callback);\n }\n\n public void loadContent() {\n playingContent = true;\n load(CONTENT_URL);\n }\n\n @Override\n public void loadAd(String mediaUrl) {\n playingContent = false;\n load(mediaUrl);\n }\n\n public void pauseContent() {\n savePosition();\n pause();\n }\n\n @Override\n public void pauseAd() {\n pause();\n }\n\n private void pause() {\n myVideoView.pause();\n for (VideoAdPlayerCallback callback : callbacks) {\n callback.onPause();\n }\n }\n\n public void resumeContent() {\n loadContent();\n if (contentPosition \u003e 0) {\n restorePosition();\n }\n resume();\n }\n\n @Override\n public void resumeAd() {\n resume();\n }\n\n private void resume() {\n myVideoView.start();\n for (VideoAdPlayerCallback callback : callbacks) {\n callback.onResume();\n }\n }\n\n public void savePosition() {\n contentPosition = myVideoView.getCurrentPosition();\n }\n\n public void restorePosition() {\n myVideoView.seekTo(contentPosition);\n }\n ```\n- The `CONTENT_PAUSE_REQUESTED` and `CONTENT_RESUME_REQUESTED` events are used to pause and resume the content when ad breaks are played. Refer to the relevant [API documentation](/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdEvent.AdEventType) for details on these events.\n\n**Note:** When the content has finished playing or\nthe user has stopped playback, be sure to call\n[AdsLoader.contentComplete](/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/AdsLoader#contentComplete())\nin order to signal to the SDK that the content is done. The SDK\nthen plays the post-roll ad break, if one has been scheduled. The\n`ALL_ADS_COMPLETED` event is raised when ALL ad breaks\nhave been played. In addition, note that content tracking begins when\n`init()` is called and you should always call `init()`\nbefore playing content."]]