 Hello everyone, this is the core conversation state of media initiative. I'm Naveen Valleja I work with Acquia professional services as senior software engineer, and I'm with Drupal I'm working with Drupal from last six years and I'm Drupal.org project application approver and the maintainer of groups.drupal.org Hey, my name is Adam Honick. I am also at Acquia. I engineer the lightning distribution. I maintain the migrate subsystem and core Probably the media system and core as well, or I wouldn't be up here I guess I've been doing Drupal for a little over a decade I may be the most histrionic person on IRC possibly a Drupal con. We'll see And then Sean do you want to introduce yourself a bit? That's me. Can you hear us? Yeah, so we have Sean in over skype. Thanks. Cool So we're just gonna talk a little bit about like the media initiative kind of how we got to where we're at now and where we're going and How you can help get us there? So Naveen, take it away, man. So this is more about a session. So if you have any questions in the middle, let us know There is Drupalite right now Drupalite, we have the spot for the local files and images Do we have file and image module in the core itself which do provide the spot for the Local images and the file and other documents types. We have the spot for the Responsive images we have breakpoint and responsive module available in the core and we have the spot for the alley features and the embedding of the images in vis-a-vis from the CK editor plugin and we and File module also provides a nice listing of the files using of use Nice things that we don't have in the core right now. We could not reuse the media We don't have any site-wide library right now We could not organize the media in folders or in the categories. We don't have the spot for the remote media Similarly the fieldable files as well and we could not upload the multiple files in one go We have in the contrary space. We have the solution right now PL upload for that, but not in the core So just a brief Yeah, we just want to mention that a lot of this is coming from a survey that was done a little while ago Sorry, so a lot of this information is coming from a survey that was done a little while ago URLs right there Basically asking people what is it that we want to have in core? What do we need in what kind of media support does Drupal need and the responses were quite interesting and a lot of this stuff is Nice stuff that people kind of more or less expect that we just don't have and it's hard to it can be hard to get that stuff in Without contrib solutions and possibly some custom hacking as well So first some media growth in the core from Drupal 6 we have the upload module available which allows us to attest the files through the up node and in the contrary space we have the cckm file field cck and the image field cck and In the also the image cache module available for the image processing and the IMC module So so the transition happened from the Drupal 6 to Drupal 7 is like we move the the cck file field as a file module in the core and the cck image field From the contrary space to the image module in the core and we the image cache module in the Drupal 6 From the contrary space has been moved to the image styles But there are there are more nice features in the Drupal 7 in the contrary space We have the responsive images and the picture break to for the picture and break via picture and breakpoint contributed modules and there are there are two There were the two ways to use of the media to achieve of the media functionality in the Drupal 7 We had the file entity and the media entity Media not media exactly the media media module in the Drupal 7 which would allow us to all to all this reusing of the media and the site-wide media library Yep, three three weeks three weeks before that media 7.x got stable Hand of applause for that In Drupal 7 we could achieve the more advanced functionality Using the couple of the more contributed modules. I'll give a brief how brief about that because it's more of a conversation So this is the one of one of these these media CK reader which which works like a bridge between the media module and the CK editor module itself So it allows files to be embedded within the text area of the CK editor Using that media browser one and we have the media on media embed one It's it's more of a API module. So so it provides the API for the remote media like YouTube Instagram Twitter and flicker and so on and we have the PL applaud for the uploading multiple files and we have the entity embed module available in the country space to embed the entities into the CK editor and There are ten ten different ways to Ten more than ten different ways to crop the images couple of them are image field crop Manual crop IMC crop and many more But in Drupal 7 we have the two big players file entity. Oh, thank you in Drupal Yeah, we have the two big players file entity and the media entity file entity followed the same concept of That Drupal 7 does so we have the fieldable files or everything We don't didn't have the spot for the remote media. However, like media entity is the Media entity provides it's all a all on API itself. So it's provides a base base entity of media the like we could reference all kind of media objects like Twitter Instagram and Different types of photos videos Media entity provides provides us the provides us the relation between the Drupal and the media Media resource. So it's a content entity in itself So this module provides you the like provides a Base storage component for the Drupal media ecosystem. So this media entity in the country space has a solid solid solid foundation base in the country space because And the couple of the distribution has proven that the it has a solid foundation base So there are Drupal 8 more contrary boss on us. We have the entity browser module in The country country space see the goal of this module is to provide a generic solution for embedding Like a selector or picker something. So it's like an entity reference widget. So we could embed entities into the vis-a-vis module Next embed module. It's it's an API in itself. So it's so it's So it's out of the box. It doesn't do anything. So any country module will have to implement the API and In this the entity embed and the URL embed are the dependent module of that embed one So we could embed the entities using that entity embed and we could embed the OM embed objects Into the secret editor using the URL embed module We we have the inline entity form in the country space as well. So it's provides the Widget for the inline management of the content entities entities. We will see it's nice use case in the thunder video later Crop API. It's an API module just to standardize the image crop API storage This module would not do much by itself user should pick up any of the UI module That that should utilize its API and focal point and image crop widget these modules allows us to focal point allows us to specify the specific portion of the image that is most important This information can be used to that the image is cropped or the crop cropped or saved scaled at the whatever the configuration that we will provide so image image widget crop provides this Whole configuration at the widget level of the image field So here we go drop down the drop down drop John just module So it's pro it's provide the integration with the drop John layers just library so it's probably the dragon drop of the file uploads with the image previews and We have the fallback for murder a module which allows multiple for matters to be used for display It provides a few a few for matter that can attempt multiple Formators and the first one that returns output will win. It's similar like this tax services in to polite field for matter The another one is the field for matter. It provides the generic it's provide the collection of generic for matters or entity reference field That that output a specific field to the reference entity Yep, we have the distributions in Contribute space in Drupal 8 media which has proven that the Drupal 8 media entity in the Contribute space has a solid solid foundations So we have thunder and the lightning distribution. So thunder ships with the couple of the media modules Few are me image Instagram Twitter and the slideshow and many more so Thunders override thunder sides its own feature for the medias as well So which provides the media experience out of the box? Let me run this video Here we will see the nice use case Yeah, we could turn the we can mute it, but I could explain Yep, so here a The Thunder distribution comes with the couple of the media bundles out of the box So these these are the media bundles the which comes comes from the me the thunder features So here it comes Comes with the media listings Here's a media listing page with couple of different type of media So here we'll see that it's we are going to create any of the type of the media So that we could so so that it would it could get saved to the media library and we could reuse it later Like different type of Twitter media. We just need to provide the tweet for this Link of this tweet the media main patch RTB seal two days before so here is it's the different type of media is the YouTube one and We are gonna use we are gonna reference this one in the article content. So it's So it thunder comes with the nice flavor of that inline entity foam and the paragraph one Here we'll see it later. Yep. Here. These are just the normal text fields and reference fields So we are adding Here we are gonna Yeah, yeah, here we are gonna reuse that existing video from the media library, which is also One of the target for that Media initiative Yeah, so we could add as many as configuration as per requirement. Yeah, it's about So it's unpublished now. So after publishing it will see So we have the different type of media which we refer referred in this particular note So here's the nice gallery. Yep. Here's a lightning Do you want to garden the chance? Good Yeah, lightning is another distribution a little bit more sparse than thunder it ships with a lot of the same stuff It has the media entity module plus a bunch of its integrations with like Instagram Twitter files and stuff like that It has a media browser that's built on top of entity browser It has bulk uploads with drop zone JS and some fun helper APIs That will improve the developer experience as well and it's wizard approved. So, you know Um So yeah, Naveen also put together a video demonstrating lightning Really quickly and just kind of some of its functionality here and the reason I'm showing you this just I want to explain is This is a lot of this kind of inspires our approach to putting media in core and kind of what the MVP has been is what These two distros and others as well Have put together using the contrib using the parts from contrib So here in lightning, you know like what exactly with thunder it ships with a bunch of media types right out of the box to use And you know what? I'm gonna speed the video up also in this one Because why not? Oh, there we go. Okay. It has a media library exactly the way thunder does It actually comes with media entity So I'm sorry. Did I like pause it or something? Wait, damn it. This is why I Have to like not press the things So, yeah, oh my god, I did it again. You know what? Should we just move on with this? Yeah, forget it. You can see the videos later the slide the slide URLs in the front We only have some time and I want to be able to have some discussion in here So whatever Point is lightning and thunder both do things with media with the contrib parts and it's pretty slick so Let's talk about the media initiative and how we can actually get some of this slick media stuff into core And how we're going to go about doing that So we have the media initiative. It's a fully approved full steam ahead initiative The goals of which are pretty straightforward We want the basic Normal kind of intuitive media handling experience that you would get in just about any CMS that you would I would think you would Expect that in most CMS is like because this is Drupal. We want to probably go a little bit further than that We want to provide an API in core for integrating Many different media services many different media types with a really just robust rock solid flexible API because you know Drupal This is what we do You know by the same token the functionality that we want to ship with core will be fairly limited You know, we don't want to support too many things out of the box That's what contributes for and we also want to be able to integrate with third-party media services digital asset management stuff like that fairly easily using the core API's So there's hang on a minute So there's gonna be three phases of this initiative the first one is our MVP Which is we're calling it the essentials and the goals there are we're going to just kind of we're gonna have a media API in core We're gonna define what that API looks like, you know what the classes are how you use them And then on top of that the first thing we're going to do is build functionality that will essentially mirror what the core file and image modules already do just on top of media entities and Media types and kind of the media API rather than just using files directly we're also going to add a Module that implements a basic media library so that you can you know in CK editor You can call up all the media you have you can choose ones to use In like nodes or whatever for entity references to media. I'm gonna demo that and we want to also Provide support out of the box for like Oh embed providers like YouTube Vimeo. I think Instagram might be one as well There's a bunch To just be able to embed remote media very very simply and easily out of the box. We're targeting Most if not all of this stuff for Drupal 8.4 We also want to have with a wig embedding which may be 8.5. I think we want it in 8.4 I can't remember the details But yeah, we in other words we want all this we wanted as soon as possible We're also going to have the second phase which is extras and that is basically going to be taking place all in contrib It's more shiny stuff and advanced functionality. So like really cool cropping multiple uploads Advanced embedding. I don't know you name it This is all going to be contrib modules built on top of the core media system With an eye towards possible adoption in core eventually Because you know things that as you know things that we like from contrib tend to make it into core in some form So that's what extras kind of is about it's concentrating efforts to build those things and To wit We already have all these cool modules for you know from the d8 ecosystem Parts of which may go into core or at least inspire things in core You know like and have been already described things like embed entity embed which are embedding any entity into like CK editor Drop zone for you know drag and drop uploads cropping etc. Etc So these may all be part these may all become part of the media extras package for lack of a better word and The third part of the initiative is the extend part and the idea here is really about integrating with third-party media services with digital asset management's asset management things The reason for which is like Drupal, you know Drupal is great, but Third-party media services may be able to handle the really complicated stuff like licensing adverts You know geo restriction stuff like that. They might be able to just do a better job So we should have really strong integration with those services and that's what extend is all about It's using the core API is to talk to Third-party media services bright cove might be the proof of concept. We don't really we haven't planned this one out Too far yet. We're more focused on the essentials at this point And so I'll talk a little bit about kind of how the architecture of this is put together The important things to know is That we're basically taking the media entity module and porting it into core as the media module So we're taking that namespace Media entities in core are not special. They're just Normal content entities. They're things with fields attached And as you saw in the Thunder demo video, it's you know, creating a media entity is like making a node There's a form you fill it out. It works, you know, what do you do? They have media types which are config entities just like nodes have node types It's very very simple where things get more interesting is that media a Little bit of a departure from Drupal 7 here is that media are not necessarily files Media are more abstract than that so media could refer to a SoundCloud audio clip It could refer to some snippet of text. It could refer to a tweet It could really refer to anything and the things that are responsible for bridging that gap And kind of standard, you know exposing to Drupal in a standard way the important information about any given piece of media Be it a file or be it some web resource is the source plugin and this is a plugin type exposed by the media module And it's responsible for doing exactly that is the bridge between some media of some kind and Drupal Each media type that you create is associated with one source plugin They're responsible for all of the logic about how to storm like how media is stored is it stored on the web somewhere Is it stored in the local file system? That's up to the source plugin Validation getting metadata about each about some piece of media. They're all responsible for that and that's really kind of the That's really the important stuff that you need to know about the core media architecture everything else about it If you read the patch, which I don't recommend it's 7,000 lines, but I did it. I really don't recommend it If you read it though, like everything in there is pretty normal pretty standard. This is the interesting stuff So as I said, it's the media entity module renamed media moved into core. We're going to merge functionality from the contrived media entity image module in there And the idea there is so that media will come with support for files and images out of the box And the reason we're doing that is so that we can have very quick parody with the core file and image modules Which have a slightly different approach to this stuff. We're also going to include a source plugin That implements support for o embed so that we have something a little bit cooler than just oh, hey Here's file and image. Here's media with file and image support. Which should I use, you know? It's going to be out of the gate beta experimental, which means the API will be stable and If the rest of our MVP isn't in core by Drupal 8.4, we're just going to hide it So you'll still be able to use it, but yeah, so it's a little bit of an interesting situation there But that's what's going to be Then additionally, we're going to provide the media library module which will be experimental And that's going to be built on top of media and it implements a very Well, you'll see it's a UI for selecting and reusing media. Pretty simple. We're also going to want to have a migration path from file from core file and image fields because The underlying storage is different So if you want to have if you have file and image fields and data in those fields and you want to switch them over to Using the media system, there's going to need to be a migration path for that. Hopefully not too complicated So the media library I want to talk about that a little bit it's Well, you didn't see what lightning does you do you did see what thunder does very briefly It's a pared down version of what they do with entity browser Entity browser is a really really complex module. That's super duper powerful. We don't need that much power So it's a pared down version of that. It's not an API. It's not going to be like something that you extend It's just like going to be there But it is customizable. It's based on a on a view that it comes with and a view mode that it comes with and you can Change those things change the way media looks in your library change the way you filter media stuff like that It will also have a new field widget, which will be used with Entity reference fields that reference media items and Which therefore know how to like call up the library and talk to it and like interact with it and stuff Inline entity creation is not going to be supported yet at least and by that I mean stuff like You know imagine a modal where you have your library and you have a tab that says upload or create from embed code And it just creates the media right there not going to be in this at least not yet Lightning and thunder both have that though. So, you know if you need that use them This is a screenshot of what it looks like, but I think I would I would demo it for you at this point so What we have is this is a Drupal 8.4.x dev with all the patches applied and I've tested it So I know it will probably work this being this being a live demo so what I have here is a normal entity reference field that is referencing media items and It's using the special widget that is provided by the media library module. So if I click add media I Get this view in a modal. It's this is a normal view You could totally change this add more filters remove filters You know rebuild it entirely if you wanted to And I can choose media to use From my cheeky collection of memes in my field and You know, there you go. Okay. I selected them. I can actually see them Which is I can reorder them with drag and drop which is in my view kind of a step up from what we've had remove things and You know, there you go. So pretty basic pretty intuitive Gonna be in core Yeah, and there was much rejoicing So Having gone into that a couple of URLs that you may find interesting the UI We have a live clickable kind of interactive UI prototype of kind of what we want the media library to become this What you just saw was really kind of a proof of concept that we hacked together in Berlin in a week The UI prototype is a little bit more involved a little bit more advanced. So you feel free to check that out There was the issue where they designed the prototype if you really care about reading a lot of bike shedding That you can check out and then the main issue that has the patch containing the experimental media library module as it currently exists is the last URL there so Sorry So the way this looks all together is we have several very distinct issues we have to attack in a very a Very specific order in which we have to attack them the current The the main thing we're waiting on right now is the main the big 7,000 line patch that brings the media module into core and the media API. That's currently RTB see So we are very it's been you know been working on it for like five months So we're really really hoping to get that in soon if we're lucky it'll be during this Drupal con, but don't you know You didn't hear it from me After we have that we're going to very quickly move to get parity with file and image module since those are probably the most We think it's the most common use cases like the 80% use case So first will be a file source plug-in then will be an image plug-in which extends that Parallel to that we'll do an O embed plug-in which is sort of slightly lower priority since it's new Once we have the file and image source plug-ins we want to have widgets which Work with media things, but essentially emulate the file and image widgets that we know and love and then four matters that do the same meanwhile once the main patches in we can start refactoring and Rerolling and fixing up the media library to actually get that in so basically it looks good and These are the issues in question You'll you know come back to the slides and copy the NIDs if you really want to read them And there's a lot of follow-ups from the main patch But these are really the important ones and these make up the bulk of our MVP for Drupal 8.4 if you have a module that already integrates with media entity or You have custom code that integrates with it or something like that You will probably want to be porting your module to the core media API when it lands We wrote a change record for that which is really really easy to follow It's just like rename this to this stop calling this Change this reference to that, you know, you'll be done in 10 minutes depending on how good your code is I guess Um It could it could get gnarly man So what's next? Well, get the main patch into core. It's number one. Everybody agrees. We need to do that parody with file an image Get the media library done then we start getting into the extras ecosystem refactor things on top of the core media API and You know improve upon that and eventually Get rid of media entity give it a heroes funeral put it out to see whatever we got to do with it I don't know and you know and start integrating with third-party services and just kind of generally Make the things happen that we've all wanted to have happen and have not been able to do except with Monkey patching contribute things together. So If you would like to help with this we meet in IRC every Wednesday at 2 o'clock Greenwich meantime the contacts the people who know the most are Sean who is has been very very quiet on Skype Maybe he fell asleep. I don't know. He's in the Netherlands Me myself and a proxima Gabore who's over there and a Navin So we all hang out in the Drupal media room and you can talk to us. We also have a Sprint for this stuff on Friday We also really like front-enders and UX people that media library is not going to look good If just engineers are putting it together in my view So if you're a front-ender or UX person, we want we want you to help us, please and That's it Okay, wait, do you want to come to the mic so it's recorded Yeah, I could do it in a bit well ask ask your question first if you want You really want me to show the video We let's do it in a bit. I have we have questions already. I just want to hear from people You sure you want to see the video? Okay It's not a live demo. I'm not sure maybe I'm afraid it somehow won't work YouTube will stop working and then I won't touch anything Because last time I did that nothing worked right So yeah, the lightning video We got some bundles images tweets videos Documents generic file stuff like that Very very similar to thunder if you Go to the media tab under content you have the media the view of your media which this as I said it comes with media entity It's just a view you can change it filter it however you want and if you add media It's like adding a node you choose the type you enter some required stuff One thing lightning does do a little bit differently is it tries to generate live previews of things that are based on embed codes So things like tweets will instantly show up videos also instantly show up. I think that's in the video somewhere Instagrams to stuff like that and then you choose you just select the checkbox to have it save into your media library The idea being to support one-off uses of media where it's like well, I just want to use this one time You know don't really want to reuse it Video works the same way As tweets do except that it has a really Really dumb bug where the preview appears the entire size of the page Maybe I should fix that one of these days. I don't know and Yeah, it's so creating media under media entity is really really straightforward Where lightning gets really cool is in reusing it. We have integration with CK editor through entity embed and the embed module We also are so that's a media reference field right there. It's using our our media browser To call up stuff that's in the media library and allows you to select it It also has these upload and create embed tabs, which I don't know if you can see But the idea there is to be able to create media in line right there from within the browser But yeah, so here we have a field that supports referencing media. We have obviously selected some stuff Did you do a piece with the CK editor part or no, okay? Well, I guess you don't get to see that unless you install lightning But you can also do this exact same workflow with the media browser from CK editor. It's this button that looks like a star So, yeah, that's a really fast rundown of lightning's integration a little more sparse than thunders, but Questions Yeah, so so let's say I have some sites that I've built with Drupal 8 core some sites that I've built with lightning some sites that I've built with thunder What sort of experience should I expect to have as we go through this process of putting media in in core? Well, all the thing that they those all have in common is they're all built on top of media entity So it sounds to me like you would expect to have more or less the same Experience as you update to core media and there's going to be update path like a smooth update path because the good news is while While building the core media module. We didn't change the data model for media. It's really just the apis that changed. So It's it's a pretty safe update path famous last words But I think it's going to be pretty smooth and pretty easy and so then like for example With something like lightning is there anything that's currently built into lightning that I we might lose along the way No, and the reason for that is that lightning particularly We're not going to regress functionality You know when we switch to core media, we're going to be switching to core media under the hood But we want everything to continue to work the way that it does Because it's awesome So basically you can expect things to continue to be awesome and Awesome or as we take advantage of the new stuff in core. Awesome. Great. Yeah Can't speak for thunder though, but I think they'd probably tell you the same thing This is a This is a little bit in the weeds, but on a bunch of projects recently We've been making like basically subclassed entity reference field types To do special stuff that needed to happen like usually it's things like Overriding the title of an article in the specific place where it's being referenced and stuff like that Oh, yeah, but the one thing that we've run into is Media you know the entity reference picker libraries all those things we have to go through and like write subclasses For every single widget that might be used and I'm seeing other Similar projects starting to emerge as people like say I can do crazy things with subclass References is there anyone that would be a good person to talk to about like the potential for I mean not like in the 8.4 release but the ongoing potential for making sure that like picker widgets and stuff like that play nicely with Entity reference Plus some extra Kinds of fields that people are doing we're like what they do would work fine if they could somehow just know I can put my Reference data in there. Well, that sounds like a backwards compatibility questions So to me it's like the mod the authors of those modules on Or of those classes that you're subclassing if they care at all about backwards compatibility and damn they should But if they do then they'll make sure that you can subclass things and they can change things and not break stuff We're all the same method should still be available. I guess I mean like the way right now widgets They have to know explicitly about field types that they can interact with yep unless I mean Unless you like create a subclass version or something like that Maybe I'll just I'll just corner you in like the sprit room or something like that, but it's doable I think especially as D8 continues. I think that's a pattern We're gonna see a whole lot of and it would be cool if the overhead of integrating with special kinds of widgets Got less Arduous So I'm very interested in yeah, we can we can totally go into the weeds on. Thank you. Yeah, absolutely Love hanging out in the weeds So one of the things our client a couple of our clients have been asking for is the ability to Remove images and files from the system Which is not quite as easy yet. Yeah Triple eight wise is is that under this initiative since it's files or is it something else? When you say remove files and images from the system you mean like the physical files from the file system they want they want to be able to delete to delete the the image or the file like on the files tab and Have it be gone Well the thing about I don't think media is really going to be affecting that and the reason I say that is because media is an Abstraction layer above files and stuff and that's really kind of low-level file handling and core I think I mean it may clean it up somewhat and that's because I think files are Under sums like if they're marked a certain way They're like automatically removed on by cron after a certain period or something. Well, there's a file usage Yeah, file usage table exactly Jess might have better answers on this one. Yeah, that's I was just made aware of that issue yesterday like good I mean the thing the reason that might be Okay, no go ahead So there are currently several critical issues where Drupal will delete files for you Even if maybe you didn't want them to be because there's a number of turns out Tracking file usages on a website where you can enter Any kind of HTML and any kind of field anywhere isn't actually it's a very very difficult problem to solve So there are a number of critical issues in the Cork you right now and the solution that we've settled on is probably actually That we are going to stop automatically cleaning up Files give the user the option to to manually remove a file and with like a views bulk operation view potentially and Deprecate the entire concept of file usage tracking. We might show you like we think this file is used in three places But if you delete it Media does also help actually resolve this conceptually in a way because instead of needing to track like a When you use media you've made a choice to embed the media and when you're deleting the media you're deleting the media thing Right, so the media is the only thing using the file and and you you only would run into You at least you wouldn't run into the problem with a like we're not gonna automatically purge your media for you Because you put that on the site for a reason Yeah, so that's that's what the back story is there for people who don't follow the core issue Right issue counter every day of their lives Yeah, so basically it'll help but it's a little bit out of scope for media specifically. Yes My question had to do with the file browser I noticed that you said that it was basically going to be a view which I agree is very a powerful way of approaching it I'm wondering how much thought you put into Turning that into an API instead though so that you can Browse the the content that exists in a dam or some other external system two words entity browser It is very that this is exactly what the kind of thing that any browser was built to solve The module entity browser actually reminds me the most of at the API level and I say this in a nice way is views In the sense that like everything about an entity browser is based on plugins that can do pretty much Whatever you want if you want to like implement integration with a dam or like, you know some kind of special sauce stuff So for advanced cases like that definitely entity browser, okay, and that will continue to be stabilizing and contrived so Yeah, any other questions? Answers complaints No All right, it's Miller time If you want to help with the media initiative, you can come to the contribution sprints on Friday as Adam's gestures just indicated If you've never contributed to core before there is a workshop that will help you Set up your development environment and teach you how to navigate the core issue queue There are mentors sprints where you can work with a group of people to collaborate And finally, there will also be if you're like, I don't need help setting up my development environment You can find Adam at at presumably a media initiative sprint and help