ما إذا كان يجب على CAF التحقق مما إذا كانت حالة الفاصل الحالي قد تغيّرت. قد لا يكون هذا الإجراء مرغوبًا فيه قبل
بدء التشغيل، إذ قد يحتاج المستلِم إلى إضافة المزيد من الفواصل الإعلانية
(مثلاً، أثناء اكتمال التحميل).
تعرِض القيمة "صحيح" إذا كان يجب تشغيل الفواصل الإعلانية التي تمت مشاهدتها.
المرتجعات
boolean
removeBreakById
إزالة BreakById(breakId) يُرجع قيمة منطقية
لإزالة الفواصل الإعلانية ومقاطع الفواصل الإعلانية المرتبطة بها.
المَعلمة
breakId
سلسلة
رقم تعريف الفاصل
المرتجعات
boolean صحيح إذا تمت إزالة الفاصل بنجاح.
setBreakClipLoadInterceptor
setBreakClipLoadInterceptor(interceptor)
يوفر أداة اعتراض للسماح للمطوّر بإدراج المزيد من مقاطع الفواصل أو تعديل مقطع الفواصل الحالية قبل بدء الفاصل.
إذا كان المعترض قيمة فارغة، فستتم إعادة ضبط التقاطع على القيمة التلقائية.
بشكل تلقائي، يتم جلب ومنطق تحليل نموذج عرض إعلانات الفيديو (VAST) في أداة الاعتراض التلقائية.
وبالتالي، في حال ضبط مطوّر البرامج الاعتراض المخصّص، سيتم إلغاء منطق VAST، وعلى المطوّرين تنفيذ منطق استرجاع وتحليل نموذج عرض إعلانات الفيديو (VAST) في أداة الاعتراض التي تم توفيرها.
تقاطع أو قيمة فارغة إذا أراد المطوّر إعادة ضبطه على القيمة التلقائية
وسيعرض أداة اعتراض محاولة الفاصل التلقائي
أقرب فاصل من قيمة SeeTo.
قد تكون القيمة فارغة.
setPlayWatchedBreak
setPlayWatchedBreak(playWatchedBreak)
تضع علامة للتحكّم في ما إذا كان يجب تشغيل فاصل تركيب العميل الذي تمت مشاهدته.
المَعلمة
playWatchedBreak
boolean
setVastTrackingInterceptor
setVastTrackingInterceptor(interceptor)
توفر أداة اعتراض لتعديل عنوان URL لتتبع نموذج عرض إعلانات الفيديو (VAST) قبل إرساله
إلى الخادم.
إدخال أداة الاعتراض هو سلسلة من عنوان URL للتتبُّع.
ويمكن أن تعرض أداة الاعتراض سلسلة معدّلة من عنوان URL أو تعهدًا بسلسلة معدّلة من عنوان URL.
ويمكن أن تعرض أداة الاعتراض أيضًا قيمة فارغة إذا كنت تريد إرسال
عنوان URL للتتبّع باستخدام رمزك الخاص بدلاً من استخدام CAF.
تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThe \u003ccode\u003eBreakManager\u003c/code\u003e class provides methods for managing breaks (ads) within media content on a Cast receiver.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can add, remove, and retrieve information about breaks and break clips using the provided methods.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eBreakManager\u003c/code\u003e allows customization of break behavior through interceptors for loading, seeking, and VAST tracking.\u003c/p\u003e\n"],["\u003cp\u003eIt offers functionality to control whether watched breaks should be played.\u003c/p\u003e\n"],["\u003cp\u003eMethods are available to access details about the currently playing break clip, including its duration and current time.\u003c/p\u003e\n"]]],[],null,["# Class: BreakManager\n\ncast.[framework](/cast/docs/reference/web_receiver/cast.framework).[breaks](/cast/docs/reference/web_receiver/cast.framework.breaks).BreakManager\n=================================================================================================================================================\n\nclass static\n\nClass to manage breaks.\n\nMethods\n-------\n\n### addBreak\n\naddBreak(breakData, breakClips, broadCastMediaStatus) returns boolean\n\nAdds dynamic break and break clips.\nThe break clips will be associated with the break (break.breakClipIds and\nbreak.duration will be updated according to the clips).\n\n| #### Parameter ||\n|----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| breakData | [cast.framework.messages.Break](/cast/docs/reference/web_receiver/cast.framework.messages.Break) Value must not be null. |\n| breakClips | Array of non-null [cast.framework.messages.BreakClip](/cast/docs/reference/web_receiver/cast.framework.messages.BreakClip) Value must not be null. |\n| broadCastMediaStatus | Optional boolean Whether CAF should check if the current break status has changed. This may not be desirable before playback begins, as the receiver may still need to add more breaks (e.g., during load complete). |\n\nReturns\n\n: `boolean` True if break was added successfully.\n\n### getBreakById\n\ngetBreakById(id) returns [cast.framework.messages.Break](/cast/docs/reference/web_receiver/cast.framework.messages.Break)\n\nGets current media break by id.\n\n| #### Parameter ||\n|----|------------------|\n| id | string Break id. |\n\nReturns\n\n: `nullable `[cast.framework.messages.Break](/cast/docs/reference/web_receiver/cast.framework.messages.Break)\n\n### getBreakClipById\n\ngetBreakClipById(id) returns [cast.framework.messages.BreakClip](/cast/docs/reference/web_receiver/cast.framework.messages.BreakClip)\n\nGets current media break clip by id.\n\n| #### Parameter ||\n|----|-----------------|\n| id | string Clip id. |\n\nReturns\n\n: `nullable `[cast.framework.messages.BreakClip](/cast/docs/reference/web_receiver/cast.framework.messages.BreakClip)\n\n### getBreakClipCurrentTimeSec\n\ngetBreakClipCurrentTimeSec() returns number\n\nReturns current time in sec in currently-playing break clip.\n\nReturns\n\n: `nullable number` Current time in sec inside current break clip. Null, if\n player is not playing break clip.\n\n### getBreakClipDurationSec\n\ngetBreakClipDurationSec() returns number\n\nReturns duration in sec of currently-playing break clip.\n\nReturns\n\n: `nullable number` Duration of current break clip. Null, if player is not\n playing break clip.\n\n### getBreakClips\n\ngetBreakClips() returns Array of non-null [cast.framework.messages.BreakClip](/cast/docs/reference/web_receiver/cast.framework.messages.BreakClip)\n\nGets current media break clips.\n\nReturns\n\n: `non-null Array of non-null `[cast.framework.messages.BreakClip](/cast/docs/reference/web_receiver/cast.framework.messages.BreakClip)\n\n### getBreaks\n\ngetBreaks() returns Array of non-null [cast.framework.messages.Break](/cast/docs/reference/web_receiver/cast.framework.messages.Break)\n\nGets current media breaks.\n\nReturns\n\n: `non-null Array of non-null `[cast.framework.messages.Break](/cast/docs/reference/web_receiver/cast.framework.messages.Break)\n\n### getCreativeInfoByClipId\n\ngetCreativeInfoByClipId(breakClipId) returns [cast.framework.breaks.CreativeInformation](/cast/docs/reference/web_receiver/cast.framework.breaks.CreativeInformation)\n\nGets creative information associated with breakclip by id.\n\n| #### Parameter ||\n|-------------|-----------------|\n| breakClipId | string Clip id. |\n\nReturns\n\n: `nullable `[cast.framework.breaks.CreativeInformation](/cast/docs/reference/web_receiver/cast.framework.breaks.CreativeInformation)\n\n### getPlayWatchedBreak\n\ngetPlayWatchedBreak() returns boolean\n\nReturns true if watched breaks should be played.\n\nReturns\n\n: `boolean`\n\n### removeBreakById\n\nremoveBreakById(breakId) returns boolean\n\nRemoves a break and associated break clips.\n\n| #### Parameter ||\n|---------|-----------------|\n| breakId | string Break Id |\n\nReturns\n\n: `boolean` True if break was removed successfully.\n\n### setBreakClipLoadInterceptor\n\nsetBreakClipLoadInterceptor(interceptor)\n\nProvides an interceptor to allow developer to insert more break clips\nor modify current break clip\nbefore a break is started.\n\nIf interceptor is null it will reset the interceptor to default one.\nBy default VAST fetching and parsing logic in default interceptor.\nSo if customized interceptor is set by developer, the VAST logic will be\noverridden and developers should implement their own VAST fetching and\nparsing logic in the provided interceptor.\n\n| #### Parameter ||\n|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| interceptor | function(non-null [cast.framework.messages.BreakClip](/cast/docs/reference/web_receiver/cast.framework.messages.BreakClip), optional non-null [cast.framework.breaks.BreakClipLoadInterceptorContext](/cast/docs/reference/web_receiver/cast.framework.breaks.BreakClipLoadInterceptorContext)) The default break clip load interceptor will return the same break clip as input. Value may be null. |\n\n### setBreakSeekInterceptor\n\nsetBreakSeekInterceptor(seekInterceptor)\n\nProvides an interceptor for developer to specify\nwhat breaks they want to play after seek.\n\n| #### Parameter ||\n|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| seekInterceptor | function(non-null [cast.framework.breaks.BreakSeekData](/cast/docs/reference/web_receiver/cast.framework.breaks.BreakSeekData)) Interceptor or null if developer wants to reset it to default one. The default break seek interceptor will return the closest break from the seekTo value. Value may be null. |\n\n### setPlayWatchedBreak\n\nsetPlayWatchedBreak(playWatchedBreak)\n\nSets a flag to control if the watched client stitching break\nshould be played.\n\n| #### Parameter ||\n|------------------|---------|\n| playWatchedBreak | boolean |\n\n### setVastTrackingInterceptor\n\nsetVastTrackingInterceptor(interceptor)\n\nProvides an interceptor to modify VAST tracking URL before it is being sent\nto server.\nThe input of the interceptor is a string of the tracking URL.\nThe interceptor can either return a modified string of URL\nor a Promise of modified string of URL.\nThe interceptor can also return null if you want to send the\ntracking URL by your own code instead of by CAF.\n\n| #### Parameter ||\n|-------------|----------------------------------------------------------------------------------------|\n| interceptor | function(string) An interceptor which modifies the URL before sent. Value may be null. |"]]