0

I am a Rails newbie and trying to code a rails website which one can upload a video and edit it ofcourse.

At first, I follow Rails example and successfully upload a video, very nice.

My problem is, I make an edit button, like this button.Update button

I upload some videos to wistia.com, and paste the words after medias to video. For example, the link is https://anhbui2904.wistia.com/medias/6ixv9su5ii then I copy and paste 6ixv9su5ii to the blank video

What I want is, when I push the update course, the video will change. But nothing changed.

Here is my code at app/views/courses/show.html.erb

  <div class="card-image">
    <iframe src="//fast.wistia.net/embed/iframe/avk9twrrbn" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen width="100%" height="349"></iframe>
    <script src="//fast.wistia.net/assets/external/E-v1.js" async></script> 
  </div>

I used this code to display a video.

Could you please give me some ideas? Thank you very much.

nathanvda
  • 49,707
  • 13
  • 117
  • 139
nguyencuc2186
  • 21
  • 1
  • 6
  • Should that url not be a public url? I am unable to see the video, this might be the reason you are not seeing it either? (it seems now it is only visible to the owner of the video or logged in users on wistia?) – nathanvda Nov 26 '19 at 09:26
  • @nathanvda sorry for the link, I update the link and I think that my url is a public url ? Any idea for me ? – nguyencuc2186 Nov 26 '19 at 10:53
  • Show some more code: how do you save the video-field? Is it saved correctly? Is the shown code for `show.html.erb` exact, or did you show the rendered html? Please show us the contents of the `show.html.erb` view (because now the video url seems hardcoded). – nathanvda Nov 26 '19 at 11:17
  • Please share your controller and model and also the saving logs from the rails log file (from the log folder) – ZedTuX Nov 26 '19 at 13:17
  • @nathanvda I thought that the rest of the code of `show.html.erb` was not important so I did not show them, but here are they, I uses them to show an image. `
    <%= image_tag ("courses/1.png"), class: "img-responsive"%>
    <%= @course.title %>

    <%= @course.description %>

    `
    – nguyencuc2186 Nov 26 '19 at 14:03
  • This question looks very similar: https://stackoverflow.com/questions/34306805/rails-how-to-embed-a-wistia-video-dynamically-through-a-form – nathanvda Nov 26 '19 at 15:19

1 Answers1

0

In your show.html.erb you now have url hard-coded, you should make sure the src uses your @course.video field. You could do this as follows:

<iframe src="//fast.wistia.net/embed/iframe/#{#course.video}" allowtransparency=...
nathanvda
  • 49,707
  • 13
  • 117
  • 139
  • thank you for your comment. I changed my code just from `avk9twrrbn` to `#{#course.video}"` and still can not post my video, here is my page when I changed it. Any ideas for me? – nguyencuc2186 Nov 27 '19 at 02:25