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

Output appendChild problem #23

Closed
atmoner opened this issue Jan 23, 2017 · 3 comments
Closed

Output appendChild problem #23

atmoner opened this issue Jan 23, 2017 · 3 comments

Comments

@atmoner
Copy link

atmoner commented Jan 23, 2017

In this problem, I want use WebTorrent with the example given here: HTML example with status showing UI
I have a little problem with the library 'render-media'

TypeError: Cannot read property 'appendChild' of null

problem

This is the only problem I encounter since when I comment on this line:

  torrent.files[0].appendTo('#output')

All work perfectly
problem2

If you have an idea about the problem.
Thanks for your work 👍

@feross
Copy link
Owner

feross commented Jan 23, 2017

This issue is probably caused by you putting the script in the <head> of the page instead of at the very end, right before the closing </body> tag.

The code is running and looking for the html element with the ID of "output" and not finding anything.

@feross feross closed this as completed Jan 23, 2017
feross added a commit to webtorrent/webtorrent that referenced this issue Jan 23, 2017
To fix confusion about where the <script> tag should be added. It
belongs right before </body>, not in the <head>.

Prompted by this issue: feross/render-media#23
@atmoner
Copy link
Author

atmoner commented Jan 23, 2017

I have done exactly the same as updating your get-started.md and I always get the same error!
Moreover it seems to me that the lack require of webtorrent after <script> in your get-started.md

var WebTorrent = require('webtorrent')

I will try with videostream or mediasource (Or if you have any other to advise me)

josephfrazier pushed a commit to webtorrent/webtorrent that referenced this issue Jan 24, 2017
To fix confusion about where the <script> tag should be added. It
belongs right before </body>, not in the <head>.

Prompted by this issue: feross/render-media#23
@feross
Copy link
Owner

feross commented Jan 25, 2017

var WebTorrent = require('webtorrent') is not required because the bundled JS version of WebTorrent puts itself on the window. Can you link to a complete example of your code?

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

No branches or pull requests

2 participants