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

VAST Player #14

Merged
merged 24 commits into from
Jun 14, 2018
Merged

VAST Player #14

merged 24 commits into from
Jun 14, 2018

Conversation

SJAnderson
Copy link

No description provided.

Signed-off-by: Steven Anderson <[email protected]>
Signed-off-by: Steven Anderson <[email protected]>
Signed-off-by: Steven Anderson <[email protected]>
package.json Outdated
@@ -83,6 +86,8 @@
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.9",
"mocha": "^4.1.0",
"node-sass": "^4.9.0",

Choose a reason for hiding this comment

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

lots of new deps here... anyway we can async load this only for VAST?

Choose a reason for hiding this comment

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

would be good to bundle this all in the maestro-videojs-vast player and async import it maybe

Choose a reason for hiding this comment

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

why on earth do we need this? are we compiling SASS style files? O_o

Copy link
Author

Choose a reason for hiding this comment

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

v1 was, fixing this

package.json Outdated
@@ -103,6 +110,7 @@
"dependencies": {
"deepmerge": "^2.0.1",
"load-script": "^1.0.0",
"maestro-videojs-vast": "0.0.6-alpha",

Choose a reason for hiding this comment

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

can I see this guy?

Copy link
Author

Choose a reason for hiding this comment

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

@@ -24,4 +25,5 @@ export default [
UstreamLive,
FilePlayer,
Iframe,
]
VAST,

Choose a reason for hiding this comment

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

does this work? Iframe returns canPlay true...

Choose a reason for hiding this comment

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

not sure how this type is ever played?

Copy link
Author

Choose a reason for hiding this comment

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

because the regex in Iframe fails on vast URLs

Choose a reason for hiding this comment

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

wait but our iframe player just does return true i thought

Choose a reason for hiding this comment

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

^ this.. not sure how VAST is ever played

Copy link
Author

Choose a reason for hiding this comment

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

non issue anymore

@@ -11,6 +11,7 @@ const PATH_DEMO = join(__dirname, 'demo')
const PATH_SRC = join(__dirname, 'src')
const PATH_INDEX = join(__dirname, 'index.html')
const PATH_TESTS = join(__dirname, 'test', 'specs')
const VIDEOJS_VAST = join(__dirname, 'node_modules', 'maestro-videojs-vast', 'dist')

Choose a reason for hiding this comment

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

what's this doing?

Choose a reason for hiding this comment

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

shouldn't all this just come in from the dependency?

Copy link
Author

Choose a reason for hiding this comment

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

narrows down the files to include in the parsers

@@ -12,7 +12,7 @@ export const minifyPlugins = [
sourceMap: true,
comments: false,
mangle: {
except: [ 'ReactPlayer' ]
except: ['ReactPlayer', 'maestro-videojs-vast']

Choose a reason for hiding this comment

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

why not mangle?

Copy link
Author

Choose a reason for hiding this comment

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

when i mangled it broke

Copy link
Author

Choose a reason for hiding this comment

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

also its already uglified by the webpack in that plugin

width: '100%',
};
return (
<div data-vjs-player style={style}>

Choose a reason for hiding this comment

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

what is this tag for?

Copy link
Author

Choose a reason for hiding this comment

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

from the videojs docs here

wrap the player in a div with a data-vjs-player attribute so videojs won't create additional wrapper in the DOM see videojs/video.js#3856


render() {
const style = {
...this.props.style,

Choose a reason for hiding this comment

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

why you overwriting styles?

Copy link
Author

Choose a reason for hiding this comment

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

i copied and pasted this from youtube or something

};

const removeListeners = () => {
this.player.off('adsready', this.props.onReady);

Choose a reason for hiding this comment

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

does this hit if it doesn't serve?

const removeListeners = () => {
this.player.off('adsready', this.props.onReady);
this.player.off('adstart', onAdStart);
this.player.off('play', this.props.onPlay);

Choose a reason for hiding this comment

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

all this stuff is for the empty mp4 right? we likely want to end if the mp4 starts right?

Copy link
Author

Choose a reason for hiding this comment

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

yeah exactly. naturally videojs and it's ad's plugin will start playing the blank video, but it won't start playing without a video to play (like you can't start videojs with a vast and not a video), however it will try its hardest to start the blank video after the VAST has ended, so this is the hack to get around that.

package.json Outdated
@@ -83,6 +86,8 @@
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.9",
"mocha": "^4.1.0",
"node-sass": "^4.9.0",

Choose a reason for hiding this comment

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

would be good to bundle this all in the maestro-videojs-vast player and async import it maybe

@@ -1,3 +1,4 @@
.idea

Choose a reason for hiding this comment

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

what's this?

Copy link
Author

Choose a reason for hiding this comment

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

ignore webstorm config files

import { callPlayer } from '../utils';
import createSinglePlayer from '../singlePlayer';

const PLACEHOLDER_VIDEO = 'https://storage.googleapis.com/maestro_video/blank.mp4';

Choose a reason for hiding this comment

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

we got a way we have been handling binaries for the App... wonder if it makes sense to use that

Copy link
Author

Choose a reason for hiding this comment

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

i don't know how to do that so i'll need some guidance on adding this

{
test: /\.(eot|woff|woff2|svg|ttf)([\?]?.*)$/,
loader: 'file-loader',
include: [VIDEOJS_VAST]

Choose a reason for hiding this comment

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

why are we doing this? i don't see any eot/woff/svg/etc files in the maestro-videojs-vast repo

package.json Outdated
"html-webpack-plugin": "^2.30.1",
"imports-loader": "^0.8.0",

Choose a reason for hiding this comment

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

don't see this referenced anywhere

Signed-off-by: Steven Anderson <[email protected]>
Signed-off-by: Steven Anderson <[email protected]>
Signed-off-by: Steven Anderson <[email protected]>
Signed-off-by: Steven Anderson <[email protected]>
Signed-off-by: Steven Anderson <[email protected]>
Signed-off-by: Steven Anderson <[email protected]>
Signed-off-by: Steven Anderson <[email protected]>
Signed-off-by: Steven Anderson <[email protected]>
import createSinglePlayer from '../singlePlayer'
import { FilePlayer } from './FilePlayer'

const MATCH_URL = /^(https?:\/\/)?((bs\.serving-sys\.com)|(pubads\.g\.doubleclick\.net))/

Choose a reason for hiding this comment

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

change this to be insensitive:
const MATCH_URL = /^(https?:\/\/)?((bs\.serving-sys\.com)|(pubads\.g\.doubleclick\.net))/i

callPlayer = callPlayer;

createSourceFiles (mediaFiles = []) {
return mediaFiles.reduce((arr, {fileURL: src, mimeType: type}) => {

Choose a reason for hiding this comment

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

Should use a map instead since you are always returning an array with the same element structure:

createSourceFiles = (mediaFiles = []) => (
  mediaFiles.map(({ fileUrl: src, mimeType: type }) => { src, type })
);

width: width === 'auto' ? width : '100%',
height: height === 'auto' ? height : '100%'
}
if (!sources.length) return null

Choose a reason for hiding this comment

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

This can be incorporated into the return:

return source.length ? (
  <jsx here>
) : null;

return (
<div onClick={this.onAdClick} style={wrapperStyle}>
<FilePlayer
{...this.props}

Choose a reason for hiding this comment

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

Are we sure we want to do this? Are there props we do NOT want to pass through?

Copy link
Author

Choose a reason for hiding this comment

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

this is fine

onProgress={this.onProgress}
onReady={this.onReady}
onVolumeChange={this.onVolumeChange}
ref={this.ref}

Choose a reason for hiding this comment

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

This should be changed to createRef:

...
container = React.createRef();
...

ref={this.container}

Copy link
Author

Choose a reason for hiding this comment

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

not changing this

return this.container.getSecondsLoaded()
}

ref = (container) => {

Choose a reason for hiding this comment

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

This can be removed.

Copy link
Author

Choose a reason for hiding this comment

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

also not changing this

stphnlngdncoding and others added 3 commits June 13, 2018 15:22
Signed-off-by: Steven Anderson <[email protected]>
Signed-off-by: Steven Anderson <[email protected]>
Copy link

@kamronbatman kamronbatman left a comment

Choose a reason for hiding this comment

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

I am not sure exactly how to QA this, but the code looks good.

Copy link

@shahrodkh shahrodkh left a comment

Choose a reason for hiding this comment

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

looks good

@@ -74,7 +74,7 @@ class App extends Component {
this.player.seekTo(parseFloat(e.target.value))
}
onProgress = state => {
console.log('onProgress', state)
// console.log('onProgress', state)

Choose a reason for hiding this comment

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

oops?

Copy link
Author

Choose a reason for hiding this comment

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

not ooops

Copy link

@andybarron andybarron left a comment

Choose a reason for hiding this comment

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

small q's

src/Player.js Outdated

// need to send progress to VAST player
if (this.props.activePlayer.displayName === 'VAST') {
this.player.onProgress(progress);

Choose a reason for hiding this comment

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

no semi?

import createSinglePlayer from '../singlePlayer'
import { FilePlayer } from './FilePlayer'

const MATCH_URL = /^(https?:\/\/)?((bs\.serving-sys\.com)|(pubads\.g\.doubleclick\.net))/i

Choose a reason for hiding this comment

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

we're positive this will always work? they may be using different serving... aren't they xml files? could we use /\.xml$/i?

Signed-off-by: Steven Anderson <[email protected]>
Signed-off-by: Steven Anderson <[email protected]>
Signed-off-by: Steven Anderson <[email protected]>
}

load (url) {
vast.client.get(url.slice('VAST:'.length), { withCredentials: true }, (response, error) => {

Choose a reason for hiding this comment

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

this is strange shouldn't this just be 5?

Choose a reason for hiding this comment

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

@cyrdax said it's fine


// Inform ad server we can't find suitable media file for this ad
vast.util.track(ad.errorURLTemplates, { ERRORCODE: 403 })
onEnded()

Choose a reason for hiding this comment

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

this could trigger several times if a liner is not the first one?

Signed-off-by: Steven Anderson <[email protected]>
callPlayer = callPlayer;

createSourceFiles (mediaFiles = []) {
return mediaFiles.map(({fileURL: src, mimeType: type}) => ({src, type}))

Choose a reason for hiding this comment

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

is it possible this could contain empty entries? might de-structure a null right?

Copy link
Author

Choose a reason for hiding this comment

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

addressed

Signed-off-by: Steven Anderson <[email protected]>
Signed-off-by: Steven Anderson <[email protected]>
Signed-off-by: Steven Anderson <[email protected]>
// todo: add skip functionality
skip () {
const {props: {onEnded}, state: {tracker}} = this
tracker.skip()

Choose a reason for hiding this comment

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

this can crash if there is no "linear"

Signed-off-by: Steven Anderson <[email protected]>
// track play
onPlay = (event) => {
const {props: {onPlay}, state: {tracker}} = this
tracker.setPaused(false)
Copy link

Choose a reason for hiding this comment

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

set paused? should this be play?

// track volume change
onVolumeChange = (event) => {
const {props: {onVolumeChange}, state: {tracker}} = this
tracker.setMuted(this.container.muted)
Copy link

Choose a reason for hiding this comment

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

is this mute? or volume change?

@SJAnderson SJAnderson merged commit 4a097b0 into master Jun 14, 2018
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

Successfully merging this pull request may close these issues.

7 participants