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

Rewrite to ES6 #38

Closed
wants to merge 16 commits into from
Closed

Conversation

nickygerritsen
Copy link
Contributor

Hi all!

Note: below text was the original text. Now that dash.js 2.0 is released, this PR is no WIP anymore.


This is a WIP to rewrite the whole plugin to use ES6 and browserify.

As a basis I started with the generator in a new directory and just moved code in it until it worked.

There are still some things that need to change and/or that are not working. Some of them I could really use some help with. Remarks:

  • I decided to use dash.js 2.x, which also uses ES6. They say it will be released this month so I don't see a big problem with this.
  • I forked the dash.js repo, so I could push a prerelease version of the ES6 code npm. Thus the plugin now depends on dash-es6-tmp, which we can change back again after dash.js 2.x is final.
  • Although Dash.js is ES6'ified, they still expose MediaPlayer on window and do not export it. It might make sense to create a PR for them to export it in all.js so we can import it and not use window. Agreed?
  • I couldn't find where they moved the DI context to, but it seems they default to {} now. So that's what I'm doing too.
  • I don't know what to do with the spec.js testfile, as I can't seem to find examples on how this is done nowadays.
  • As we are now shipping Dash.js in the javascript file, should we add something to the license somewhere?
  • Then some problems:
    • UglifyJS hangs when --compress is given. No clue why but I have removed it and now it works.
    • If you disable autoplay, an error is displayed and the stream will never play. The original plugin used to hide this error, as it is intended. I copied this, but somehow it is not working anymore. I can't seem to find out why, because it does work when autoplaying. If I manually hide the error and call player.play() the video does not play either. I tried calling play on the mediaplayer and then it does work. Maybe something they changed in the new Dash.js?
    • The BBC video gives a black screen in Safari (OS X 10.11.4). However, it also does this on http://videojs.github.io/videojs-contrib-dash/ so I'm not sure if this is related. I tried another video and that one did work.
    • On the example linked above Chrome switches to a higher resolution almost instantly if I go fullscreen. However on the index.html with npm run start it takes about a minute here. I'm not sure if this is Dash.js related or this plugin.
    • The old source uses useVideoJSDebug and getWidevineProtectionData if they exist, but I can not find anyplace they are defined. So I added them back but no clue what they are for.
    • The old source does a lot of console debug output, but I can't get that to work anymore. Maybe related to useVideoJSDebug?

Although there are quite some problems, I think this is a good beginning for this plugin to become ES6'ified :).

So @forbesjo / @dmlap / @imbcmdth any suggestions for these problems?

@nickygerritsen
Copy link
Contributor Author

Ah I now see the Safari 9 issue has been repoted as #22

@nickygerritsen
Copy link
Contributor Author

The autoplay error is (partly) a bug in Dash.js I believe. I created Dash-Industry-Forum/dash.js#1027 because I could reproduce the problem with only Dash.js.

@nickygerritsen
Copy link
Contributor Author

Hmmm also the quality switching seems to be in Dash.js. I tried the reference player 2.0 (locally) and it also seems to load higher qualities way slower. This already seems to be broken in dash.js 1.6 and I've created an issue for that: Dash-Industry-Forum/dash.js#1028

@misteroneill
Copy link
Member

I haven't had time to look through this PR yet, but it's great that you're working on it - thank you! We'll be sure to look it over and provide help/thoughts ASAP.

@nickygerritsen
Copy link
Contributor Author

Glad to help :)!

@forbesjo
Copy link
Contributor

Awesome thanks for doing this!

@nickygerritsen
Copy link
Contributor Author

Btw #36 is already applied here too, as I accidentally worked of that code. But I guess that's not a big problem because we needed to do that manually otherwise anyway as it will never merge probably.

@nickygerritsen nickygerritsen changed the title [WIP] Rewrite to ES6 Rewrite to ES6 Feb 13, 2016
@nickygerritsen
Copy link
Contributor Author

OK, dash.js 2.0 is released and I've integrated it into this PR.

Although they do not publish on NPM, we can use the tar.gz from the 2.0 release, which I did.

The following problems are still valid:

  • The old source uses useVideoJSDebug and getWidevineProtectionData if they exist, but I can not find anyplace they are defined. So I added them back but no clue what they are for.
  • The old source does a lot of console debug output, but I can't get that to work anymore. Maybe related to useVideoJSDebug?
  • I don't know what to do with the spec.js testfile, as I can't seem to find examples on how this is done nowadays.
  • As we are now shipping Dash.js in the javascript file, should we add something to the license somewhere?

UglifyJS does not hang anymore and all other points where dash.js related and they have fixed these.

So if we can answer the above things I think this PR is good :).

@nickygerritsen
Copy link
Contributor Author

I fixed the merge conflict by rebasing, but it might have did something to 5226706, not sure

@nickygerritsen
Copy link
Contributor Author

I fixed the linting errors, but had to comment out some stuff from karma.config.js

@nickygerritsen
Copy link
Contributor Author

Not sure why the tests fail....
Locally they work

@nickygerritsen
Copy link
Contributor Author

My last pushes add the dash.js license and use a modified dash.js NPM package which does not use index.js as the main file. Using a relative path to dash.all.debug.js breaks when using this plugin as a ES6 module in another module.

I created Dash-Industry-Forum/dash.js#1173 to see whether they want to publish to NPM themselves and/or change the main file.

@nickygerritsen
Copy link
Contributor Author

Another thing I'm having difficulties with now is that I do not know of any way of disabling dash.js debug output.

This can normally be done by calling a method on the mediaplayer after creating it but before initializing it it seems. But not sure how we should handle this then if we want to have this as an option.

@forbesjo
Copy link
Contributor

Looks like you can:

@nickygerritsen
Copy link
Contributor Author

Ah nice, will try this tomorrow :)


# Require firefox 43.0 for MSE
addons:
firefox: "43.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks likes Travis has a latest option https://docs.travis-ci.com/user/firefox/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, is latest always what we want? I can change it then

@nickygerritsen
Copy link
Contributor Author

OK I tried applying the suggestions. However I can not get it to work because somehow things go wrong with sinon...

I have no clue how to fix that.

@gkatsev
Copy link
Member

gkatsev commented Feb 17, 2016

You should pin sinon to 1.14.1 directly, that is, without the ^. That hopefully should fix all sinon-related issues.

@nickygerritsen
Copy link
Contributor Author

OK now I really give up :(

@nickygerritsen
Copy link
Contributor Author

btw dash.js is now published on NPM, so we can replace the tar.gz with a version.
However I saw @forbesjo was trying to fix Firefox, so I'm not sure whether I should push that to this PR?

@forbesjo
Copy link
Contributor

You can keep pushing your changes to this PR while I try to figure out what the issue with Travis/Firefox is.

@ksheurs
Copy link

ksheurs commented Feb 24, 2016

Will this also support Video.js 4.12.15, or only 5.x?

@gkatsev
Copy link
Member

gkatsev commented Feb 24, 2016

This will only support videojs 5.x.

@forbesjo
Copy link
Contributor

@nickygerritsen I've opened a PR (#49) to separate the dash.js API updates from the ES6/browserification.

I think we should not bundle dash.js into the contrib-dash plugin but rather use the global dashjs.

@nickygerritsen
Copy link
Contributor Author

@forbesjo this makes sense. When that is merged I will do some magic in this PR to fix related stuff :)

@forbesjo
Copy link
Contributor

forbesjo commented Mar 9, 2016

@nickygerritsen I've updated this plugin to use dash.js 2.0 and to use browserify in two other PRs, would you be able to rebase this PR?

@nickygerritsen
Copy link
Contributor Author

Yes but probably next week or the week after

* upstream/master:
  Make the browserify shim a dependency
  Added Browserify support
  2.1.0
  Update contrib-dash for dash.js 2.0
@nickygerritsen
Copy link
Contributor Author

OK pushed something that should at least merge everything. My rebase skills are not that good :(

@nickygerritsen
Copy link
Contributor Author

Another option would be to just re-do my changes somewhat manually on top of the current master.

@forbesjo
Copy link
Contributor

I'll grab your changes and do some rebase magic.

@chemoish chemoish mentioned this pull request Mar 23, 2016
@nickygerritsen
Copy link
Contributor Author

Any luck on the rebase?

@forbesjo
Copy link
Contributor

Instead of rebasing (it's a very messy experience), I'll open an ES6 only PR and leave the generatorification for another day. Closing this PR.

@forbesjo forbesjo closed this Mar 28, 2016
This was referenced Mar 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants