-
Notifications
You must be signed in to change notification settings - Fork 0
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
VAST Player #14
Conversation
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", |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/players/index.js
Outdated
@@ -24,4 +25,5 @@ export default [ | |||
UstreamLive, | |||
FilePlayer, | |||
Iframe, | |||
] | |||
VAST, |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non issue anymore
webpack.config.babel.js
Outdated
@@ -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') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this doing?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
webpack.demo.babel.js
Outdated
@@ -12,7 +12,7 @@ export const minifyPlugins = [ | |||
sourceMap: true, | |||
comments: false, | |||
mangle: { | |||
except: [ 'ReactPlayer' ] | |||
except: ['ReactPlayer', 'maestro-videojs-vast'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not mangle?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
src/players/VAST.js
Outdated
width: '100%', | ||
}; | ||
return ( | ||
<div data-vjs-player style={style}> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
src/players/VAST.js
Outdated
|
||
render() { | ||
const style = { | ||
...this.props.style, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why you overwriting styles?
There was a problem hiding this comment.
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
src/players/VAST.js
Outdated
}; | ||
|
||
const removeListeners = () => { | ||
this.player.off('adsready', this.props.onReady); |
There was a problem hiding this comment.
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?
src/players/VAST.js
Outdated
const removeListeners = () => { | ||
this.player.off('adsready', this.props.onReady); | ||
this.player.off('adstart', onAdStart); | ||
this.player.off('play', this.props.onPlay); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignore webstorm config files
src/players/VAST.js
Outdated
import { callPlayer } from '../utils'; | ||
import createSinglePlayer from '../singlePlayer'; | ||
|
||
const PLACEHOLDER_VIDEO = 'https://storage.googleapis.com/maestro_video/blank.mp4'; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
webpack.config.babel.js
Outdated
{ | ||
test: /\.(eot|woff|woff2|svg|ttf)([\?]?.*)$/, | ||
loader: 'file-loader', | ||
include: [VIDEOJS_VAST] |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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]>
Signed-off-by: Steven Anderson <[email protected]>
src/players/VAST.js
Outdated
import createSinglePlayer from '../singlePlayer' | ||
import { FilePlayer } from './FilePlayer' | ||
|
||
const MATCH_URL = /^(https?:\/\/)?((bs\.serving-sys\.com)|(pubads\.g\.doubleclick\.net))/ |
There was a problem hiding this comment.
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
src/players/VAST.js
Outdated
callPlayer = callPlayer; | ||
|
||
createSourceFiles (mediaFiles = []) { | ||
return mediaFiles.reduce((arr, {fileURL: src, mimeType: type}) => { |
There was a problem hiding this comment.
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 })
);
src/players/VAST.js
Outdated
width: width === 'auto' ? width : '100%', | ||
height: height === 'auto' ? height : '100%' | ||
} | ||
if (!sources.length) return null |
There was a problem hiding this comment.
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;
src/players/VAST.js
Outdated
return ( | ||
<div onClick={this.onAdClick} style={wrapperStyle}> | ||
<FilePlayer | ||
{...this.props} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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} |
There was a problem hiding this comment.
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}
There was a problem hiding this comment.
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) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also not changing this
Signed-off-by: Steven Anderson <[email protected]>
Signed-off-by: Steven Anderson <[email protected]>
There was a problem hiding this 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.
There was a problem hiding this 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not ooops
There was a problem hiding this 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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no semi?
src/players/VAST.js
Outdated
import createSinglePlayer from '../singlePlayer' | ||
import { FilePlayer } from './FilePlayer' | ||
|
||
const MATCH_URL = /^(https?:\/\/)?((bs\.serving-sys\.com)|(pubads\.g\.doubleclick\.net))/i |
There was a problem hiding this comment.
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) => { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
src/players/VAST.js
Outdated
|
||
// Inform ad server we can't find suitable media file for this ad | ||
vast.util.track(ad.errorURLTemplates, { ERRORCODE: 403 }) | ||
onEnded() |
There was a problem hiding this comment.
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]>
src/players/VAST.js
Outdated
callPlayer = callPlayer; | ||
|
||
createSourceFiles (mediaFiles = []) { | ||
return mediaFiles.map(({fileURL: src, mimeType: type}) => ({src, type})) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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]>
src/players/VAST.js
Outdated
// todo: add skip functionality | ||
skip () { | ||
const {props: {onEnded}, state: {tracker}} = this | ||
tracker.skip() |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
No description provided.