One of my goals this year, aided by the inimitable Chris Lema, was to make an Amazon Echo app.

There’s a lot more to the whole plan, but I want to start with the simple stuff first. So the very first step is that I want to make a “Flash Briefing” app. That will allow people to get the latest posts from my site.

For the most part, this is trivial. Creating a Flash Briefing Skill is fairly well documented and essentially is this:

  1. Make an account
  2. Create a Skill
  3. Point it to your RSS feed
  4. Give it an icon

And that works great. Unless, of course, you have videos in a post.

You see, when I went to add my RSS feed, I got this rather useless error:

Error: Item [https://example.com/?p=9619] doesn't contain a valid Stream Url. Video Url (if present) must be accompanied with a valid Stream Url in an Item.

What Went Wrong?

The error was caused by having a video in a post. Now, I need to stress the stupidity here. I have a video inside the post. It’s not a video post, it just has an embedded video because it was contextually needed.

Logically I googled the error and came up empty. This did not surprise me. I’ve been resigned to learn that Amazon is not actually very helpful with their UX or error messages. I’m not sure why this is but their tech UX, the stuff made for developers not the devices made for end-users, tend to be incredibly poorly designed and ill documented for new people.

That said, I understood the error was reflecting on a ‘video’ URL, and I had a video in that specific post. I removed the video, tested, and it worked. Ergo the error was caused by the video’s existence. But as it happened, Stream URL had nothing to do with it.

It Was Elements

The real issue was found when I read through the feed format details which had mention of a need, for audio content, an “URL specifying the location of audio content for an audio feed.”

This wasn’t an audio file, but the example for a JSON feed was to include a “streamUrl” value. Oh. And for RSS? An “enclosure element with type attribute set to audio/mpeg”

This had to be related.

When I looked at my RSS feed, however, I saw this:

<enclosure url="https://example.com/path/to/myvideo.mp4" length="3120381" type="video/mp4" />

Wasn’t that what I needed?

A Second Enclosure

Apparently the flash briefing RSS code is stupid and thinks that any enclosure has to have the “audio/mpeg” type. So how do I add in this?

<enclosure url="https://example.com/path/to/myvideo.mp4" length="3120381" type="audio/mpeg" />

By the way yes I reported this to them as a bug. Anyway, the first attempt at fixing this was for me to add a new custom post meta for the enclosure like this:


3120381
audio/mpeg

That auto-added the proper enclosure code because WordPress knows what it’s doing. Once I was sure that worked, I filed the full bug report and then went the other way.

Remove The Enclosures

This is not something I generally recommend. However if you’re not podcasting or vlogging and you have no need to encourage people to download your videos and media via RSS, then you can get away with this:

function delete_enclosure(){
    return '';
}
add_filter( 'do_enclose', 'delete_enclosure' );
add_filter( 'rss_enclosure', 'delete_enclosure' );
add_filter( 'atom_enclosure', 'delete_enclosure' );

That removes the enclosure code.

Build Your Own

Another fix would have been to make a JSON output or use something like JSONFeed itself. Or of course I could have auto-duplicated the embeds, but that just felt wrong to me.

Reader Interactions

%d bloggers like this: