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

Render video & audio #1798

Merged
merged 111 commits into from
Jun 25, 2019
Merged

Render video & audio #1798

merged 111 commits into from
Jun 25, 2019

Conversation

twinlensreflex
Copy link
Contributor

@twinlensreflex twinlensreflex commented May 28, 2019

Resolves #134

Overall change:

Render video in storybook

Code changes:

  • Added the SMP to simorgh in the video container and component
  • Temporarily styled it
  • Changed video props to better reflect real data

If you can't see videos locally, please follow these instructions to update your local hostnames https://github.com/bbc/simorgh/blob/latest/README.md#changing-request-location

Then, run npm run storybook and visit http://localhost.bbc.com:9001/?path=/story/video-container--video-clip-with-guidance-with-caption


  • I have assigned myself to this PR and the corresponding issues
  • Tests added for new features
  • Test engineer approval
  • I have followed the merging checklist and this is ready to merge.

@twinlensreflex twinlensreflex self-assigned this May 28, 2019
@twinlensreflex twinlensreflex added articles-av-epic Current focus for the articles features stream ws-articles Tasks for the WS Articles Team labels May 28, 2019
@twinlensreflex
Copy link
Contributor Author

nfl/react-helmet#419

@twinlensreflex
Copy link
Contributor Author

twinlensreflex commented May 31, 2019

(note: don't forget to change your url from localhost to local.bbc.co.uk

Currently none of the videos are loading, with a 1052 content not available on this device error

I haven't yet been able to figure out why.
What I have done:

  • Using the new reference for video test items I copied the videos from the json and tried to use that in the fixtures for storybook. There were slight differences in the data but it didn't make any difference, I still got the same error.
  • to be continued. . .

src/app/components/Video/index.jsx Show resolved Hide resolved
<div>statsDestination: {statsDestination}</div>
<div>uiLocale: {uiLocale}</div>
</div>
<GridItemConstrainedLargeNoMargin>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arbitrarily chose this grid item but I'm assuming we want some logic around this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The grid item should be moved into the container /containers/Video/index.jsx, rather than being in the component.
This is so that others can use the Video component without our specific page layout requirements.

@@ -51,6 +51,24 @@ const VideoContainer = ({ blocks }) => {
},
];

// prettier-ignore
Copy link
Contributor Author

@twinlensreflex twinlensreflex May 31, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to have prettier-ignore here or prettier will add trailing ,s to the settings which aren't valid json and break the mediaplayer when passed in like that

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to add this as a comment, so the prettier ignore won't be accidentally removed.

{`
function initialiseRequires() {
requiredScripts = {
"bump-4":"//emp.bbci.co.uk/emp/bump-4/bump-4"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was requiring jquery here too, based on the SMP embedding docs saying you would need it if you don't have Barlesque on the page.
however jquery isn't needed for bump 4

`}
</script>
<script
onLoad="initialiseRequires()"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This onLoad chaining, along with mediaPlayerSetup(); on line 100 is to get around the asynchronicity of script loading in helmet.
React-helmet team have their own solution in the comments of this issue and I started to try to use it but as the example SMP embedding code which I've used here is designed to be run client side I chose the multi-script tag and onLoad chaining approach.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great investigation here. 👍

@oluoluoxenfree
Copy link
Contributor

This works as is if I use a pid from the SMP cookbook rather than our (Optimo I assume?) assets; are these videos not available on test?

@oluoluoxenfree
Copy link
Contributor

It turns out the way we've configured the player only works for live videos, currently investigating how to make it work for test/local assets

@oluoluoxenfree
Copy link
Contributor

updated this to address issues @jamesbrumpton found:

  • Portrait image placeholder updated; is still currently the wrong size but this should be addressed in Layout fix for vertical video #1939
  • Timestamp needs to match the duration of the video; fixed
  • Placeholders for audio files now work

@jamesbrumpton
Copy link
Contributor

Currently, the captions on the video are set, by default, to OFF. However, after having spoken with @jimjohnsonrollings , these need to be set to ON.

duration,
kind,
},
],
},
Copy link
Contributor

@sareh sareh Jun 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To address the subtitle issue raised by James, it should be sufficient to add these properties to the mediaPlayerSettings object:

ui: {
    subtitles: {
      defaultOn: true,
    },
    locale: {
      lang: 'en-GB',
    },
  },

edited: to make defaultOn true.

const renderCaption = (block, type) =>
block ? <Caption block={block} type={type} /> : null;
const renderCaption = block =>
block ? <Caption block={block} type="image" /> : null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What the reason this has been hardcoded to "image"?

The type was previously passed to Caption container, then to chooseOffscreenText which switched between which type of offscreen text to use for each service.

Copy link
Contributor

@oluoluoxenfree oluoluoxenfree Jun 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sareh suggested that because it's a choice between "video caption" and "image caption" and 'caption' that it makes sense to do there, but I may have misunderstood her suggestion.

Are there other types of caption potentially?

@pjlee11

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The switching logic makes sense in Caption container, that isn't what I'm questioning. What I'm pointing out is that Figure container which calls Caption container is now hardcoded to the string "image" meaning that any use of Figure container is now explicitly getting the image offscreen text, rather than the type it gets passed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pjlee11 - @oluoluoxenfree has updated it now to move the declaration of type to the Image/Video containers.

subtitles: shape({
defaultOn: bool.isRequired,
}).isRequired,
local: shape({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
local: shape({
locale: shape({

@jamesbhobbs jamesbhobbs merged commit abb83d3 into latest Jun 25, 2019
@jamesbhobbs jamesbhobbs deleted the render-video branch June 25, 2019 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
articles-av-epic Current focus for the articles features stream high-priority ws-articles Tasks for the WS Articles Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Render Video
7 participants