Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Summernote youtube iframe code does not show video on Android WebView #3252

Closed
vzamanillo opened this issue May 24, 2019 · 3 comments
Closed

Comments

@vzamanillo
Copy link

vzamanillo commented May 24, 2019

Hi!

I am trying to show a summernote code from database with a youtube embedded video into an Android WebView but looks like the WebView needs the URL scheme to load and show it.

$video = $$1('<iframe>')
    .attr('frameborder', 0)
    .attr('src', '//www.youtube.com/embed/' + youtubeId + (start > 0 ? '?start=' + start : ''))
.attr('width', '640').attr('height', '360');

What is the reason to ommit the scheme when adding the attribute?

My first idea was to modify the code but I can not because I do not use the library directly (I am using the summernote-rails (0.8.8.0) gem), is there any method to modify the content of the attribute after adding the video? I have searched through the callbacks to use it in the initialization of summernote and modify the src attribute but I have not found any and I can not think of any way to address it. Any ideas?

Thanks.

@DennisSuitters
Copy link
Member

I wasn't able to replicate the issue, so I'm hoping this has since been resolve with the newer versions of Summernote. If it's still an issue, please reopen, or create a new issue.

@phipps73
Copy link

phipps73 commented Nov 6, 2019

This is still an issue on latest release of summernote. When adding a video url e.g https://www.youtube.com/embed/mC38ch0DunE via the Video toolbar dialog the resultant html added removes the protocol so your html has //www.youtube.com/embed/mC38ch0DunE. When you then try and load the html into a webview in an iOS or Android app the protocol is then incorrectly specified and the video doesn't display. Recommend switch to https as most sites should now be using https anyway.

@eslym
Copy link

eslym commented Aug 4, 2021

this issue exists in the current latest release of summernote (v0.8.18), any updates?

i guess adding a callback would temporary solve this problem

{
    onChange: function(contents, $editable) {
        $editable.find('iframe[src^="//"]').each(function(){
            $(this).attr('src', 'https:' + $(this).attr('src'));
        });
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants