Giter VIP home page Giter VIP logo

Comments (8)

tamw-wnet avatar tamw-wnet commented on September 25, 2024

No worries! The problem we have here is that PBS doesn't provide any way for us to access a user's preferences -- aka watchlist, or where they left off on a particular video. They do have this available for their internal uses as part of PBS Account, but haven't made it available to 'external' developers.

From my conversations with them I think this is on their roadmap. Specifically they're working on an evolution of PBS Account that will also work with NPR's auth setup, and that's supposed to include 'portable' preference setting. That's going to be at least a year, though.

If you don't need to have cross-platform access to the view status, you could try an approach that doesn't even require logging in; get the position of the video from JW Player (the basis of the Partner Player) when a person exits, store that in a cookie, and check for the cookie when a person starts up again. I have some javascript I can dig up that checks the status of the Partner Player video iframe that you could possibly use as a starting point.

from pbs-passport-authenticate.

not-original avatar not-original commented on September 25, 2024

Thanks for the reply, really appreciate it. I kinda came to the same conclusion, but thought I would check to see if I was missing anything -- so now I feel much better :)

But yes, if you have that javascript, I certainly could use it. To be honest, trying to read 'status' from the embedded iframe jwplayer video has been tricky to say the least.

And again, thanks for the reply.

from pbs-passport-authenticate.

tamw-wnet avatar tamw-wnet commented on September 25, 2024

I use it to do event tracking. See this blog post, you can ignore all the bits about getting Google Tag Manager working. https://ieg.wnet.org/2015/07/using-google-tag-manager-for-custom-event-tracking/

from pbs-passport-authenticate.

not-original avatar not-original commented on September 25, 2024

Awesome, thank you very much! I owe you one!

Chet

from pbs-passport-authenticate.

tamw-wnet avatar tamw-wnet commented on September 25, 2024

that code's a few years old and there's been some updates because PBS has changed some things.

<script>
if(typeof window.addEventListener==='function'){
  window.addEventListener("message",receiveCOVEVideoMessage,false);
}else{
  window.attachEvent("onmessage",receiveCOVEVideoMessage);
}

var COVEVideoTitle;
var COVELastAction;
function receiveCOVEVideoMessage(evt){
  if(typeof window["dataLayer"]==='undefined'){
    dataLayer = [];
  }
  if ( evt.origin == 'http://player.pbs.org' || evt.origin == 'https://player.pbs.org' ) {
    var thissourcewindow = evt.source;
    var data=evt.data,
      action=evt.data.split('::')[0],
      value=evt.data.split('::')[1];
    if (action==="video") {
      if (value==="playing" && COVELastAction !=="seeking") {
        dataLayer.push({
          event: 'COVEEvent',
          'COVEaction':'MediaStart',
          'videoTitle': COVEVideoTitle
        });
        COVELastAction=value;
      } else if (value==="seeking") {
        COVELastAction=value;
      } else if (value==="finished" && COVELastAction !=="finished") {
        dataLayer.push({
          event: 'COVEEvent',
          'COVEaction':'MediaFinish',
          'videoTitle': COVEVideoTitle
        });
        COVELastAction=value;
      }
    } else if (action==="videoInfo") {
      videoInfo = JSON.parse(value);
      COVEVideoTitle = videoInfo.title;
      if (typeof videoInfo.program.title !== 'undefined') {
        COVEVideoTitle = videoInfo.program.title + ": " + COVEVideoTitle;
      }
    }
  }
}
</script>

from pbs-passport-authenticate.

not-original avatar not-original commented on September 25, 2024

Thanks, any idea what the variable for the ID or slug of the video being viewed would be?

COVEVideoID

or similar? Is there a doc out there that lists the variables/actions?

from pbs-passport-authenticate.

tamw-wnet avatar tamw-wnet commented on September 25, 2024

not offhand. If you dump the entire output of 'data' to console instead of what I've filtered it down to, I think it'll be there. Probably along with the position in the video.

from pbs-passport-authenticate.

not-original avatar not-original commented on September 25, 2024

Will do, thanks again for your help!

from pbs-passport-authenticate.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.