bombbomb / BBCore

A Javascript API to use BombBomb services
4 stars 12 forks source link

saveRecordedVideo on mobile #2

Closed Sparkmasterflex closed 8 years ago

Sparkmasterflex commented 8 years ago

This is working fine on desktop but it appears that the saveRecordedVideo() method is never completing and/or succeeding when on the user is on an android or iOS.

Are there any known bugs about this?

Sparkmasterflex commented 8 years ago

So I just figured out why we weren't getting a successful callback from saveRecordedVideo() on mobile. It appears that, on my android at least, the filename is being set to mobilecapture every time and appears that your API requires a unique filename for each video.

I am now concat-ing a random number to the filename now and we get the successful callback but now we're getting the following email from BombBomb:

Dear ,

We noticed that your recently uploaded video, Mobile Captured Video, failed to encode.

Every video you upload to us is processed for delivery to multiple devices and this process sometimes fails on certain video formats or in other rare circumstances.

We recommend uploading the video again.

If this video will not encode correctly, please give us a call, and we'll try to get you going again.

Sorry for the trouble!

Any ideas?

perl5punk commented 8 years ago

Hi Keith,

I apologize if I've missed something from your earlier messages. It's possible the video id is invalid. If you're using 'startVideoRecorder' to setup the recorder, that will return videoInfo with a valid video Id and Filename. If you're using another method and can't use startVideoRecorder, there is an unpublished getVideoId call which returns an Id, the filename is typically predictable from that.

Have you also used /examples/index.html to establish is that works in the mobile instances you're working with?

Cheers, Brian

BRIAN MCGUIRE Senior Software Developer [image: BombBomb | Face to Face with more people, more often] T: 720.320.8559 <7192039728> W: http://BombBomb.com?5957_rm_id=169.4072092.7 http://www.bombbomb.com/?5957_rm_id=169.4072092.72 [image: BombBomb | Face to Face with more people, more often]

On Mon, Feb 15, 2016 at 12:21 PM, Keith Raymond notifications@github.com wrote:

So I just figured out why we weren't getting a successful callback from saveRecordedVideo() on mobile. It appears that, on my android at least, the filename is being set to mobilecapture every time and appears that your API requires a unique filename for each video.

I am now concat-ing a random number to the filename now and we get the successful callback but now we're getting the following email from BombBomb:

Dear ,

We noticed that your recently uploaded video, Mobile Captured Video, failed to encode.

Every video you upload to us is processed for delivery to multiple devices and this process sometimes fails on certain video formats or in other rare circumstances.

We recommend uploading the video again.

If this video will not encode correctly, please give us a call, and we'll try to get you going again.

Sorry for the trouble!

Any ideas?

— Reply to this email directly or view it on GitHub https://github.com/bombbomb/BBCore/issues/2#issuecomment-184352523.

Sparkmasterflex commented 8 years ago

@perl5punk are you referring to the saveRecordedVideo(), filename issue or the email we're receiving about file format?

I am using startVideoRecorder() and here is the code:

  send_bombbomb: (e) =>
    @api = new BBCore(accessToken: @api_key)
    @api.startVideoRecorder
      target: this.$('.bb-container'), (vid_info) =>
        @video_template(vid_info) unless @video_captured is true
    false

I apologize if you're not a coffeescript guy.

perl5punk commented 8 years ago

Both actually, although you're saying that vid_info contains *mobilecapture* instead of a valid videoId? If that's the case I'd use the .getVideoId method to get a valid video Id, instead appending a random number because that is likely why you're getting the encoding failed message. The video Id and filename are closely related and typically the filename is the Id with '.mp4' as the extension.

BRIAN MCGUIRE Senior Software Developer [image: BombBomb | Face to Face with more people, more often] T: 720.320.8559 <7192039728> W: http://BombBomb.com?5957_rm_id=153.4361423.7 http://www.bombbomb.com/?5957_rm_id=153.4361423.72 [image: BombBomb | Face to Face with more people, more often]

On Mon, Feb 15, 2016 at 12:50 PM, Keith Raymond notifications@github.com wrote:

@perl5punk https://github.com/perl5punk are you referring to the saveRecordedVideo(), filename issue or the email we're receiving about file format?

I am using startVideoRecorder() and here is the code:

send_bombbomb: (e) => @api = new BBCore(accessToken: @api_key) @api.startVideoRecorder target: this.$('.bb-container'), (vid_info) => @video_template(vid_info) unless @video_captured is true false

I apologize if you're not a coffeescript guy.

— Reply to this email directly or view it on GitHub https://github.com/bombbomb/BBCore/issues/2#issuecomment-184361924.

Sparkmasterflex commented 8 years ago

@perl5punk I'm not sure we're on the same page here, and if we are and I'm confused, I'm sorry.

here's the code I'm running:

class BombBomb
  # user clicked button to send the video
  send_video: (e) =>
    title = @$('.video-title').val()
    message = @$('.video-message').val()
    @save_video () =>
      @api.videoQuickSend
        subject: title
        mobile_message: message
        video_id: @current_video.videoId
        email_addresses: @lead.email
      , (data) =>
        @default_template {flash: "Video successfully sent to #{@lead.email}"}
    false

  # called in send_video() and 
  save_video: (callback) =>
    title = @$('.video-title').val()
    @api.saveRecordedVideo title, @current_video.videoId, @current_video.videoId, (data) =>
      callback?()

  # when user clicks our button to start recording BB
  send_bombbomb: (e) =>
    @api = new BBCore(accessToken: <api_key>)
    @api.startVideoRecorder
      target: this.$('.bb-container'), (vid_info) =>
        # gives html to allow send of BB
        this.video_template(vid_info) unless @video_captured is true

I am not seeing a getVideoId() method in the BBCore api and I already have the videoId from the vid_info object (saved to @current_video). I tried using the videoId for the 3rd parameter of saveRecordedVideo() and it did not work either.

Sparkmasterflex commented 8 years ago

The email seems to be different now though...

Dear Keith,

We noticed that your recently uploaded video, Mobile Captured Video, failed to encode.

Every video you upload to us is processed for delivery to multiple devices and this process sometimes fails on certain video formats or in other rare circumstances.

We recommend uploading the video again.

If this video will not encode correctly, please give us a call, and we'll try to get you going again.

Sorry for the trouble!

Sparkmasterflex commented 8 years ago

So the email above comes in from mobile and desktop and is directly related to the 3rd parameter passed to saveRecordedVideo not being the <video-obj>.filename.

I've had to revert this in our production codebase so this will still be broken on mobile but our desktop app will be working again.

So this puts us back to getting the mobilecapture filename that stops saveRecordedVideo() from ever completing/succeeding. This actually leaves the user on our end seeing a spinner forever.

We really need some sort of fix for this

perl5punk commented 8 years ago

I've reviewed your code again and saw that you're passing in (title, videoId, videoId, callback) into saveRecordedVideo, this should be (title, videoId, videoFilename, success) as discussed. The videoFilename should be available from @current_video.filename, if @current_video is set by vid_info (the data/parameter passed from startVideoRecorder). If your saying the value of .filename coming through is actually 'mobilecapture' then we'll need to dive a little deeper as I don't believe that should be the case. If so, you can try passing in @current_video.videoId+'.mp4' as the videoFilename parameter into saveRecordedVideo

Let me know.

BRIAN MCGUIRE Senior Software Developer [image: BombBomb | Face to Face with more people, more often] T: 720.320.8559 <7192039728> W: http://BombBomb.com?5957_rm_id=167.4224041.7 http://www.bombbomb.com/?5957_rm_id=167.4224041.72 [image: BombBomb | Face to Face with more people, more often]

On Thu, Feb 18, 2016 at 4:16 PM, Keith Raymond notifications@github.com wrote:

So the email above comes in from mobile and desktop and is directly related to the 3rd parameter passed to saveRecordedVideo not being the

.filename. I've had to revert this in our production codebase so this will still be broken on mobile but our desktop app will be working again. So this puts us back to getting the mobilecapture filename that stops saveRecordedVideo() from ever completing/succeeding. This actually leaves the user on our end seeing a spinner forever. We really need some sort of fix for this — Reply to this email directly or view it on GitHub https://github.com/bombbomb/BBCore/issues/2#issuecomment-185975935.
Sparkmasterflex commented 8 years ago

@perl5punk I made the change to videoId for the file name because you were suggesting using getVideoId. I have since reverted it back to @current_video.filename because videoId was breaking the desktop as well.

With the revert to using @current_video.filename mobile is still broken but we are able to send via the desktop web app. I'll try adding the '.mp4' locally but it seemed appending/prepending anything to filename was breaking it completely

perl5punk commented 8 years ago

Don't append to the filename, append to the videoId. @current_video.videoId+'.mp4' As I mentioned earlier the filename is typically the videoId with .mp4 as the extension.

BRIAN MCGUIRE Senior Software Developer [image: BombBomb | Face to Face with more people, more often] T: 720.320.8559 <7192039728> W: http://BombBomb.com?5957_rm_id=155.4514065.7 http://www.bombbomb.com/?5957_rm_id=155.4514065.72 [image: BombBomb | Face to Face with more people, more often]

On Fri, Feb 19, 2016 at 1:45 PM, Keith Raymond notifications@github.com wrote:

@perl5punk https://github.com/perl5punk I made the change to videoId for the file name because you were suggesting using getVideoId. I have since reverted it back to @current_video.filename because videoId was breaking the desktop as well.

With the revert to using @current_video.filename mobile is still broken but we are able to send via the desktop web app. I'll try adding the '.mp4' locally but it seemed appending/prepending anything to filename was breaking it completely

— Reply to this email directly or view it on GitHub https://github.com/bombbomb/BBCore/issues/2#issuecomment-186398300.

Sparkmasterflex commented 8 years ago

I've updated it to this:

  save_video: (callback) =>
    title = @$('.video-title').val()
    @api.saveRecordedVideo title, @current_video.videoId, "#{@current_video.videoId}.mp4", (data) =>
      callback?()

and I'm still getting the email:

Dear Keith,

Your email with the subject line 'Test it!' contained a video that either failed to encode or was deleted. Sometimes videos will fail to encode for a number of reasons.

We've automatically cancelled this email to keep it from arriving with a missing video.

The best course of action is to try to upload or shoot the video again and reinsert it into your email.

Sorry for the trouble!

This is still working on desktop though.

ehippy commented 8 years ago

I think on mobile you don't have to call saveRecordedVideo, basically. Then I'm curious if the videoId you're sending the sendCustomVideo call (or videoQuickSend call) the same as the id that ends up on the video in the bb account?

On Fri, Feb 19, 2016 at 2:06 PM, Keith Raymond notifications@github.com wrote:

I've updated it to this:

save_video: (callback) => title = @$('.video-title').val() @api.saveRecordedVideo title, @current_video.videoId, "#{@current_video.videoId}.mp4", (data) => callback?()

and I'm still getting the email:

Dear Keith,

Your email with the subject line 'Test it!' contained a video that either failed to encode or was deleted. Sometimes videos will fail to encode for a number of reasons.

We've automatically cancelled this email to keep it from arriving with a missing video.

The best course of action is to try to upload or shoot the video again and reinsert it into your email.

Sorry for the trouble!

This is still working on desktop though.

— Reply to this email directly or view it on GitHub https://github.com/bombbomb/BBCore/issues/2#issuecomment-186408265.

Sparkmasterflex commented 8 years ago

@ehippy I'm using the videoQuickSend method

  send_video: (e) =>
    title = @$('.video-title').val()
    message = @$('.video-message').val()
    $.when(@validate_title()).then =>
      @save_video () =>
        @api.videoQuickSend
          subject: title
          mobile_message: message
          video_id: @current_video.videoId
          email_addresses: @lead.email
        , (data) =>
          ... update UI w/ success ...

    false

Just so I'm understanding correctly, on desktop I need to call the saveRecordedVideo but I do not on mobile?

ehippy commented 8 years ago

Yes. The idea being that with the flash recorder, they have the option to re-record there in the UI onscreen that you can control. On mobile the re-record options are effectively invisible to us in the device UI, so once they click go in the device UI, we know we have the video we want, so we go ahead. On the desktop, we give them that opportunity to re-record right there, and you bring the GO button to the interaction in your ui.

On Fri, Feb 19, 2016 at 2:18 PM, Keith Raymond notifications@github.com wrote:

@ehippy https://github.com/ehippy I'm using the videoQuickSend method

send_video: (e) => title = @$('.video-title').val() message = @$('.video-message').val() $.when(@validate_title()).then => @save_video () => @api.videoQuickSend subject: title mobile_message: message video_id: @current_video.videoId email_addresses: @lead.email , (data) => ... update UI w/ success ...

false

Just so I'm understanding correctly, on desktop I need to call the saveRecordedVideo but I do not on mobile?

— Reply to this email directly or view it on GitHub https://github.com/bombbomb/BBCore/issues/2#issuecomment-186410794.

Sparkmasterflex commented 8 years ago

@ehippy That was it!

I commented out the @save_video() and just did the videoQuickSend() and it went through on my phone.

So I need to device sniff for mobile and skip the @save_video to correct this issue. Any chance you guys will be finding a better way on your end in the near future? This fix will definitely work for now.

perl5punk commented 8 years ago

Not sure if this is ideal but you could try to detect with vid_info.filename == 'mobilecapture'?

BRIAN MCGUIRE Senior Software Developer [image: BombBomb | Face to Face with more people, more often] T: 720.320.8559 <7192039728> W: http://BombBomb.com?5957_rm_id=169.4229010.7 http://www.bombbomb.com/?5957_rm_id=169.4229010.72 [image: BombBomb | Face to Face with more people, more often]

On Fri, Feb 19, 2016 at 2:34 PM, Keith Raymond notifications@github.com wrote:

@ehippy https://github.com/ehippy That was it!

I commented out the @save_video() and just did the videoQuickSend() and it went through on my phone.

So I need to device sniff for mobile and skip the @save_video to correct this issue. Any chance you guys will be finding a better way on your end in the near future? This fix will definitely work for now.

— Reply to this email directly or view it on GitHub https://github.com/bombbomb/BBCore/issues/2#issuecomment-186417284.

Sparkmasterflex commented 8 years ago

thanks @perl5punk, but not really happy with that...

What I am happy with is Modernizr coming to the rescue. I'm doing a check for Modernizr.touch to determine mobile vs desktop