AxisCommunications / locomote-video-player

Media Player in Adobe Flash with RTSP support. (THIS PROJECT IS NO LONGER MAINTAINED)
BSD 3-Clause "New" or "Revised" License
133 stars 79 forks source link

Webpack Angular2 TS and load Player from relative URL #172

Closed mburger81 closed 4 years ago

mburger81 commented 8 years ago

Hi, I try to load your player in an angular2 component using angular2 webpack starter project.

The thing is, I need to load the Player and the locomoto.min.js realtive from the plugin directory.

var Locomote = require('./assets/js/locomote.min.js');
.....
    ngOnInit() {
        this.locomote = new Locomote('player', './assets/swf/Player.swf');
.....

loading the minified javascript works but after then load the Player.swf relative from the component path does not work.

http://localhost:3000/assets/swf/Player.swf 404 (Not Found)

I think it is nit a Locomote problem or?

gaetancollaud commented 8 years ago

Hi,

I successfully used locomote with Angular2 and Typescript. I think your test server is not serving the SWF file correctly.

mburger81 commented 8 years ago

@gaetancollaud Hi I know how to serve the SWF file correctly but the problem is, I want to set the path no with the absolute path!

My file strcture is this one:

/src/app/components/player/la-player.components.ts (my component)
/src/app/components/player/assets/swf/Player.swf (my needed SchockwavePlayer)

if i copy the Player.swf under /src/assets/locomote/swf/Player.swf and load Locomote in this way new Locomote('player', 'assets/vendors/locomote/swf/Player.swf'); everything works fine, becouse http://localhost:3000/assets/vendors/locomote/swf/Player.swf' finds the file copied under/src/assets!

But I need to create a dynamic loaded component extracted from my rest app, it should life alone, so my Player.swf should be in a local folder of the component and I want to load the player from the relative path where my component is and not from /src/assets but from ./assets/

gaetancollaud commented 8 years ago

Ok, I see your problem. I don't know how requirejs work, but maybe you can find the path directly from it.

mburger81 commented 8 years ago

Do you think the problem is requirejs? Because I don't use requirejs toa load the Player.swf ... but I pass the RELATIVE URL to Locomote!

gaetancollaud commented 8 years ago

RequireJS is able to find the final url. Maybe you can use it to get the url of your current component to define the final url of the SWF (but I have no idea if that's possible, I'm just guessing)