<commit_before>function OfficialfmPlayer() {
    this.prototype = new AbstractPlayer;
    var self = this;
    self.initialized = false;
    self.type = 'officialfm';
    self.video = null;
    self.volume = 100;
    self.mp3_url = 'http://cdn.official.fm/'

    /* Init the player */
    self.init = function(callback) {
        soundManager.onready(function() {
            self.initialized = true;
            if (callback) {
                callback(self);
            }
        });
    };
    
    /* Hide the player from the UI. Must be callable without prior init */
    self.hide = function() {
        $('#officialfm').hide();
    };

    /* Show the player. Must be callable without prior init */
    self.show = function() {
        $('#officialfm').show();
    };
    
    /* Start (or if video is null resume) playback of a video */
    self.play = function(video) {
        if (video) {
            self.video = video;
            soundManager.stopAll();
            soundManager.createSound({
                id: video.videoId,
                url: 'http://cdn.official.fm/mp3s/' + Math.floor(video.videoId / 1000) + '/' + video.videoId + '.mp3',
                volume: self.volume,
                onplay: function() {
                    EventSystem.callEventListeners('video_started_playing_successfully', self.video);
                },
                onresume: function() {
                    EventSystem.callEventListeners('backend_played_video', self.video);
                },
                onpause: function() {
                    EventSystem.callEventListeners('backend_paused_video', self.video);
                },
                onfinish: function() {
                    soundManager.destroySound('soundcloud');
                    EventSystem.callEventListeners('video_played_to_end', self);
                }
            });
            soundManager.play(self.video.videoId);
        } else {
            soundManager.play(self.video.videoId);
        }
    };
    
    /* Pauses the current video */
    self.pause = function() {
        soundManager.pause(self.video.videoId);
    };
    
    /* Enter fullScreen (must respect self.show() & self.hide()) */
    self.fullScreenOn = function() {
        //        throw 'Error in AbstractPlayer: This method must be overridden.';
    };
    
    /* Exit fullScreen (must respect self.show() & self.hide()) */
    self.fullScreenOff = function() {
        //        throw 'Error in AbstractPlayer: This method must be overridden.';
    };
    
    /* Set volume (0-100) */
    self.setVolume = function(volume) {
        self.volume = volume;
        if (self.video) {
            soundManager.setVolume(self.video.videoId, volume);
        }<commit_msg>Port soundcloud player fix to official.fm player<commit_after>function OfficialfmPlayer() {
    this.prototype = new AbstractPlayer;
    var self = this;
    self.initialized = false;
    self.type = 'officialfm';
    self.video = null;
    self.volume = 100;
    self.mp3_url = 'http://cdn.official.fm/'

    /* Init the player */
    self.init = function(callback) {
        soundManager.onready(function() {
            self.initialized = true;
            if (callback) {
                callback(self);
            }
        });
    };
    
    /* Hide the player from the UI. Must be callable without prior init */
    self.hide = function() {
        $('#officialfm').hide();
    };

    /* Show the player. Must be callable without prior init */
    self.show = function() {
        $('#officialfm').show();
    };
    
    /* Start (or if video is null resume) playback of a video */
    self.play = function(video) {
        if (video) {
            self.video = video;
            soundManager.stopAll();
            soundManager.createSound({
                id: video.videoId,
                url: 'http://cdn.official.fm/mp3s/' + Math.floor(video.videoId / 1000) + '/' + video.videoId + '.mp3',
                volume: self.volume,
                onplay: function() {
                    EventSystem.callEventListeners('video_started_playing_successfully', self.video);
                },
                onresume: function() {
                    EventSystem.callEventListeners('backend_played_video', self.video);
                },
                onpause: function() {
                    EventSystem.callEventListeners('backend_paused_video', self.video);
                },
                onfinish: function() {
                    soundManager.destroySound('soundcloud');
                    EventSystem.callEventListeners('video_played_to_end', self);
                }
            });
            soundManager.play(self.video.videoId);
        } else {
            soundManager.play(self.video.videoId);
        }
    };
    
    /* Stops the current video */
    self.stop = function() {
        self.video = null;
        soundManager.stopAll();
    };
    
    /* Pauses the current video */
    self.pause = function() {
        soundManager.pause(self.video.videoId);
    };
    
    /* Enter fullScreen (must respect self.show() & self.hide()) */
    self.fullScreenOn = function() {
        //        throw 'Error in AbstractPlayer: This method must be overridden.';
    };
    
    /* Exit fullScreen (must respect self.show() & self.hide()) */
    self.fullScreenOff = function() {
        //        throw 'Error in AbstractPlayer: This method must be overridden.';
    };
    
    /* Set volume (0-100) */
    self.setVolume = function(volume) {
        self.volume = volume;
        if (self.video) {
            soundManager.setVolume(self.video.videoId, volume);
        }
{'fraction_non_alphanumeric': 0.12475668023358698, 'fraction_numerical': 0.004954875243319766, 'mean_word_length': 1.7212325469427059, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5689486', 'n_tokens_mistral': 1581, 'n_tokens_neox': 1507, 'n_words': 329}