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

Angular 4: "this.player.markers is not a function ..." #90

Open
alandelpiccolo opened this issue May 31, 2018 · 4 comments
Open

Angular 4: "this.player.markers is not a function ..." #90

alandelpiccolo opened this issue May 31, 2018 · 4 comments

Comments

@alandelpiccolo
Copy link

alandelpiccolo commented May 31, 2018

Greetings,
trying to test markers within an Angular app.

HTML:

<video #myvideo1 id="my_video_1" class="video-js vjs-default-skin" width="640px" height="267px"
      controls preload="none"
      data-setup='{ "aspectRatio":"640:267", "playbackRates": [1, 1.5, 2] }'>
    <source src="https://vjs.zencdn.net/v/oceans.mp4" type='video/mp4' />
    <source src="https://vjs.zencdn.net/v/oceans.webm" type='video/webm' />
  </video>

TS:


import { VideoService } from './video.service';

@Component({
  selector: 'app-videos',
  templateUrl: './videos.component.html',
  styleUrls: ['./videos.component.sass']
})

export class VideosComponent implements OnInit, OnDestroy, AfterViewInit {

//unrelated code

videoJSplayer: any;
@ViewChild('myvideo1') myvideo1: ElementRef;

ngAfterViewInit() {
      this.videoJSplayer = videojs(document.getElementById('my_video_1'), {}, () => {
           });
      //load the marker plugin
      this.videoJSplayer.markers({
          markers: [
            {time: 9.5, text: "this"},
            {time: 16,  text: "is"},
            {time: 23.6,text: "so"},
            {time: 28,  text: "cool"}
          ]
      });
    }

.angular-cli.json (only the important part):

  "scripts": [
        "../node_modules/jquery/dist/jquery.min.js",
        "../node_modules/rangeslider.js/dist/rangeslider.min.js",
        "../node_modules/video.js/dist/video.min.js",
        "../node_modules/videojs-markers/dist/videojs-markers.js"
      ],

The video is visualized all right, but with no markers:
TypeError: this.videoJSplayer.markers is not a function at VideosComponent.(...)

Thanks!

Alan

@DanielnetoDotCom
Copy link

Same here, I am using video js 6, does it makes any difference?

@TheFrankman
Copy link

Did anyone get anywhere with this ? I'm having the same issue in Vue

@amrishashok
Copy link

Anyone having this issue just add this line at the top of your Angular component
declare var videojs: any;

@CleverMee
Copy link

After installing the videojs-markers, is necessary to import the .js to the app.component.ts like this:
import 'videojs-markers';

Regards

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

5 participants