Closed B-Interactive closed 2 years ago
I agree with making it optional. Maybe in the future or for new plugin installs it should be enabled by default?
I don't see a way to get just the customer number via the API, but it does seem to be in pretty much all the URLs. I see two options:
Maybe I'm overlooking something, but aside from that (dismissible) callout box, it appears there's no way to get the customer number from an account with no videos (via the API or the dashboard). Maybe this is something to request?
I want to expand scope of this into two areas of relevance.
Server: Server access to Cloudflare API and responses. Client: End-user direct access to Cloudflare content (video, thumbnails), via embed code.
The Client aspect of this, I think is the more pressing issue, because it's the greater unknown. As admins, we know where our server geographically resides and to the best of our ability, ensure access to the Cloudflare API. However, we can't always know where the end-user resides, or what means they're using to connect to our service (VPN, proxy, etc).
The API generated embed code for displaying content to the end-user, would naturally include the subdomain. But as we currently use a manual embed code, the subdomain must be separately obtained.
I've queried this in the Cloudflare forum on the topic, with the hopeful outcome of an API call that includes the subdomain as a specific data object.
Failing that, we could otherwise parse it from an API call (like list videos) as you mentioned and populate the missing data, if and when it's available, which might not be right away if the account has no uploaded videos.
Cloudflare have said they'll think about the ideal way to provide this subdomain/code via the API. For now, I'll standby for the outcome of that.
I misunderstood the scope of this. When testing this more now and reviewing the announcement details, it's now clear this only impacts embed codes and thumbnail/video URLs.
Server-side code continues to reference the current domain for API requests.
Initial steps for this have been added with b65053cb8e2a534a27fc400d8012d54f781e4519.
It provides option for media domain in admin settings:
The third option to be added still, will be the Cloudflare accounts unique sub-domain.
Account specific sub-domains are now added with 74bfc5daf26184e8464ee3378caa22c01c8f75f9. The embed code structure is slightly different when using it, so a bit of logic was necessary to handle that.
The subdomain details are parsed from the API response at /stream
. Specifically, the thumbnail from the first video in the list. If no videos have been uploaded to the account, the option is not presented.
Perhaps to address issues with some countries blocking Cloudflare Stream access, Cloudflare has announced support for account specific sub-domain access to Cloudflare Stream resources.
The subdomain consists of an account specific code. I've not yet probed or tested this, but hopefully the code is obtainable via token based access to the API. If so, a plugin user could choose to activate use of the subdomain with a checkbox option.
I believe it needs to remain optional, because it could conflict with any pre-existing content security policies active on the web host (effectively blocking user access to content). In those cases, an admin needs to first update their web hosts content security policies to ensure the subdomain is permitted.