Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
966 views
in Technique[技术] by (71.8m points)

webview flutter - Auto play not working in Azure media player

I try to play azure media player in flutter web view. Everything working fine but Auto play not working.I hide all controls. I want it to play after page loaded.Here is my code.I don't much about HTML.I enable auto play true but its not working.I tried calling myplayer.play() still not working.Thanks in advance.

HTMl Code :

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Azure Media Player</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width">

    <!--*****START OF Azure Media Player Scripts*****-->
    <!--Note: DO NOT USE the "latest" folder in production. Replace "latest" with a version number like "1.0.0"-->
    <!--EX:<script src="//amp.azure.net/libs/amp/1.0.0/azuremediaplayer.min.js"></script>-->
    <!--Azure Media Player versions can be queried from //amp.azure.net/libs/amp/latest/docs/changelog.html-->
    <script src="https://amp.azure.net/libs/amp/latest/azuremediaplayer.min.js"></script>
    <link href="https://amp.azure.net/libs/amp/latest/skins/amp-default/azuremediaplayer.min.css" rel="stylesheet">
    <!--*****END OF Azure Media Player Scripts*****-->

    <!--Add Plugins-->
    <!-- <script src="hotkeys.js"></script> -->

</head>
<body>

<video id="azuremediaplayer" class="azuremediaplayer amp-default-skin amp-big-play-centered" tabindex="0"> </video>
<script>
var timestampchangedevent = new Event('timestampchanged');
var touchmoved;
var timeMin;



        var myOptions = {

            autoplay: true,
            controls:false,
            width: 640,
            height: "400",

          poster: ""//,
            // plugins: {
            //     hotkeys: {
            //         //optional settings
            //         "volumeStep": 0.1,
            //         "seekStep": 5,
            //         "enableMute": false,
            //         "enableFullscreen": true,
            //         "enableNumbers": true,
            //         "enableJogStyle": false
            //     }
            // }
        };
        var myPlayer = amp("azuremediaplayer", myOptions);

        myPlayer.currentTime(120);

        myPlayer.src([{ src: "https://akamai-theologymediaservice5-usea.streaming.media.azure.net/5f727cb1-03fb-4b45-91b6-27bfc4b19c0a/P YG Park Week 1-1.ism/manifest", type: "application/vnd.ms-sstr+xml" }, ]);
        console.log('timiming');



    myPlayer .addEventListener('timeupdate', function(e) {
    myPlayer.el_.dispatchEvent(timestampchangedevent);

    });
    myPlayer.addEventListener('timestampchanged', function(e)  {
   console.log('timestampchanged');
   //  console.log(e.updatedTimestampIndex);
  //  timeMin=  myPlayer.toTimecode(myPlayer.toPresentationTime(myPlayer.currentTime()));
  touchmoved = myPlayer.currentTime();
  sendBack();

  });

  myPlayer.addEventListener("play", function () {

    });
        myPlayer.play();
    function play(){
      myPlayer.currentTime(120);
       myPlayer.play();

       }

    function sendBack() {


                //messageHandler.postMessage(touchmoved);
             }


    </script>
<footer>
    <br />

    <p>? Microsoft Corporation 2016</p>
</footer>

</body>
</html>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...