microsoft / microsoft/AdaptiveCards
[Rendering] Every other customMediaPlayer Video fails to initialise correctly
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2k
- Forks
- 595
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 1
Description
Target Platforms
NodeJS
SDK Version
1.5
Application Name
it's possible to replicate this issue here: https://adaptivecards.io/designer/ (this is where I took the screenshot)
Problem Description
Having more than one inline custom Media (youtube, vimeo, dailymotion) causes every second video to fail to render.
The issue is the use of global flags in the ICustomMediaPlayer urlPatterns, these are causing every other call to pattern.exec to fail to find matches (state is maintained as lastIndex until all instances are found, at which point a null is returned and the pattern state reset).
This causes every other video to default to use a HTML5MediaPlayer instead of the appropriate provider.
A quick fix would be to remove the global flags since each mediaSource only needs to contain one video url.
Screenshots

Card JSON
{
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.5",
"body": [
{
"type": "Media",
"sources": [
{
"url": "https://www.youtube.com/watch?v=awqTmdI6dRw"
}
]
},
{
"type": "Media",
"sources": [
{
"url": "https://www.youtube.com/watch?v=awqTmdI6dRw"
}
]
}
]
}
Sample Code Language
No response
Sample Code
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing ICustomMediaPlayer.urlPatterns and the pattern.exec calls used during media rendering. Reproduce the issue with the supplied Adaptive Card containing two YouTube Media elements, then verify that each inline provider initializes correctly instead of falling back to HTML5MediaPlayer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100