Since this module is no longer alpha, it would be great to have some kind of basic instructions about how to use it. I trust that it's great, because almost 8,000 sites are using it, but I cannot for the life of me figure out what I'm supposed to do to get it working, and I've been building sites in Drupal for a decade, so I can't be the only one who doesn't know where to start with this. Help, please?

CommentFileSizeAuthor
#3 D8-Module-Remote stream wrapper2.jpg118.64 KBmartin288

Comments

BenStallings created an issue. See original summary.

benstallings’s picture

Title: Basic instructions for getting started? » How the heck does this (D8) module work?

I have looked over every line of code in the D8 module, and I can't find any indication of how this module is supposed to work... no README, no documentation, and the test function calls something that looks promising: remote_stream_wrapper_file_load_by_uri() -- but that function doesn't exist! Help, please! I would really like to believe that this module does what it says it does, but how? Thank you...

martin288’s picture

StatusFileSize
new118.64 KB

In the last 7 days install/reinstall many time that cloud not find any extension at filefield/imagefield?
Thanks for help!

mathieuhelie’s picture

It doesn't look like it does anything more than expose an undocumented API: #2775507: Create a file field widget for adding remote file URLs

muranod’s picture

Here's what I found which, to my shock, pretty much worked on the first go (I had never written a module.) These particular steps are for serving up a dropbox audio file using the Remote Stream Wrapper and Audio Field modules, along with the Link and File modules already in Drupal core. I know very little beyond this, but it might give you a starting point.

The dropbox link would not serve up the player until I added "?raw=1&t=.mp3" (without the quotes) at the end of the audio link.

http://www.jaypan.com/tutorial/embedded-audio-player-externally-hosted-f...

blakemorgan’s picture

In reference to #4, Using it from an API level is fine. Would someone be able to document the API, though? I'd be willing to do it, but without knowing how the API works in the first place, I can't help. If the API was documented, it would probably allow others to collaborate on making a GUI for this module, therefore getting it released sooner (for D7 and D8).

imclean’s picture

begrafx’s picture

OK, it sounds like quite a few others are in the same boat as me on this one.

I found the jaypan.com reference that @muranod shared, but that's not quite what I'm needing. I'll lay out my situation, and we'll see if we can help each other here.

Here's what I've got: Drupal 8 site, I've got the Remote Stream Wrapper module installed. I have Podcasts (.MP3 files) relating to the site, but they are hosted on a separate server. I have Aggregator set up, and receiving an RSS feed from that host, so anytime I add a podcast on the other server, the RSS updates the D8 site.

So far, so good. However, here's the "problem". The RSS feed, of course gives a list of the podcasts on the other site, complete with links. The problem is, when you click any of the links, it physically takes you to the other site, and uses their player to play the MP3. I don't care for their player, and I REALLY don't want the users being taken to the other site. What I WANT is for the D8 site to use its own player I've installed, and just make the remote call for the file. Should be no problem, and @Jaypan's solution would seem to agree with that fact. The snag I'm hitting is, @Jaypan's solution calls for creating a content type and each mp3 to be added as a separate content entity. This completely defeats the purpose of my bringing them in as an RSS feed. From everything I've seen so far, it seems there is no reason why I shouldn't be able to view the RSS feed, find a podcast I want to hear, click the link, Drupal 8 opens the player and plays the file.

I just can't seem to figure out how to get Drupal 8 to use its own player when one of the RSS feed links is clicked.

Anybody got any ideas?.

imclean’s picture

@BEGRAFX, Remote Stream Wrapper grabs the remote file and downloads it into the Drupal file system, saving an entry in the database. The minimum you'd need to do would be to create a file entity for each mp3 file.

Generally the file entity would be referenced by another entity, either a content type or a media entity (see core's hidden Media module) or something else. If you want people to listen to the podcasts on your website it's probably best to create a media entity which includes a reference to a file entity. You can store file metadata and other information in the media entity.

You could use the Feeds module or something else to create the media entities automatically.

begrafx’s picture

@imclean

OK, thank you for the additional information. Based on what I gathered from reading @jaypan 's article, I was getting a different understanding.

I can't use the Feeds module, as (at least last I looked) it didn't yet exist for D8.

I know this can be done. I've seen basically the same thing done with YouTube videos. The Drupal site doesn't have to download them into the file system, it just connects with YouTube and plays the video. I'll dig deeper into the Media and Media entity side of things, see what I can figure out.

imclean’s picture

@BEGRAFX Interesting, the project page states Remote Stream Wrapper "Provides the ability to use external files with file fields without saving the files to your local files directory."

I've used it with Remote stream wrapper widget and the files were downloaded to the local files directory.

begrafx’s picture

I checked and there is now a D8 version of the Feeds module. I picked it up, but it is a dev version, so no documentation, and the D7 docs and videos I've found are different enough from what I find in the D8 dev version, that I'm basically guessing my way along.

imclean’s picture

There are a few D8 modules where it's best to use the dev version. Full releases aren't always that up to date.

Regarding my previous comment #11, "local file system" could be referring to the local computer's file system rather than Drupal's.

begrafx’s picture

Agreed. I'm looking at all the options, trying to figure out what the best way to handle this is.

begrafx’s picture

OK, so far I haven't found any better option. Re-reading comments here, so does the Remote Stream Wrapper Download the file so that a local player can play the Podcast or Video, and the discards it?

What I am wanting, I have the RSS feed of podcasts for a site, however clicking the link takes the user to the remote site and uses their player. I would prefer not to leave the site, and I don't care for the remote site's player. So I'd like to use a D8 player to play the podcast. It sounds like using Remote Stream Wrapper would allow me to do this. Am I correct?

selwynpolit’s picture

How to use Remote Stream Wrapper module and it’s essential cousin Remote stream wrapper widget

You should first enable the media contrib module (and for a really nice experience, add the media library module)

Enable Remote stream wrapper and remote stream wrapper widget on your Drupal 8 site

Create a new media type called Remote Image:

Navigate to /admin/structure/media and select +Add media type button

Fill out the fields:
Name: Remote Image
Description: Remotely hosted image using Remote Stream wrapper
Media source: Image
Media source configuration: select media.image
Click save

On the next screen (url /admin/structure/media)
Click edit on the right side of your Remote Image media type
Next to + Image, drop down the widget and select: Remote stream wrapper
Click save

Click Manage display tab at top
Drag +Thumbnail under the Disabled label (to make it no longer display each time)
Click the gear to the right of image:
Click save

Fill out the form:
Image style: select None (original image)
Link image to: Nothing
Note. Later, you could select a different image style here if you like.
Click save button

You can add media now by navigating to /admin/content/media
click +Add media
Click Remote Image
Fill out the form with this example
Name: gutter
Image: https://image.shutterstock.com/image-photo/rain-flows-down-roof-450w-108...
Click Save.
The image will appear in the listing. You will be able to select this image below.

Now add a field for your image. Instead of specifying a field of type “image” rather specify an "entity reference field."

Here are the steps to add a field to an existing content type:

From the manage fields url: /admin/structure/types/manage/remote1/fields
Click + Add field

Select field type: (under reference) select Media
Label: Picture
Limited: 1. (you can always change this later if you want more than 1 pic on each node)
Click Save field settings
On the next screen under reference type, select Remote image checkbox

Click Save Settings

Now add a node of your content type that you used above.
The picture field will appear with a browser media and add media button. Select browse media, click the gutter image you created above and click select media.

Click Save to save your node
Now you have successfully added a remote image to your node. You should be able to view the node and see your image displayed.

I hope this helps folks.

rwilson0429’s picture

Thanks @selwynpolit, the steps you outlined worked for me. I did have to make one adjustment, however.

I had to select the Remote Stream wrapper widget from the Manage Form Display, /structure/media/manage/remote_image/form-display, of the Remote Media Image type.

I created a very rough documentation page that outline these steps at https://www.drupal.org/docs/8/modules/remote-stream-wrapper. Hopefully someone will improve the outline and correct any mistakes or inaccurate assumptions I made trying to document this process.

dave reid’s picture

I have started working on merging some of the extra modules back into this module, I would have happily reviewed them as patches.
#3066732: Provide field widget
#3066734: Provide entity browser widget
#3066735: Provide file field sources plugin
#3066736: Provide a media type plugin

2dareis2do’s picture

Thanks @selwynpolit and @rwilson0429. There should be link to documentation on the landing page https://www.drupal.org/project/remote_stream_wrapper

muldos’s picture

Hi,
I'm starting using this module and just found this documentation.
I have a question : why does the media source 'Image' has to be a reference to a media of type image ? Why can't it just be a standard Image ?
Thanks in advance for your answer.

Kind regards

David

benstallings’s picture

Status: Active » Closed (outdated)

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.