chapmanu / signage

Digital Signage Riding on Rails
MIT License
13 stars 6 forks source link

Turn off audio for video preview #181

Closed khafa100 closed 7 years ago

khafa100 commented 7 years ago

Trello Card: https://trello.com/c/uC93HAje

Issue: https://github.com/chapmanu/signage/issues/180

The process I went through before finding my solution for the story is documented in the Issue above. If there's not problems with changing the html to solve this issue, then I feel it's the best solution as it only alters code in a single location and, if desired, the user can unmute the video by mousing over and clicking the icon that becomes revealed underneath.

khafa100 commented 7 years ago

I added the controls muted to background videos after noticing I only did it for foreground videos.

I'm kind of struggling a bit with the test. I know what I want to do: Identify both the foreground and background videos and check that they have controls muted. I also tried assert_includes but I wasn't using it correctly. I'm still working on it but if I could get a hint in the right direction I would appreciate it.

tatwell commented 7 years ago

@khafa100 For controller tests, see:

You'll need to "arrange" to be an admin user and make sure appropriate slide fixtures exists, get the page, then assert the expected attribute is present:

khafa100 commented 7 years ago

I'm still getting an error where it expects to find controls muted but it fails here. Is there a fixture that I'm overlooking or did I set it up incorrectly? Once I know how to do this correctly for video foregrounds I will set it up for video backgrounds as well. I know for sure that assert_select "video" works so I think I'm on the right track.

khafa100 commented 7 years ago

It works now. Please let me know if it can be improved or if I overlooked something.

khafa100 commented 7 years ago

David has asked that videos not be muted on pages ending in \play. I've created a helper that creates a video tag that accounts for this scenario. It works properly except that the src attribute doesn't look in the right location when using video_tag.

According to this link it defaults to looking in the public videos directory. After some investigating I found one possible solution to this:

It is currently producing this as the source:

My question is: Would the above solution theoretically work? If so, where do we store the uploaded videos so that I can direct it to the proper location and test it out? If not, is there another way to solve this? My only other solution that I can think of would be inserting logic into _standard.html.erb which I'd like to avoid.

Update:

I tried adding the following to config/application.rb but it didn't change anything:

config.assets.enabled = true
config.assets.paths << "#{Rails.root}/public/uploads/slide/background"