Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Example: Browser video streaming broken #1422

Closed
0x-r4bbit opened this issue Jul 5, 2018 · 10 comments
Closed

Example: Browser video streaming broken #1422

0x-r4bbit opened this issue Jul 5, 2018 · 10 comments
Labels
exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) P2 Medium: Good to have, but can wait until someone steps up

Comments

@0x-r4bbit
Copy link
Contributor

  • Version: c01a83a
  • Platform: Darwin slotmachine-3002.local 17.6.0 Darwin Kernel Version 17.6.0: Tue May 8 15:22:16 PDT 2018; root:xnu-4570.61.1~1/RELEASE_X86_64 x86_64
  • Subsystem: js-ipfs

Type: Bug

Severity: Medium/Low

Description:

In latest master (c01a83a at the time of creating this issue), the browser-video-streaming example is broken and throws with:

index.js:93 Uncaught TypeError: stream.on is not a function
    at index.js:93
    at pull.collect (files.js:290)
    at reduce.js:10
    at drain.js:20
    at filter.js:17
    at map.js:19
    at next (index.js:22)
    at index.js:39
    at Array.<anonymous> (index.js:10)
    at next (index.js:26)

First I thought it might've been related to Chrome, as this is an HLS example, so I tried it with Safari. That one doesn't work either.

Steps to reproduce the error:

Simply following the example instructions:

  • $ serve .
  • Opening the browser on localhost:
  • Check console
@alanshaw
Copy link
Member

alanshaw commented Jul 5, 2018

@PascalPrecht thanks for reporting - did you find issues with any of the other examples?

@alanshaw
Copy link
Member

alanshaw commented Jul 5, 2018

@alanshaw alanshaw added kind/bug A bug in existing code (including security flaws) exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue P2 Medium: Good to have, but can wait until someone steps up labels Jul 5, 2018
@0x-r4bbit
Copy link
Contributor Author

Have been through a couple other examples, not all of them yet as I had to do some other work.

I'll take a look at the hlsjs-ipfs-loader thing.

@alanshaw
Copy link
Member

alanshaw commented Jul 5, 2018

Since that's an external dependency I think it would be more valuable to continue through the examples and come back to it later.

@0x-r4bbit
Copy link
Contributor Author

Gotcha!

@0xall
Copy link
Contributor

0xall commented Jul 6, 2018

I builded the hlsjs-ipfs-loader (https://github.com/moshisushi/hlsjs-ipfs-loader) and tested it, but it works well. I found that the recent version of it works well.

@0x-r4bbit
Copy link
Contributor Author

@seungwon-kang are you saying you couldn't reproduce the bug in the version of the issue?

@0xall
Copy link
Contributor

0xall commented Jul 6, 2018

@PascalPrecht It was already issued before (pgc-13/hlsjs-ipfs-loader#1), so the maintainer fixed the issue and published the new version (0.1.2).

In the getFile function in version 0.1.1(https://unpkg.com/hlsjs-ipfs-loader@0.1.1/dist/index.js),

...
ipfs.files.cat(hash, function (err, stream) {
      console.log("Received stream for file '" + rootHash + "/" +
        fileName + "'")
      if (err) return callback(err)
      stream.on('data', function (chunk) {
        console.log("Received " + chunk.length + " bytes for file '" +
          rootHash + "/" + fileName + "'")
        bufView.set(chunk, offs)
        offs += chunk.length
      });
      stream.on('error', function (err) {
        callback(err, null)
      });
      stream.on('end', function () {
        callback(null, resBuf)
      });
    })
...

error occurs in stream.on because stream variable is from ipfs.files.cat function, so stream is buffer instance.

@0x-r4bbit
Copy link
Contributor Author

Ah, perfect! Thanks for clarifying!

@daviddias
Copy link
Member

Fixed with #1427

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) P2 Medium: Good to have, but can wait until someone steps up
Projects
None yet
Development

No branches or pull requests

4 participants