Comments (8)
That doesn't cause any issues for the block that I can see (this past week got busy and I haven't done much to get an actual PR ready anyway).
My only question is whether it's worth creating the base URL in its own function so it wouldn't have to be changed in PHP and JS in the future if it changed again? Maybe even including the account ID so the two places we interface with the API just need to be aware of endpoint/authentication/payload? Or maybe that's over-thinking it since it's not likely to change often if at all.
Edit: Also, I like the approach to automatically getting the account ID if it's needed. Realizing there's a slight edge case where I don't believe uploading a new video via the block would trigger the update, and since we're generating the iframe locally, is it conceivable that if someone was just uploading (not browsing) they might not trigger the update for a while? I don't know if it matters since the zone endpoint still works, just thinking if we did get the base URL from a function, that could be used to trigger the update.
Apologies if any of this is half-baked - I'm still in the midst of some big work deadlines so I haven't thought through this as carefully as I normally would.
from cloudflare-stream-wordpress.
Thanks @davidmpurdy , that's a good point regarding the base URL, and it would actually benefit solutions for the variable sub-domains, or even Cloudflare URL options (videodelivery.net, cloudflarestream.com) which may be a part of that solution too.
I'll take another look at it and see about eliminating redundancy on the current doubling up of those request functions too.
from cloudflare-stream-wordpress.
Minor bug with trying to upgrade to the account ID when it doesn't exist.
Fixed with #13
from cloudflare-stream-wordpress.
I don't think I fully understand how zones are supposed to relate to Stream structurally (if at all). Using zones feels a little strange to me since my understanding is that they're a level down, structurally (Stream is at the account level, zones are at the domain level, right?).
It is easier to get working though (I checked and it seems to work with any of the zone IDs in the account with Stream). I think you're right that's a Cloudflare question - I'd be interested to hear if that's an intentional architecture decision or maybe an accident of implementation.
from cloudflare-stream-wordpress.
I think you're right @davidmpurdy, it would seem zones aren't supposed to really come into play with Stream.
My implementation using zones was originally at least, taking advantage of what now appears to be an anomaly with that end-point.
Given the official recommendation seems to be to use /accounts
(for Stream), and currently this plugin does not try to take advantage of the data available with /zones
, I will commence switching it over to /accounts
.
Cloudflare have said they will look into including an API call that can retrieve the account specific subdomain, so that's something to keep an eye out for.
from cloudflare-stream-wordpress.
I've pushed a branch with this update, but I want to run it by you @davidmpurdy first, to make sure this isn't going to impact your current efforts with the blocks. Please let me know!
If the plugin is already set up with Zone ID and API token, this update will automatically pull and save the Account ID, so no intervention should be needed by the user. This action is prompted by either of these two things:
- An admin accesses the plugin's settings page (regardless of whether Save Settings is hit).
- A Cloudflare Stream API call is made.
In both scenarios, the Account ID is only fetched, if it isn't already in the local database. It is using add_option()
, so it will not update an existing Account ID, only an absent one.
from cloudflare-stream-wordpress.
Completed with 8aec255.
from cloudflare-stream-wordpress.
Thanks for picking that up, and providing the patch!
from cloudflare-stream-wordpress.
Related Issues (20)
- Playback defaults in admin settings HOT 1
- Not all URL parameters work in iframe embed player HOT 5
- Admin CSS enqueued in wrong class.
- Deprecation of plugins use of zones API
- Preload behaviour for video embed HOT 2
- Unify rendering of block and shortcode
- Block editor doesn't preview videos requiring signed URLs HOT 5
- Plugin name / permalink slug currently conflicts with Cloudflare Stream HOT 1
- Update readme.txt
- WordPress plugin adoption HOT 7
- Add support for posters (cover photo) for signed url videos HOT 6
- Shotcode sizing issues HOT 7
- Use signed URLs for videos inserted with the block HOT 4
- Removal of analytics HOT 4
- Upgrade path for existing blocks HOT 3
- Update the block player to the new iframe player HOT 5
- Option for account specific sub-domains HOT 6
- Localization updates HOT 2
- Upload button is missing HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cloudflare-stream-wordpress.