googlecast / CastVideos-chrome

Reference Chrome Sender w/ Framework API: CastVideos-chrome application shows how to cast videos from Chrome browser that is fully compliant with the Cast Design Checklist.
Apache License 2.0
281 stars 117 forks source link

Initialization in Vue.js #22

Closed ivansteff closed 4 years ago

ivansteff commented 4 years ago

How to initialize Chromecast in VueJs? if you do as in the code below, an error appears: err

index.html

<!DOCTYPE html>
<html>
<head>
<title>Cast Videos: Google Cast Chrome Sender SDK Demo App</title>
<link rel="stylesheet" type="text/css" href="css/CastVideos.css">
<link href='//fonts.googleapis.com/css?family=Roboto&subset=latin,cyrillic-ext,greek-ext,latin-ext' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="app">
.....
<button @click="startCast()">
Cast
</button>
.....
</div>
      <script type="text/javascript" src="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1"></script>
</body>
</html>

palyer.vue

<template>
...
</template>
<script>
    import CastVideo from '../CastVideo.js'
    export default {
        name: 'palyer',
        data() {},
        methods(){
        startCast(){
            var a = new CastVideo();
            a.initializeCastPlayer();
        }
    }
</script>

Please tell me what I'm doing wrong.