On this page
Multi_embed_player_class
Defined at multi_embed_player.js
variable list of multi_embed_player class
| variable name | type | default value | description |
|---|---|---|---|
| cors_proxy | string | cors proxy url | |
| iframe_api_endpoint | string | https://iframe-api-ts.ryokuryu.workers.dev | iframe api endpoint |
| iframe_api_credentials | RequestCredentials | same-origin | credentials mode for iframe api endpoint requests. Set include when your iframe api endpoint uses cookies or credentialed CORS |
| follow_GDPR | boolean | false | follow GDPR mode |
| script_origin | string | https://cdn.jsdelivr.net/npm/multi_embed_player@v3/dist/ | script origin |
| mep_status_load_api | Object | {serviceName:number} | load api status 0->not load 1->loading 2->loaded |
| mep_load_api_promise | Object | {serviceName:[function]} | waiting load api function functions will be called when api loaded |
| api_cache | Object | {serviceName:{iframe api response}} | api cache of iframe api response |
| GDPR_accept_promise | Object | {serviceName:[function]} | waiting GDPR accept function functions will be called when GDPR accepted |
| iframe_api_class | Object | {} | iframe sub api class add value after iframe sub api loaded |
| GDPR_accepted | Object | {serviceName:boolean} | GDPR accepted status |
| possible_direct_access_services | string[] | [servicename] | services that can be accessed directly when GDPR accepted |
| tearms_policy_service | string | {servicename:policy url} | terms policy url for specific service |
| applemusic_api_loaded | number | 0 | Apple Music iframe API load status |
| applemusic_api_promise | Array | waiting Apple Music iframe API load promises | |
| youtube_host_policy | string | nocookie | Default YouTube embed host policy. nocookie, youtube, or nocookie-fallback-youtube |
function list of multi_embed_player class instance
Not include function start with ‘#’.
| function name | arguments | response | description |
|---|---|---|---|
| connectedCallback | called when custom element connected | ||
| loadVideoById | {loadVideoByIdOptions},autoplay:boolean(optional),sub:boolean(optional internal compatible) | load video by id for player | |
| playVideo | play video for player | ||
| pauseVideo | pause video for player | ||
| stopVideo | pause video for player compatibility | ||
| getCurrentTime | bilibili->Promise of number(seconds) others -> number(seconds) |
get current time for player | |
| seekTo | number(seconds) | seek to time for player | |
| mute | mute for player | ||
| unMute | unmute for player | ||
| isMuted | bilibili->promise of boolean others->boolean |
check mute status for player | |
| setVolume | number(0-100) | set volume for player | |
| getVolume | bilibili->promise of number(0-100) others->number(0-100) |
get volume for player | |
| getDuration | bilibili->promise of number(seconds) others->(seconds) |
get duration for player | |
| getRealDuration | bilibili->promise of number(seconds) others->number(seconds) |
return duration between start and end seconds | |
| getRelativeCurrentTime | bilibili->promise of number(seconds) others->number(seconds) |
return current time count from start seconds | |
| getPercentOfCurrentTime | Promise of number | return current time percent from duration NOTE:sometimes return over 100% value |
|
| relativeSeekTo_ct | number(seconds) | seek to time count from current seconds | |
| relativeSeekTo_ss | number(seconds) | seek to time count from start seconds | |
| getPlayerState | number | get player state -1->not set video mainly before embed 0->not playing only thumbnail 1->onloaded(include cue) 2->playing 3->paused 4->video ended |
static function list of multi_embed_player class
| function name | arguments | response | description |
|---|---|---|---|
| authorizeAppleMusic | AppleMusicOptions(optional) | Promise<AppleMusicAuthorizationStatus> | authorize Apple Music playback using MusicKit JS |
| getAppleMusicAuthorizationStatus | Promise<AppleMusicAuthorizationStatus> | get Apple Music authorization status | |
| normalizeYoutubeHostPolicy | value:any, fallback:YoutubeHostPolicy(optional) | YoutubeHostPolicy | normalize YouTube host policy and fallback invalid values |
event list of multi_embed_player class
| Event Name | Type | Description | value |
|---|---|---|---|
onReady |
Event | Fired when the player is ready | None |
onError |
CustomEvent | Fired when an error occurs | Error code |
onStateChange |
CustomEvent | Fired when the player’s state changes | player state |
onEndVideo |
Event | Fired when the video playback ends | None |
executeSecound |
Event | Fired to trigger secondary action (error handling) | None |
onYoutubeHostFallback |
CustomEvent | Fired when YouTube host fallback is used | {mode, fromHost, toHost, code} |
loadVideoByIdOptions
| variable name | type | require | default value | description |
|---|---|---|---|---|
| videoId | string | true | video id if call array is defined this value is ignored and not required | |
| service | string | true | service name if call array is defined this value is ignored not required | |
| startSeconds | number | false | 0 | start seconds |
| endSeconds | number | false | end seconds | |
| call_array | [call_video_object] | false | call array | |
| call_index | number | false | 0 | call array index |
| subVideoId | string | false | sub video id compatibility | |
| subService | string | false | sub service name compatibility | |
| kind | string | false | songs | Apple Music resource kind. v1 supports songs only |
| storefront | string | false | api default | Apple Music storefront such as jp or us |
| youtubeHostPolicy | string | false | nocookie | YouTube embed host policy. nocookie, youtube, or nocookie-fallback-youtube |
youtubeHostPolicy is used only for YouTube. nocookie uses youtube-nocookie.com, youtube uses youtube.com, and nocookie-fallback-youtube first tries youtube-nocookie.com and then reloads with youtube.com when fallback is allowed.
call_video_object
| variable name | type | require | default value | description |
|---|---|---|---|---|
| videoId | string | true | video id | |
| service | string | true | service name |
AI Assistance Disclosure
This documentation page includes content generated with the assistance of AI tools. Specifically:
Claude 3.5 Sonnet GitHub Copilot
All AI-generated content has been reviewed and edited by a human to ensure accuracy and relevance.