Media list - audio/video downloads
The media list custom page type allows you to create a playlist of audio or video files that can be played and also downloaded* (Downloads not available with all plans).
In a media list, when an app user clicks a list item, the media player opens up to play the file. If the file is downloaded, it can be played while offline.
File types supported: .mp3, .m4a, .mov, .mp4
To create a media list, first setup your media in WordPress. Next, add the media list custom page in your app and rebuild.
1. Setup the Media in WordPress
First, login to your WordPress site, and visit the AppPresser => Settings page.
Under Media Post Types, select the post types you will use in your media list. For example, podcasts, or posts.
Next, you need to add the media urls for the app. Visit a post that you want to show in your media list, and scroll down to the AppPresser Media URL meta box. Enter the full url of the media file and save.
Do this for each post you want in your media list. Only posts that have this media url will show up in the app.
If you have a lot of media and you don't want to do this manually, see the advanced setup below.
You can add AppPresser Media URLs programatically using the appp_media_url post meta field.
If you have existing media, you just need to loop through your posts and save the media url in the appp_media_url post meta field.
Depending on your setup, that would look something like this:
You would need to run that code one time inside a plugin, you do not need to leave it active.
2. Create Media List Custom Page
After you have setup your media posts, it's time to add them to your app.
Visit your app customizer, and click Custom Pages => Add New.
Choose the Media List.
Enter a title, and the WP-API route to your media posts. For example, if you are using normal posts in a specific category, you would put:
You could also use a custom post type, or any other API route to your posts. Remember that only the posts that have the appp_media_url post meta field will show up in your media list.
Choose whether you'd like to allow downloads, and add the name of custom icons if you like. The default icons are "play" and "download." You can also choose to show the post featured image on the left side instead of the play icon.
Save, add the page to your menu, and rebuild your app.
You'll need to install your app on a device to test out the download functionality, but playing media will work in the browser.
Add an Image
To add an image inside the media modal while the media is playing (for example album artwork) you can add an appp_media_image meta field like this: https://gist.github.com/scottopolis/f0a8954179dc4699018274b2cc1efda4