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

Does not handle calls to .src(src) #10

Closed
tomsaffell opened this issue May 20, 2013 · 10 comments
Closed

Does not handle calls to .src(src) #10

tomsaffell opened this issue May 20, 2013 · 10 comments

Comments

@tomsaffell
Copy link

Hi Exon,

Great work getting this going. I tried the example, and it worked great. Then I tried to play videos via the .src() call to videojs. e.g.

video.src({type: 'video/youtube', src: 'http://www.youtube.com/watch?v=xjS6SftYQaQ'}

Which doesnt work, because there is no .src() function to handle that. I have created a fix for this which works, but doesnt yet handle the case where the video src is specified in the html. So I need to re-apply some of the original code before it's merge ready. I also moved a few things around to factor-out the regexing the of the IDs from the init. If you have time to jump on IRC at some point we could figure how best to merge it back.

tom

@jontroncoso
Copy link

Hey there, tomsaffell. I am in need of this fix for a project I am working on, would you be able to share the code with me? You can find my email on my profile.

@tomsaffell
Copy link
Author

hi @OmniTool. You can find my fork here: https://github.com/tomsaffell/videojs-youtube
warning: it's pretty rough around the edges - I changed it to do specifically what we need, but I didnt ensure that I didnt break other use cases in the process. We use it in production.

To use:

player.src({type: 'video/youtube', src: 'https://www.youtube.com/watch?v=xxxxxxx'})

@eXon
Copy link
Collaborator

eXon commented Jul 2, 2013

@tomsaffell I would like to fork back your work, this feature is missing and should be available. What's stopping you from making it ready to test right now?

@tomsaffell
Copy link
Author

@eXon I'm pretty sure I broke the original method for specifying the src. I wouldnt be hard to merge the two together, I just dont have the time right now, which is why I didnt submit a PR. You're very welcome to merge the two together. Do you need any info from me to do that?

@eXon
Copy link
Collaborator

eXon commented Jul 2, 2013

I will probably just take your code and rewrite it inside my branch. I'm having trouble because the loadVideoById doesn't seem to work inside the videojs.Youtube.prototype.src. What HTML code are you using to test this?

Also, any reason why you are forcing the YouTube controls on Android and iOS?

@tomsaffell
Copy link
Author

Yeah, manually merging them is probably the best option. You can see a working example here:
http://tcsdev.www.videopixie.com/st/dev/vjs4.3.html which will show how we're setting up VJS and calling it.

Also, any reason why you are forcing the YouTube controls on Android and iOS?

Because my test indicated that on iOS (and some versions of Android) the browser would render YT's controls no matter what I did (causing double controls), so I defaulted it to not show the VJS controls in that case. Related to this: VJS has some issues around when to show controls, especially when switching techs. The state variables that determine whether the controls should be shown are messed up when switching techs. Try switching techs in the example above and you'll see it mostly works, but it is possible to occasionally get double controls.

the loadVideoById doesn't seem to work inside the videojs.Youtube.prototype.src

I dont understand this part, but hopefully the example will help. If not LMK.

@mzaky
Copy link

mzaky commented Jul 21, 2013

Hi all,

could someone help:

function loadVideo(playerUrl, offset) {

var ytURL = playerUrl.split('?')[0];
var vtype = 'video/youtube';
//document.getElementById('v1').innerHTML = html.join('');
// declare object for video

     var player;

     videojs('vid1',{
        techOrder:['html5', "flash", "youtube", 'vimeo'],    
     },function(){ 

        //console.log(' -> VideoJS ready for id: ');
        player = this;
     });

     player.src({
           type: vtype,
           src: ytURL
        }); 

}

if I call this function through, i don't get the video updated:
loadVideo(playerUrl, true)

@ulisesrmzroche
Copy link

@eXon, @tomsaffell , so, what's up with this feature? I'd like to use this today. I can finish the rest of it if ya'll want.

eXon added a commit that referenced this issue Aug 11, 2013
@eXon
Copy link
Collaborator

eXon commented Aug 11, 2013

@ulisesrmzroche @mzaky @tomsaffell @OmniTool Now this should work. Let me know if you see any bug.

@eXon eXon closed this as completed Aug 11, 2013
eXon added a commit that referenced this issue Aug 11, 2013
@ulisesrmzroche
Copy link

@eXon, nice! This is shaping up to be a great morning.

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