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

Regex for auto-detecting filetype by inspecting the video url is broken #14

Open
sattes-faction opened this issue Jan 14, 2014 · 3 comments
Labels

Comments

@sattes-faction
Copy link

I'm not quite sure if this is a bug or misconfiguration on my site but I've ran into the following problems:

I'm having a video element like this one:

    <video width="560" height="315" controls poster="https://media.example.com/videos/video_standbild_560x315.jpg">
      <source src="https://media.example.com/videos/video_560x315.mp4" type="video/mp4">
    </video>

Which I'm initializing with these options:

{
  autoplay: true,
  volume: 0.8,
  platforms: ['flash']
}

So, basically I want to limit it to a specific platform, 'flash' in this example (any other would produce the same error, though). Projekktor fails in that case with an error message in line 2680 (function _getTypeFromFileExtension).

The problem is that the regex in the try/catch block before this line ALWAYS fails (at least in my case). The regex never returns a proper result because the function parameter url is not a string but an array. This then always sets fileExt='NaN' in the catch block. This file extension is not part of the extTypes array and so an error is thrown.

I just found out that the file extension "NaN" exists if you don't limit the platforms and therefore this error does not popup though the regex fails here, too.

Can someone confirm this?

@rwlodkowski
Copy link
Collaborator

You must always add 'browser' to the platforms array. So no matter what the config must look like:

{
platforms: ['browser', <any_other_platorms> ]
}

Probably it could be always added by default no matter of user setting.

@sattes-faction
Copy link
Author

Yeah, thanks - this works now. Would be a good idea to add it by default in order to avoid this pitfall. But is the regex functioning properly? I was somewhat confused it always returns NaN in my cases. But maybe I just did not look close enough.

@rwlodkowski
Copy link
Collaborator

As I know the regex functionality is broken. I will try to sort it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants