snapshot() issue on WebSDK

Discussion in 'General Discussion' started by Joao Paulo De Luca, Jan 29, 2020.

  1. Joao Paulo De Luca

    Joao Paulo De Luca New Member

    Hey guys,
    I'm developing the streaming video to our standard application using the Flashphoner WebSDK.
    Everything was looking ok, but, at certain point, we are concerned of a problem with the snapshot() and I'm 2 days looking for a solution.

    Code:
    [I][B]session
    .createStream({
    name: name,
    cacheLocalResources: false
    })
    .on(STREAM_STATUS.SNAPSHOT_COMPLETE, function(stream) {
    console.log('>>>>>>>> snapshot method on STREAM_STATUS.SNAPSHOT_COMPLETE stream.getInfo()', stream.getInfo().substring(0, 253))
    setSnapshotStatus(STREAM_STATUS.SNAPSHOT_COMPLETE);
    ... // code goes on
    }).on(STREAM_STATUS.FAILED, snapshotFailedHandler)
    .snapshot()[/B][/I]
    [CODE]
    Basically is the same from the documentation. The point is: that works fine in any Huawei cellphones (Chrome 79+). Everytime when I push the snapshot button, the new preview image comes. But, with some Samsung Galaxy and iPhones (both using Chrome 79+), the first snapshot goes OK, but the second snapshot returns the exactly same previous stream.getInfo(). When I push again, the second image comes and that goes on.
    Theres some reason for that? Theres some solution?
    Thanks in advice and sorry my bad english. Working in progress.
    
    J.P.
    Last edited: Jan 30, 2020
  2. Max

    Max Administrator Staff Member

    Good day.
    We cannot reproduce the issue on Samsung Galaxy J4+ (Android 9, Chrome 79) and on iPhone 7 (iOS 13.3, Safari) using Stream Snapshot example with latest WCS build. Note that on iOS devices you must use Safari to publish WebRTC stream from Stream Snapshot example because third side browsers do not support WebRTC in iOS.
    Please clarify the following:
    1. How do you check the stream snapshot picture changing? If you compare strings returned by stream.getInfo(), you should compare whole string rather then string beginning.
    2. Check if the issue can be reproduced in Stream Snapshot example "out of the box".
    Also please note that to take a snapshot using WebSDK you should create a new stream object and release it when snapshot is taken:
    Code:
    function snapshot(name) {
        var session = Flashphoner.getSessions()[0];
        session.createStream({name: name}).on(STREAM_STATUS.SNAPSHOT_COMPLETE, function(stream){
            console.log("Snapshot complete");
            snapshotImg.src = "data:image/png;base64,"+stream.getInfo();
            //remove failed callback
            stream.on(STREAM_STATUS.FAILED, function(){});
            //release stream object
            stream.stop();
        }).on(STREAM_STATUS.FAILED, function(stream){
            setSnapshotStatus(STREAM_STATUS.FAILED);
            console.log("Snapshot failed, info: " + stream.getInfo());
        }).snapshot();
    }
    
    If the issue is reproducing in Stream Snapshot example please collect a report as described here and send to support@flashphoner.com, we will check
  3. Joao Paulo De Luca

    Joao Paulo De Luca New Member

    Hey Max, thanks by your answer.
    Let me try to clarify.
    1. How do you check the stream snapshot picture changing? If you compare strings returned by stream.getInfo(), you should compare whole string rather then string beginning.
    Well... the main check is because the picture is the same than the previous. the base64's console.log was only to confirm my point before to open the thread.

    2. Check if the issue can be reproduced in Stream Snapshot example "out of the box".
    I can to make two videos to see (one with Huawei and other one with samsung)? that help? The most strange thing is: the problem seems don't have any with the streamer file, but with the device of the streamer.


    Code:
    function snapshot(name) {
        var session = Flashphoner.getSessions()[0];
        session.createStream({name: name}).on(STREAM_STATUS.SNAPSHOT_COMPLETE, function(stream){
            console.log("Snapshot complete");
            snapshotImg.src = "data:image/png;base64,"+stream.getInfo();
            //remove failed callback
            stream.on(STREAM_STATUS.FAILED, function(){});
            //release stream object
            stream.stop();
        }).on(STREAM_STATUS.FAILED, function(stream){
            setSnapshotStatus(STREAM_STATUS.FAILED);
            console.log("Snapshot failed, info: " + stream.getInfo());
        }).snapshot();
    }
    
    Yes.. that's the piece we are using.
    Let me make the video.
  4. Joao Paulo De Luca

    Joao Paulo De Luca New Member

    OK (on second snapshot previewing the new image, with Huawei)
    [​IMG]
    FAIL (on second snapshot, repeating the previous shot, with Samsung)
    [​IMG]
  5. Max

    Max Administrator Staff Member

Share This Page